Call for testing: Snapcraft 7

  pyqt5-sip:
    source: .
    plugin: python
    python-packages:
      - pyqt5-sip
      - --no-deps
      - --target=$CRAFT_PART_INSTALL/usr/lib/python3.10/site-packages
    prime:
      - -bin/
      - -lib/
      - -share/
  gl2ps:
    source-type: tar
    source: https://geuz.org/gl2ps/src/gl2ps-1.4.2.tgz
    source-checksum: sha256/8d1c00c1018f96b4b97655482e57dcb0ce42ae2f1d349cd6d4191e7848d9ffe9
    plugin: cmake
    cmake-generator: Ninja
    cmake-parameters:
      - "-DCMAKE_BUILD_TYPE=Release"
      - "-DCMAKE_INSTALL_PREFIX=/usr"
    build-packages:
      - g++
    stage-packages:
      - libgl1
      - libpng16-16
    prime:
      - -usr/lib/libgl2ps.a
      - -usr/include
      - -usr/share

I don’t see that error message with snapcraft 6.1 + core22

The nmap snap with base:core22 builds fine on snapcraft 7.01(candidate), and it’s actually published on edge already. However, successive local builds fail while processing the icon:

$ snapcraft clean
Removed instance: snapcraft-nmap-1707314

$ snapcraft pack
Launching instance...
Installed package repositories
Executed: pull nmap
Executed: overlay nmap
Copying needed target link from the system: /usr/sbin/rmt-tar
Executed: build nmap
Executed: stage nmap
Executed: prime nmap
Executed parts lifecycle
Generated snap metadata
Created snap package

$ snapcraft pack
Launching instance...
Installed package repositories
Executed: skip pull nmap (already ran)
Executed: skip overlay nmap (already ran)
Executed: skip build nmap (already ran)
Executed: skip stage nmap (already ran)
Executed: skip prime nmap (already ran)
Executed parts lifecycle
Copying snap assets...
Traceback (most recent call last):
  File "/snap/snapcraft/x1/bin/snapcraft", line 8, in <module>
    sys.exit(run())
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/cli.py", line 161, in run
    dispatcher.run()
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/craft_cli/dispatcher.py", line 406, in run
    return self._loaded_command.run(self._parsed_command_args)
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 206, in run
    super().run(parsed_args)
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/commands/lifecycle.py", line 82, in run
    parts_lifecycle.run(self.name, parsed_args)
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 150, in run
    _run_command(
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 242, in _run_command
    setup_assets(
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/parts/setup_assets.py", line 73, in setup_assets
    icon_path = _finalize_icon(
  File "/snap/snapcraft/x1/lib/python3.8/site-packages/snapcraft/parts/setup_assets.py", line 136, in _finalize_icon
    shutil.copy(source_path, target_icon_path)
  File "/snap/snapcraft/x1/usr/lib/python3.8/shutil.py", line 418, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/x1/usr/lib/python3.8/shutil.py", line 244, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: PosixPath('/root/prime/meta/gui/icon.png') and PosixPath('/root/prime/meta/gui/icon.png') are the same file
Failed to execute pack in instance.
Full execution log: '/home/user/.cache/snapcraft/log/snapcraft-20220527-114837.279122.log'

$ 
1 Like

Curiously, successive local builds of htop work flawlessly.

Moving the icon from meta/gui/ to the top level fixes the issue.

Couldn’t use snapcore/action-build to build snap on GitHub with snapcraft 7.0 beta or candidate (reported in action hangs forever with snapcraft beta/7.0 · Issue #37 · snapcore/action-build (github.com)

I found a bug either in snapcraft 7 or in the documentation: Cannot use adapter: none with snapcraft 7.0.1 and base: core22

@mchinoune, thanks for finding this. core22 is including the dependencies of libpng16-16, which is causing some directory conflicts. I’m not aware of any workaround right now, let me get back to you with a solution.

@zyga, good catch, thanks. It’s not clear in the migration guide or documentation that adapter has been deprecated for core22.

Are adapters entirely gone now? Is there a way to do something similar?

Thanks for reporting. PR #3767 should fix this.

1 Like

The adapter: key and the runner script are gone (and should have left some kind of explanatory message), but the functionality is still there. The migration guide should cover the details on how to override the variables.

I have removed that dependency as a workaround (since gl2ps is just a part, and libpng16-16 is already a dependency of the app), but still get the same error.

Note that I start getting this message when building gl2ps that I don’t see with snapcraft 6.1:

fix symlink: path='/home/runner/work/makhber/makhber/parts/gl2ps/install/lib64/ld-linux-x86-64.so.2', unpack_dir='/home/runner/work/makhber/makhber/parts/gl2ps/install', root='/home/runner/work/makhber/makhber/parts/gl2ps/install/lib64'

A workaround is to not install pyqt5-sip using python plugin

  pyqt5-sip:
    source: .
    plugin: make
    build-packages:
      - python3-pip
    override-build: |
      pip3 install pyqt5-sip --target=$CRAFT_PART_INSTALL/usr/lib/python3.10/site-packages

This is a debug message from the parts processing library and shouldn’t appear to Snapcraft users in non-debug modes (@facundobatista, I believe this is another issue to address in craft-cli).

Another issue: It seems like snapcraft no longer check and warn about missing runtime libraries.

7.0.2 on candidate should address this issue

Do you mind trying 7.0.2 in candidate now?

7.0.2 now in candidate should address this issue

You are spot on and I missed this in the release notes, we are working on a snapcraft lint command to address all these warnings and errors.

7.0.2 is giving me errors while building the core22 snap using https://github.com/snapcore/core-base/pull/45 :

$ snapcraft 
Launching instance...                                                                                                                                  
Installed package repositories                                                                                                                         
Executed: pull probert-deb                                                                                                                             
Executed: pull consoleconf-deb                                                                                                                         
/root/project/parts/bootstrap/install/var/cache/apt/archives/lock: Permission denied                                                                   
Full execution log: '/tmp/snapcraft.log'                                                                                                               
Failed to execute pack in instance.                                                                                                                    
Full execution log: '/home/abeato/.cache/snapcraft/log/snapcraft-20220531-112755.736487.log' 

Log is: https://paste.ubuntu.com/p/pT4W7K3Mcc/

@cmatsuoka another one to look at :point_up: