← Back to issue list

".snapcraft.yaml" not picked up as a project file

View original Github issue

Metadata

Project
snapcraft
Number
#5083
Type
issue
State
closed
Author
SuperAlpaca27
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Fixed in Snapcraft 8.9 for core24. Refactoring in craft-application resolved the regression that prevented snapcraft from recognizing .snapcraft.yaml as a valid project file. Requires regression testing to prevent future failures.

Suggested action:

No scores available.

Issue body

### Bug Description When trying to use `.snapcraft.yaml` as the project file (with, for example https://github.com/maxiberta/htop-snap), `snapcraft` gives the error: ``` ❯ snapcraft Project file 'snapcraft.yaml' not found in '/home/superalpaca/canonical/htop-snap'. Recommended resolution: Ensure the project file exists. Full execution log: '/home/superalpaca/.local/state/snapcraft/log/snapcraft-20241001-130647.933900.log' ``` I've only tried this on snapcraft 8.4.1 with a core24 snap, so not sure if this applies to others versions/bases as well. ### To Reproduce Prerequisite is snapcraft 8.4.1 installed on the system ``` git clone https://github.com/maxiberta/htop-snap cd htop-snap mv snap/snapcraft.yaml .snapcraft.yaml snapcraft ``` ### Environment On Ubuntu 24.04.1 LTS, using snapcraft 8.4.1 and using LXD for the build I think ### snapcraft.yaml ```yaml name: htop base: core24 adopt-info: htop summary: Interactive processes viewer description: | htop is an ncurses-based process viewer similar to top, but it allows one to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. Once installed, this snap can _optionally_ be connected to some extra plugs: sudo snap connect htop:mount-observe sudo snap connect htop:network-control # DELAYACCT support Main website: https://htop.dev/ icon: htop.png grade: devel confinement: strict license: GPL-2.0 compression: lzo apps: htop: command-chain: [bin/locales-launch] command: usr/local/bin/htop desktop: usr/local/share/applications/htop.desktop environment: TERMINFO_DIRS: $SNAP/lib/terminfo:$SNAP/usr/share/terminfo plugs: - network - hardware-observe - mount-observe - network-control - process-control - system-observe parts: htop: plugin: autotools source: https://github.com/htop-dev/htop source-type: git source-branch: main autotools-configure-parameters: - --enable-capabilities - --enable-delayacct - --enable-linux-affinity - --enable-openvz - --enable-sensors - --enable-unicode - --enable-vserver override-build: | craftctl set version=$(git describe --tags --long) craftctl default build-packages: - libcap-dev - libgcc-s1 - libncurses-dev - libnl-3-dev - libnl-genl-3-dev - libsensors-dev - pkg-config stage-packages: - kitty-terminfo - libcap2 - libncursesw6 - libsensors5 - libtinfo6 - libsystemd0 - ncurses-base - ncurses-term - lsof - strace # Stage snap for fixing the Glibc locales # https://forum.snapcraft.io/t/the-locales-launch-stage-snap/10296 locales-launch: source: https://github.com/Lin-Buo-Ren/locales-launch.git source-tag: v1.0.0 plugin: dump stage-packages: # For localedef(1) - libc-bin # For locale data used by localedef(1) - locales # All pre-generated locale data # DISABLED: Lots of duplicate data will be included in snap when this is staged, unless the target machine has no resource to generate them in runtime otherwise not using it # Lack of compiled locales breaks gettext based localisation - snapcraft - snapcraft.io # https://forum.snapcraft.io/t/lack-of-compiled-locales-breaks-gettext-based-localisation/3758 #- locales-all stage: - bin/locales-launch - etc/locale.alias - usr/bin/localedef - usr/share/doc/locales - usr/share/i18n - usr/share/locale ``` ### Relevant log output ```shell 2024-10-01 13:06:47.934 Starting snapcraft, version 8.4.1 2024-10-01 13:06:47.934 Log verbosity level set to BRIEF 2024-10-01 13:06:47.934 Preparing application... 2024-10-01 13:06:47.934 Configuring application... 2024-10-01 13:06:47.935 Setting up ConfigService 2024-10-01 13:06:47.956 Build plan: platform=None, build_for=None 2024-10-01 13:06:47.956 Project file 'snapcraft.yaml' not found in '/home/superalpaca/canonical/htop-snap'. 2024-10-01 13:06:47.956 Detailed information: The project file could not be found. 2024-10-01 13:06:47.959 Traceback (most recent call last): 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/snapcraft/application.py", line 173, in _resolve_project_path 2024-10-01 13:06:47.959 return super()._resolve_project_path(project_dir / "snap") 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/craft_application/application.py", line 252, in _resolve_project_path 2024-10-01 13:06:47.959 return (project_dir / f"{self.app.name}.yaml").resolve(strict=True) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/usr/lib/python3.10/pathlib.py", line 1077, in resolve 2024-10-01 13:06:47.959 s = self._accessor.realpath(self, strict=strict) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/bin/../usr/lib/python3.10/posixpath.py", line 396, in realpath 2024-10-01 13:06:47.959 path, ok = _joinrealpath(filename[:0], filename, strict, {}) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/bin/../usr/lib/python3.10/posixpath.py", line 431, in _joinrealpath 2024-10-01 13:06:47.959 st = os.lstat(newpath) 2024-10-01 13:06:47.959 FileNotFoundError: [Errno 2] No such file or directory: '/home/superalpaca/canonical/htop-snap/snap/snapcraft.yaml' 2024-10-01 13:06:47.959 2024-10-01 13:06:47.959 During handling of the above exception, another exception occurred: 2024-10-01 13:06:47.959 Traceback (most recent call last): 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/snapcraft/application.py", line 176, in _resolve_project_path 2024-10-01 13:06:47.959 return super()._resolve_project_path(project_dir) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/craft_application/application.py", line 252, in _resolve_project_path 2024-10-01 13:06:47.959 return (project_dir / f"{self.app.name}.yaml").resolve(strict=True) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/usr/lib/python3.10/pathlib.py", line 1077, in resolve 2024-10-01 13:06:47.959 s = self._accessor.realpath(self, strict=strict) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/bin/../usr/lib/python3.10/posixpath.py", line 396, in realpath 2024-10-01 13:06:47.959 path, ok = _joinrealpath(filename[:0], filename, strict, {}) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/bin/../usr/lib/python3.10/posixpath.py", line 431, in _joinrealpath 2024-10-01 13:06:47.959 st = os.lstat(newpath) 2024-10-01 13:06:47.959 FileNotFoundError: [Errno 2] No such file or directory: '/home/superalpaca/canonical/htop-snap/snapcraft.yaml' 2024-10-01 13:06:47.959 2024-10-01 13:06:47.959 During handling of the above exception, another exception occurred: 2024-10-01 13:06:47.959 Traceback (most recent call last): 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/craft_application/application.py", line 273, in get_project 2024-10-01 13:06:47.959 project_path = self._resolve_project_path(self.project_dir) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/snapcraft/application.py", line 178, in _resolve_project_path 2024-10-01 13:06:47.959 return super()._resolve_project_path(project_dir / "build-aux" / "snap") 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/lib/python3.10/site-packages/craft_application/application.py", line 252, in _resolve_project_path 2024-10-01 13:06:47.959 return (project_dir / f"{self.app.name}.yaml").resolve(strict=True) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/usr/lib/python3.10/pathlib.py", line 1077, in resolve 2024-10-01 13:06:47.959 s = self._accessor.realpath(self, strict=strict) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/bin/../usr/lib/python3.10/posixpath.py", line 396, in realpath 2024-10-01 13:06:47.959 path, ok = _joinrealpath(filename[:0], filename, strict, {}) 2024-10-01 13:06:47.959 File "/snap/snapcraft/12607/bin/../usr/lib/python3.10/posixpath.py", line 431, in _joinrealpath 2024-10-01 13:06:47.959 st = os.lstat(newpath) 2024-10-01 13:06:47.959 FileNotFoundError: [Errno 2] No such file or directory: '/home/superalpaca/canonical/htop-snap/build-aux' 2024-10-01 13:06:47.959 Recommended resolution: Ensure the project file exists. 2024-10-01 13:06:47.959 Full execution log: '/home/superalpaca/.local/state/snapcraft/log/snapcraft-20241001-130647.933900.log' ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Fixed in Snapcraft 8.9 for core24. Refactoring in craft-application resolved the regression that prevented snapcraft from recognizing .snapcraft.yaml as a valid project file. Requires regression testing to prevent future failures.
qwen/qwen3.6-35b-a3b Fixed in Snapcraft 8.9 for core24. The regression preventing snapcraft from recognizing .snapcraft.yaml as a valid project file was resolved by updating the craft-application loading logic. Regression testing is pending.
qwen3.6-35b-a3b-mtp-q6 Fixed in Snapcraft 8.9 for core24. A craft-application regression prevented snapcraft from recognizing .snapcraft.yaml. Project file loading logic was updated to resolve this, pending regression testing.
qwen3.6-35b-a3b-mtp-q6 Fixed in Snapcraft 8.9 for core24. The craft-application regression that ignored .snapcraft.yaml was resolved, though regression testing is recommended to prevent recurrence.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#6204 test: regression tests for .snapcraft.yaml as project file snapcraft merged Merged regression tests for #5083 confirming .snapcraft.yaml detection. The fix was previously applied in PR #5349 via a craft-application 5 refactor. Adds unit, integration, and spread tests covering all supported project file locations.
70%