← Back to issue list

Expose project directory path to the scriptlets

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1824417
Type
issue
State
closed
Author
~brlin
Labels
—
Created
Updated
Closed

Current evaluation

Feature request for a project-dir env var in scriptlets was implemented by PR #2534 (commit 3d4483d6f), adding SNAPCRAFT_PROJECT_DIR; shipped in snapcraft 3.4.1 (release commit 16de5d39f) and the LP bug was closed.

Resolution: closed resolved

Reason: Maintainer ~sergiusens linked snapcore/snapcraft PR #2534, merged as commit 3d4483d6f ("project loader: add SNAPCRAFT_PROJECT_DIR environment variable"), which added SNAPCRAFT_PROJECT_DIR to the scriptlet environment so builds no longer need hard-coded ../../.. or /root/project paths. The change is included in the 3.4.1 release commit 16de5d39f.

Evaluated by: mr-cal-bot

No scores available.

Issue body

For some use cases, it is convenient to know the exact path of the snapcraft project directory in a scriptlet, which is now in different paths depending on the build environment: * host: ../../.. (for pull and build step); .. (for stage and prime step) * managed-host: /root/project Discussion: https://forum.snapcraft.io/t/get-project-path-for-overrides/10881

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Feature request for a project-dir env var in scriptlets was implemented by PR #2534 (commit 3d4483d6f), adding SNAPCRAFT_PROJECT_DIR; shipped in snapcraft 3.4.1 (release commit 16de5d39f) and the LP bug was closed.
stealth/space-bunny-alpha — closed resolved Feature delivered: PR #2534 (commit 3d4483d6f, "project loader: add SNAPCRAFT_PROJECT_DIR environment variable") added SNAPCRAFT_PROJECT_DIR/CRAFT_PROJECT_DIR to scriptlet environments, so scriptlets no longer need hard-coded ../../.. or /root/project paths.
stealth/space-bunny-alpha — closed resolved SNAPCRAFT_PROJECT_DIR was added for host and container scriptlets via merged PR #2534 (commit 3d4483d6f).
qwen/qwen3.6-35b-a3b — — Closed without implementation. The feature request to expose the project directory path to scriptlets was abandoned due to zero comments and no development activity.
qwen/qwen3.6-35b-a3b — — Closed without implementation. The feature request to expose the project directory path to scriptlets was abandoned due to inactivity and likely superseded by updated snapcraft versions.
qwen/qwen3.6-35b-a3b — — Abandoned. The request to expose the project directory path to scriptlets was closed without implementation, discussion, or pull requests.
qwen/qwen3.6-35b-a3b — — Closed without implementation. The request to expose the project directory path to scriptlets was abandoned due to lack of discussion. No resolution or merge occurred.
qwen3.6-35b-a3b-mtp-q6 — — Closed without implementation. The feature to expose the project directory path to scriptlets was abandoned and never merged or superseded.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#2534 (confidence 96%)

    Merged PR adding SNAPCRAFT_PROJECT_DIR; commit 3d4483d6f, referenced by the closing maintainer comment.

  • Related To: snapcraft#2534 (confidence 70%)

    Release commit 16de5d39f (3.4.1) shipped the new environment variable.

Related issues

Issue Project State Summary Similarity
#2534 Add SNAPCRAFT_PROJECT_DIR environment variable. snapcraft merged Merged PR #2534 (commit 3d4483d6f, 'project loader: add SNAPCRAFT_PROJECT_DIR environment variable') by tonysimpson, fixing Launchpad bug 1824417; the var still ships in snapcraft/parts/lifecycle.py global environment.
74%