← Back to issue list

packages: normalize unpacked stage packages (CRAFT-33)

View original Github issue

Metadata

Project
craft-parts
Number
#76
Type
pull request
State
merged
Author
cmatsuoka
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #76 (commit 486bc6b9) added craft_parts/packages/normalize.py, porting Snapcraft package normalization: shebang rewriting, relative symlinks, suid/gid cleanup, and pkg-config/xml2/xslt path fixes.

Resolution: closed resolved

Reason: PR #76 was approved and merged as 486bc6b9, adding normalize.py (first commit a64ac1e5 'packages: normalize unpacked stage packages') plus tests. The code is still present at HEAD, later refined by follow-ups.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Packages unpacked in the stage area may contain files that need to be patched to work correctly. Patches include replacing absolute pathnames to the python interpreter in script shebangs, converting absolute symlinks to relative, cleaning suid/guid bits, and changing path names in pkg-config and xml2/xslt config files to reflect the new installation root. The implementation of package normalization and tests is ported from Snapcraft, and will be replaced by an upcoming stand-alone package containing repository and package operations. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com> - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #76 (commit 486bc6b9) added craft_parts/packages/normalize.py, porting Snapcraft package normalization: shebang rewriting, relative symlinks, suid/gid cleanup, and pkg-config/xml2/xslt path fixes.
stealth/space-bunny-alpha — closed resolved Merged PR #76, normalizing staged packages by fixing Python shebangs, converting absolute symlinks, clearing suid/gid bits, and updating configuration paths.
qwen/qwen3.6-35b-a3b — — Merged implementation normalizing unpacked stage packages. The change patches Python shebangs, converts absolute symlinks to relative, removes suid/guid bits, and updates config paths. Ported from Snapcraft and approved by reviewers.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Normalizes unpacked stage packages by patching shebangs, converting absolute symlinks to relative, stripping SUID/SGID bits, and updating config paths. Ported from Snapcraft and integrated.

Update history

No update history recorded yet.

Related work

  • Related To: craft-parts#215 (confidence 95%)

    Follow-up fix 45fe13c0 (merged in cf1004fc) replaced Path.relative_to() with os.path.relpath() for symlinks whose targets traverse parent components.

  • Related To: craft-parts#81 (confidence 90%)

    Follow-up PR (merge 1c9dd125) added a regression test that normalization is skipped when unpacking extracts no files.

Related issues

Issue Project State Summary Similarity
#81 packages: add test to ensure unnecessary normalize not called (CRAFT-221) craft-parts merged Merged in canonical/craft-parts#81 (1c9dd125), adding a regression test verifying normalization is skipped when stage-package unpacking extracts no files.
79%
#3529 repo: normalize if stage-packages and check types (CRAFT-222) snapcraft merged Merged in #3529 as commit 58d50bf, fixing stage-packages normalization to check file types so directories such as snap.pc are not passed to fileinput.
78%
#216 Release 1.6.1 craft-parts merged Released craft-parts 1.6.1 via merged PR #216, including the stage-package symlink normalization fix from PR #215 (commit 45fe13c0).
73%
#1642446 Better documentation for stage-packages and build-packages snapcraft (launchpad) closed Resolved by merged canonical/snapcraft#913 (commit 2875ecb56), which updated plugin help to document stage-packages and build-packages, including ELF dependency crawling and omitted cases.
72%
#3534 repo: normalize only if there are packages to unpack snapcraft merged Merged PR #3534 in commit bd493eb8a, fixing pathlib.glob generator handling so staged package contents are normalized only when packages exist to unpack.
71%