the build scriptlet doesn't take into account the source-subdir
Metadata
Current evaluation
craft-parts intentionally runs override-build from the part build directory; source-subdir applies to plugin builds, and the documentation explicitly exempts override-build.
Suggested action: close not a bug
Reason: The current PartSpec.source_subdir documentation explicitly states that the key does not affect override-build, and the lifecycle documentation says the same. Craft-parts PR #1374, commit a69a088c, clarified this intentional distinction; changing the working directory would therefore be a backward-incompatible redesign rather than a bug fix.
Evaluated by: mr-cal-bot
Impact:
46
Quick Win:
8
Complexity:
76
Confidence:
94
Actionability:
74
Issue body
I have a source in a subdir, and want to build and install it using scriptlets. Even if I declare the source-subdir tag, the scriptlets will run from the build dir. I think it would make more sense to run the scriptlets from the subdir instead.
Take a look at this part:
freeimage:
source: http://golem.network/FreeImage.zip
source-subdir: FreeImage
plugin: nil
build-packages: [g++]
build: |
cd FreeImage
make -j$(SNAPCRAFT_PARALLEL_BUILD_COUNT)
install: |
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/
cp FreeImage/Dist/* $SNAPCRAFT_PART_INSTALL/usr/lib/
ln -s $SNAPCRAFT_PART_INSTALL/usr/lib/libfreeimage*.so $SNAPCRAFT_PART_INSTALL/usr/lib/libfreeimage.so
The subdir is FreeImage, and I still had to cd FreeImage during build, and during install I had to cp FreeImage/...
If we agree that the scriptlets should run from the subdir, a fix here is a little delicate because it will break the parts with subdir and scriptlets.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
46
Quick Win:
8
Complexity:
76
Confidence:
94
Actionability:
74
|
close not a bug | craft-parts intentionally runs override-build from the part build directory; source-subdir applies to plugin builds, and the documentation explicitly exempts override-build. | |
| stealth/space-bunny-alpha |
Impact:
25
Quick Win:
2
Complexity:
45
Confidence:
94
Actionability:
15
|
close not a bug | Reported source-subdir behavior is intentional in current craft-parts: it constrains plugin build commands, while override-build commands retain the source-root working directory. | |
| stealth/space-bunny-alpha |
Impact:
35
Quick Win:
6
Complexity:
78
Confidence:
93
Actionability:
84
|
close not a bug | Build and install overrides still run from the part build directory with source-subdir set; craft-parts now documents this distinction as intentional behavior. | |
| qwen/qwen3.6-35b-a3b |
Impact:
30
Quick Win:
9
Complexity:
50
Confidence:
85
Actionability:
60
|
close not a bug | Build/install scriptlets (override-build, override-install) don't respect source-subdir, running from source root instead. Behavior is documented as intentional in craft-parts. | |
| qwen/qwen3.8-27b |
Impact:
45
Quick Win:
20
Staleness:
80
Complexity:
55
Confidence:
55
Support Request:
10
|
needs triage | Build/install scriptlets run from the build dir instead of honoring source-subdir, forcing manual cd/cp. Open since 2017, 0 comments, no labels/assignee; fix is delicate due to backward-compat break risk. Needs triage. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
98
Complexity:
75
Confidence:
90
Support Request:
15
|
close stale | Build scriptlets ignore the source-subdir tag, requiring manual directory changes. Unaddressed for over nine years with noted backward compatibility risks for a fix. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
95
Complexity:
75
Confidence:
90
Support Request:
10
|
needs triage | Build scriptlets ignore source-subdir, forcing manual directory changes. Untriaged, inactive for ~2.6 years, no maintainer response. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
95
Complexity:
75
Confidence:
85
Support Request:
10
|
close stale | Build scriptlets ignore the source-subdir tag, requiring manual directory changes. Untriaged, inactive for over two years, and over nine years old. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Related To:
canonical/craft-parts#1374
(confidence 99%)
PR #1374, commit a69a088c, documented that source-subdir does not affect override-build.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #967 `source-subdir` Not Working With `override-build` | rockcraft | closed | No code fix was made: legacy source-subdir behavior with override-build was retained for compatibility; craft-parts#1374 documents the limitation. |