← Back to issue list

charmcraft --project-dir does not work for build anymore

View original Github issue

Metadata

Project
charmcraft
Number
#433
Type
issue
State
closed
Author
heitorPB
Labels
—
Created
Updated
Closed

Current evaluation

Closed as working as designed: maintainer facundobatista explained `build` selects its project dir with `--from`, not `--project-dir` (which `pack` uses), so `charmcraft build --from charm-slurmd/` works.

Resolution: closed not a bug

Reason: In the closing comment (2021-07-07) facundobatista clarified that `build` now runs in an LXC container like `pack` and takes `--from` rather than the global `--project-dir` option, so the reported behaviour was intended and no code fix was needed. The follow-up request for a deprecation warning was delivered separately in PR #683 (commit 98e78a1c), and the `build` command was eventually removed in PR #798.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Hello, I just got charmcraft 1.1.0 and was trying the new `charmcraft.yaml` for our [slurmc-charms](https://github.com/omnivector-solutions/slurm-charms). `charmcraft pack` takes a very long time, as it needs to launch an LXC container. I was trying to run `charmcraft built`, but it does not work anymore: ```bash $ pwd /home/h/projects/slurm-charms $ charmcraft build --project-dir charm-slurmd/ Charm entry point was not found: '/home/h/projects/slurm-charms/src/charm.py' (full execution logs in '/home/h/snap/charmcraft/common/charmcraft-log-q6unacm5') ``` The entry point is missing the `charm-slurmd/` before the `src/charm.py`. Here's the log file: ``` $ cat ~/snap/charmcraft/common/charmcraft-log-q6unacm5 2021-07-05 11:58:49,969 charmcraft.guard DEBUG Starting charmcraft version 1.1.0 2021-07-05 11:58:49,969 charmcraft.main DEBUG Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'project_dir': 'charm-slurmd/'} filtered=['build'] 2021-07-05 11:58:49,970 charmcraft.main DEBUG General parsed sysargs: command='build' args=[] 2021-07-05 11:58:49,971 charmcraft.main DEBUG Command parsed sysargs: Namespace(entrypoint=None, from=None, requirement=None) 2021-07-05 11:58:49,971 charmcraft ERROR Charm entry point was not found: '/home/h/projects/slurm-charms/src/charm.py' (full execution logs in '/home/h/snap/charmcraft/common/charmcraft-log-q6unacm5') ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed as working as designed: maintainer facundobatista explained `build` selects its project dir with `--from`, not `--project-dir` (which `pack` uses), so `charmcraft build --from charm-slurmd/` works.
stealth/space-bunny-alpha — closed not a bug Closed as working as intended: maintainer explained `build` selects the project dir with `--from`, not `--project-dir`; the requested deprecation warning for `build` was later added in #683 (commit 98e78a1c).
stealth/space-bunny-alpha — closed not a bug Reported behavior was confirmed as intended: build selected project directories with --from, while pack used --project-dir. Use charmcraft build --from charm-slurmd/ instead.
qwen3.6-35b-a3b-mtp-q6 — — Closed as resolved. Usage clarified: build requires --from, not --project-dir. The build command is deprecated in favor of pack, with a deprecation warning to be added.
qwen/qwen3.6-35b-a3b — — Resolved without code changes. The build command requires --from instead of --project-dir to specify the directory. The build command is deprecated in favor of pack, with a deprecation warning planned.
qwen/qwen3.6-35b-a3b — — The --project-dir flag was unsupported for build. Maintainers clarified that build uses --from instead, and pack is the recommended replacement. The build command will be deprecated with a warning added. Closed as resolved.
qwen3.6-35b-a3b-mtp-q6 — — Closed after clarifying that --project-dir was replaced by --from for the build command. Maintainers agreed to add a deprecation warning for the build command.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#683 (confidence 92%)

    Follow-up PR from this issue's conversation: added a deprecation notice to the `build` command (commit 98e78a1c).

  • Related To: canonical/charmcraft#798 (confidence 80%)

    Later removed the long-deprecated `build` command (commit 20b45e92), completing the deprecation path described in the closing comment.

Related issues

Issue Project State Summary Similarity
#198 `charmcraft init` would be better off with explicit directory name charmcraft closed Kept directory selection on --project-dir; missing directories are now created by #508 (commit 15d530ae).
73%
#2707 Charmcraft confuses the current directory with the project directory when both has a charmcraft.yaml charmcraft open Charmcraft 4.2.1 mixed the CWD and -p project files when both had charmcraft.yaml, breaking nested pack builds and CI; targeted project-directory fixes are present in current code.
72%
#2498 fix: `charmcraft pack --project-dir` with metadata.yaml charmcraft closed Closed unmerged; superseded by #2644, which fixed metadata lookup for --project-dir and shipped in Charmcraft 4.2.1.
71%