Upstream compatibility test: also test generated aports, e.g. gcc-armhf (#1014)

This commit is contained in:
Oliver Smith 2017-12-21 16:57:15 +00:00 committed by GitHub
parent 12605e5ed3
commit d34e8d172e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 48 additions and 0 deletions

View File

@ -74,3 +74,51 @@ def test_qt_versions(args):
pkgver_upstream)
assert [] == failed
def test_aportgen_versions(args):
"""
Verify that the packages generated by 'pmbootstrap aportgen' have
the same version (pkgver *and* pkgrel!) as the upstream packages
they are based on.
"""
# Get Alpine's "main" repository APKINDEX path
pmb.helpers.repo.update(args)
repository = args.mirror_alpine + args.alpine_version + "/main"
hash = pmb.helpers.repo.hash(repository)
index_path = (args.work + "/cache_apk_armhf/APKINDEX." + hash +
".tar.gz")
# Alpine packages and patterns for our derivatives
map = {"binutils": "binutils-*",
"busybox": "busybox-static-*",
"gcc": "gcc-*",
"musl": "musl-*"}
# Iterate over Alpine packages
failed = []
generated = "# Automatically generated aport, do not edit!"
for pkgname, pattern in map.items():
# Upstream version
index_data = pmb.parse.apkindex.read(args, pkgname, index_path)
version_upstream = index_data["version"]
# Iterate over our packages
for path in glob.glob(args.aports + "/*/" + pattern + "/APKBUILD"):
# Skip non-aportgen APKBUILDs
with open(path) as handle:
if generated not in handle.read():
continue
# Compare the version
print("Checking " + path)
apkbuild = pmb.parse.apkbuild(args, path)
version = apkbuild["pkgver"] + "-r" + apkbuild["pkgrel"]
if version != version_upstream:
failed.append(apkbuild["pkgname"] + ": " + version +
" != " + version_upstream +
" (from " + pkgname + ")")
continue
assert [] == failed