aportgen: don't fail if binary ver < APKBUILD ver

The typical workflow for upgrading cross/gcc-* is:

$ cd pmaports/cross
$ pmbootstrap aportgen gcc-*

Currently this is failing because the APKBUILD has been updated in
Alpine for gcc, but gcc has not been built for all arches yet. This
shouldn't prevent us from generating the proper updated APKBUILDs in
pmaports so just print a note and don't fail here.

I'm committing this directly to master as this currently breaks
test/test_aportgen.py::test_aportgen.
This commit is contained in:
Oliver Smith 2022-11-02 17:58:26 +01:00
parent 6a21898ce4
commit e8b0b4ba78
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 12 additions and 12 deletions

View File

@ -205,16 +205,18 @@ def get_upstream_aport(args, pkgname, arch=None):
if compare == 0:
return aport_path
# Different version message
logging.error("ERROR: Package '" + pkgname + "' has a different version in"
# APKBUILD > binary: this is fine
if compare == 1:
logging.info(f"NOTE: {pkgname} {arch} binary package has a lower"
f" version {package['version']} than the APKBUILD"
f" {apkbuild_version}")
return aport_path
# APKBUILD < binary: aports.git is outdated
logging.error("ERROR: Package '" + pkgname + "' has a lower version in"
" local checkout of Alpine's aports (" + apkbuild_version +
") compared to Alpine's binary package (" +
package["version"] + ")!")
# APKBUILD < binary
if compare == -1:
raise RuntimeError("You can update your local checkout with: "
"'pmbootstrap pull'")
# APKBUILD > binary
raise RuntimeError("You can force an update of your binary package"
" APKINDEX files with: 'pmbootstrap update'")
raise RuntimeError("You can update your local checkout with: "
"'pmbootstrap pull'")

View File

@ -127,6 +127,4 @@ def test_aportgen_get_upstream_aport(args, monkeypatch):
# APKBUILD > binary
apkbuild = {"pkgver": "3.0", "pkgrel": "0"}
package = {"version": "2.0-r0"}
with pytest.raises(RuntimeError) as e:
func(args, upstream)
assert str(e.value).startswith("You can force an update of your binary")
assert func(args, upstream) == upstream_full