Skip to content
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

cbuild: fix prepare-upgrade only updating one sha256 #3198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/cbuild/hooks/fetch/000_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ def make_link(dfile, cksum):
linkpath.hardlink_to(dfile)


def verify_cksum(dfile, cksum, pkg):
def verify_cksum(dfile, idx, pkg):
cksum = pkg.sha256[idx]
pkg.log(f"verifying sha256sums for source '{dfile.name}'... ", "")
filesum = get_cksum(dfile, pkg)
if cksum != filesum:
if pkg.accept_checksums:
pkg.logger.out_plain("")
pkg.logger.out(f"\f[orange]SHA256 UPDATED: {cksum} -> {filesum}")
for i in range(len(pkg.sha256)):
if pkg.sha256[i] == cksum:
pkg.sha256[i] = filesum
pkg.sha256[idx] = filesum
return True
else:
pkg.logger.out_plain("")
Expand Down Expand Up @@ -326,10 +325,10 @@ def do_fetch_url(mv):
if ferrs > 0:
pkg.error(f"failed to fetch {ferrs} sources")
# verify the sources
for dfile, ck in dfiles:
for idx, [dfile, _] in enumerate(dfiles):
if not dfile.is_file():
pkg.error(f"source '{dfile}' does not exist")
if not verify_cksum(dfile, ck, pkg):
if not verify_cksum(dfile, idx, pkg):
errors += 1
# error if something failed to verify
if errors > 0:
Expand Down