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:
parent
c250d65a9f
commit
a1298cb114
|
@ -57,16 +57,16 @@ def get_depends_recursively(args, pkgnames, arch=None):
|
||||||
return ret
|
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 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().
|
:apkbuild: Return from pmb.parse.apkbuild().
|
||||||
"""
|
"""
|
||||||
ret = {"pkgname": apkbuild["pkgname"],
|
ret = {"pkgname": apkbuild["pkgname"],
|
||||||
"pkgver": apkbuild["pkgver"],
|
"pkgver": apkbuild["pkgver"],
|
||||||
"pkgrel": apkbuild["pkgrel"],
|
"pkgrel": apkbuild["pkgrel"],
|
||||||
"carch": carch,
|
"arch": arch,
|
||||||
"versions": []}
|
"versions": []}
|
||||||
|
|
||||||
# Add makedepends versions
|
# Add makedepends versions
|
||||||
|
@ -80,7 +80,7 @@ def generate(args, apk_path, carch, suffix, apkbuild):
|
||||||
return ret
|
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.
|
Write a .buildinfo.json file for a package, right after building it.
|
||||||
It stores all information required to rebuild the package, very similar
|
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
|
Python): https://wiki.debian.org/ReproducibleBuilds/BuildinfoFiles
|
||||||
|
|
||||||
:param apk_path: Path to the .apk file, relative to the packages cache.
|
: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().
|
:apkbuild: Return from pmb.parse.apkbuild().
|
||||||
"""
|
"""
|
||||||
# Write to temp
|
# Write to temp
|
||||||
if os.path.exists(args.work + "/chroot_native/tmp/buildinfo"):
|
if os.path.exists(args.work + "/chroot_native/tmp/buildinfo"):
|
||||||
pmb.chroot.root(args, ["rm", "/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:
|
with open(args.work + "/chroot_native/tmp/buildinfo", "w") as handle:
|
||||||
handle.write(json.dumps(buildinfo, indent=4, sort_keys=True) + "\n")
|
handle.write(json.dumps(buildinfo, indent=4, sort_keys=True) + "\n")
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ def diff_files(tar_a, tar_b, member_a, member_b, name):
|
||||||
for temp_file in temp_files:
|
for temp_file in temp_files:
|
||||||
os.remove(temp_file)
|
os.remove(temp_file)
|
||||||
if equal:
|
if equal:
|
||||||
logging.debug("=> File has the same content")
|
logging.debug("=> OK!")
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("File '" + name + "' is different!")
|
raise RuntimeError("File '" + name + "' is different!")
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ def challenge(args, apk_path):
|
||||||
" buildinfo: " + package_buildinfo + ")!")
|
" buildinfo: " + package_buildinfo + ")!")
|
||||||
# Build the package
|
# Build the package
|
||||||
repo_before = pmb.helpers.repo.files(args)
|
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)
|
force=True)
|
||||||
repo_diff = pmb.helpers.repo.diff(args, repo_before)
|
repo_diff = pmb.helpers.repo.diff(args, repo_before)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue