".snapcraft.yaml" not picked up as a project file
Metadata
Current evaluation
Fixed in Snapcraft 8.9 for core24 by PR #5349, which rebased Snapcraft onto craft-application 5 and restored .snapcraft.yaml detection.
Resolution: —
Evaluated by: mr-cal-bot
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | — | Fixed in Snapcraft 8.9 for core24 by PR #5349, which rebased Snapcraft onto craft-application 5 and restored .snapcraft.yaml detection. | |
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft 8.9 restored recognition of .snapcraft.yaml for core24 through the craft-application 5 rebase merged in #5349 (ddbf2a6f8). | |
| 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. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #5349 refactor: rebase onto craft-application 5 | snapcraft | merged | Merged in snapcraft#5349 as ddbf2a6f8, rebasing Snapcraft onto craft-application 5 and restoring .snapcraft.yaml project detection for core24. | |
| #4769 snapcraft 8.2.1: `snapcraft pack` not respecting `<directory>` arg to find `snapcraft.yaml` | snapcraft | closed | Fixed in Snapcraft 8.2.6 by PR #4794 (commit 48483c4e3), restoring project-file lookup for snapcraft pack <directory>; the reporter confirmed the fix. | |
| #1073 project: snapcraft.yaml in a snap directory | snapcraft | merged | Merged in commit 78f3d4fe3: new projects default to snap/snapcraft.yaml while both legacy manifest locations remain supported. |