Merge pull request #1075: unpack a release archive again when its pin changes (ipavlin98)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-10 22:57:47 +03:00
commit dd91d60ba3
2 files changed
+10 -6

No files matched your search

+5 -3
View File
@@ -168,10 +168,12 @@ def fetch(name):
def unpack(name, member_filter=None):
"""Extract a pinned archive into toolchain/release-work/<name> (once) and return that directory."""
"""Extract a pinned archive into toolchain/release-work/<name> and return that directory. The stamp holds the pin's
sha256, so a bumped pin unpacks its new archive instead of reusing the old one's files."""
dest = WORK / name
stamp = dest / '.unpacked'
if stamp.is_file():
key = PINS[name][1]
if stamp.is_file() and stamp.read_text() == key:
return dest
shutil.rmtree(dest, ignore_errors=True)
dest.mkdir(parents=True)
@@ -182,7 +184,7 @@ def unpack(name, member_filter=None):
else:
with tarfile.open(path) as t:
t.extractall(dest, filter='data')
stamp.write_text('')
stamp.write_text(key)
return dest
+5 -3
View File
@@ -103,9 +103,11 @@ def run(cmd, **kw):
def tar_extract(name, dest, members, strip=0):
"""Extract only members (path prefixes inside the archive) of a pinned tarball with the system tar, once."""
"""Extract only members (path prefixes inside the archive) of a pinned tarball with the system tar. The stamp holds
the pin's sha256 and the members, so a bumped pin or a changed member list extracts again."""
stamp = dest / '.unpacked'
if stamp.is_file():
key = '\n'.join((mr.PINS[name][1], str(strip), *members))
if stamp.is_file() and stamp.read_text() == key:
return dest
shutil.rmtree(dest, ignore_errors=True)
dest.mkdir(parents=True)
@@ -114,7 +116,7 @@ def tar_extract(name, dest, members, strip=0):
run(['tar', '-xf', path, '-C', dest, f'--strip-components={strip}', '--wildcards', '--no-wildcards-match-slash',
*members])
print(f'{name}: unpacked in {time.time() - t0:.0f} s')
stamp.write_text('')
stamp.write_text(key)
return dest