-
Notifications
You must be signed in to change notification settings - Fork 176
fix(install): exclude .apm-pin marker from package content hash (unblocks v0.12.2 release) #1142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,13 @@ | |
| # Directories excluded from hashing (not relevant to package content) | ||
| _EXCLUDED_DIRS = {".git", "__pycache__"} | ||
|
|
||
| # Files excluded from hashing. ``.apm-pin`` is the cache-pin marker | ||
| # (see :mod:`apm_cli.install.cache_pin`) written AFTER hash recording | ||
| # during install; including it would make the on-disk hash diverge | ||
| # from the lockfile-recorded hash on every subsequent install, | ||
| # falsely tripping the supply-chain content-hash mismatch check. | ||
| _EXCLUDED_FILES = {".apm-pin"} | ||
|
|
||
| # Well-known hash for empty/missing packages | ||
| _EMPTY_HASH = "sha256:" + hashlib.sha256(b"").hexdigest() | ||
|
|
||
|
|
@@ -41,6 +48,8 @@ def compute_package_hash(package_path: Path) -> str: | |
| if any(part in _EXCLUDED_DIRS for part in rel.parts): | ||
| continue | ||
| if item.is_file(): | ||
| if rel.name in _EXCLUDED_FILES: | ||
| continue | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch -- applied in 9cf5452. Scoped the exclusion to root-level only ( |
||
| regular_files.append(rel) | ||
|
|
||
| # Sort lexicographically by POSIX path for determinism | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not applicable in this case. The
## [0.12.2]section was added by the (already merged) release PR #1141, but the v0.12.2 git tag was deleted before any artifact was published -- v0.12.2 has never actually shipped. We're re-cycling the same version number with this fix included, so updating that section in place is correct. Moving the entry under## [Unreleased]would imply a different version is coming next, which would itself drift from the release that's about to be tagged.