Challenge/buildinfo: slightly improve output

Use "arch" instead of "carch", print "OK!" when a file has been verified
(which is much easier to recognize than "File has the same content").
This commit is contained in:
Oliver Smith 2017-06-15 22:40:19 +02:00
parent c250d65a9f
commit a1298cb114
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 8 additions and 8 deletions

View File

@ -57,16 +57,16 @@ def get_depends_recursively(args, pkgnames, arch=None):
return ret
def generate(args, apk_path, carch, suffix, apkbuild):
def generate(args, apk_path, arch, suffix, apkbuild):
"""
:param apk_path: Path to the .apk file, relative to the packages cache.
:param carch: Architecture, that the package has been built for.
:param arch: Architecture, that the package has been built for.
:apkbuild: Return from pmb.parse.apkbuild().
"""
ret = {"pkgname": apkbuild["pkgname"],
"pkgver": apkbuild["pkgver"],
"pkgrel": apkbuild["pkgrel"],
"carch": carch,
"arch": arch,
"versions": []}
# Add makedepends versions
@ -80,7 +80,7 @@ def generate(args, apk_path, carch, suffix, apkbuild):
return ret
def write(args, apk_path, carch, suffix, apkbuild):
def write(args, apk_path, arch, suffix, apkbuild):
"""
Write a .buildinfo.json file for a package, right after building it.
It stores all information required to rebuild the package, very similar
@ -88,13 +88,13 @@ def write(args, apk_path, carch, suffix, apkbuild):
Python): https://wiki.debian.org/ReproducibleBuilds/BuildinfoFiles
:param apk_path: Path to the .apk file, relative to the packages cache.
:param carch: Architecture, that the package has been built for.
:param arch: Architecture, that the package has been built for.
:apkbuild: Return from pmb.parse.apkbuild().
"""
# Write to temp
if os.path.exists(args.work + "/chroot_native/tmp/buildinfo"):
pmb.chroot.root(args, ["rm", "/tmp/buildinfo"])
buildinfo = generate(args, apk_path, carch, suffix, apkbuild)
buildinfo = generate(args, apk_path, arch, suffix, apkbuild)
with open(args.work + "/chroot_native/tmp/buildinfo", "w") as handle:
handle.write(json.dumps(buildinfo, indent=4, sort_keys=True) + "\n")

View File

@ -46,7 +46,7 @@ def diff_files(tar_a, tar_b, member_a, member_b, name):
for temp_file in temp_files:
os.remove(temp_file)
if equal:
logging.debug("=> File has the same content")
logging.debug("=> OK!")
else:
raise RuntimeError("File '" + name + "' is different!")
@ -159,7 +159,7 @@ def challenge(args, apk_path):
" buildinfo: " + package_buildinfo + ")!")
# Build the package
repo_before = pmb.helpers.repo.files(args)
pmb.build.package(args, buildinfo["pkgname"], buildinfo["carch"],
pmb.build.package(args, buildinfo["pkgname"], buildinfo["arch"],
force=True)
repo_diff = pmb.helpers.repo.diff(args, repo_before)