forked from Mirror/pmbootstrap
aportgen: Only warn if binary version > APKBUILD version
Sometimes I want to build an older version of a package from Alpine, and since package upgrades can involve things like patches and other externalities just changing the pkgver and running checksum in pmaports may not be enough. As such, it tends to be easier to revert the change in the local aports repo and then fork than forking and then trying to manually revert the changes yourself (since you can't have git do that for you given that they are distinct repositories). Prior to this patch, that was not possible since pmbootstrap would assume older aport version equals outdated aports in general and as such cancel the whole operation. Instead, just print a warning and helpful information to make this workflow possible while also warning users that they may want to update their local aports. Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20231209111813.37756-1-newbyte@postmarketos.org%3E
This commit is contained in:
parent
38ae6120bb
commit
ddc5c59562
2 changed files with 5 additions and 8 deletions
|
@ -202,8 +202,6 @@ def get_upstream_aport(args, pkgname, arch=None):
|
||||||
|
|
||||||
# Compare version (return when equal)
|
# Compare version (return when equal)
|
||||||
compare = pmb.parse.version.compare(apkbuild_version, package["version"])
|
compare = pmb.parse.version.compare(apkbuild_version, package["version"])
|
||||||
if compare == 0:
|
|
||||||
return aport_path
|
|
||||||
|
|
||||||
# APKBUILD > binary: this is fine
|
# APKBUILD > binary: this is fine
|
||||||
if compare == 1:
|
if compare == 1:
|
||||||
|
@ -213,10 +211,11 @@ def get_upstream_aport(args, pkgname, arch=None):
|
||||||
return aport_path
|
return aport_path
|
||||||
|
|
||||||
# APKBUILD < binary: aports.git is outdated
|
# APKBUILD < binary: aports.git is outdated
|
||||||
logging.error("ERROR: Package '" + pkgname + "' has a lower version in"
|
if compare == -1:
|
||||||
|
logging.warning("WARNING: Package '" + pkgname + "' has a lower version in"
|
||||||
" local checkout of Alpine's aports (" + apkbuild_version +
|
" local checkout of Alpine's aports (" + apkbuild_version +
|
||||||
") compared to Alpine's binary package (" +
|
") compared to Alpine's binary package (" +
|
||||||
package["version"] + ")!")
|
package["version"] + ")!")
|
||||||
|
logging.info("NOTE: You can update your local checkout with: 'pmbootstrap pull'")
|
||||||
|
|
||||||
raise RuntimeError("You can update your local checkout with: "
|
return aport_path
|
||||||
"'pmbootstrap pull'")
|
|
||||||
|
|
|
@ -123,9 +123,7 @@ def test_aportgen_get_upstream_aport(args, monkeypatch):
|
||||||
# APKBUILD < binary
|
# APKBUILD < binary
|
||||||
apkbuild = {"pkgver": "1.0", "pkgrel": "0"}
|
apkbuild = {"pkgver": "1.0", "pkgrel": "0"}
|
||||||
package = {"version": "2.0-r0"}
|
package = {"version": "2.0-r0"}
|
||||||
with pytest.raises(RuntimeError) as e:
|
assert func(args, upstream) == upstream_full
|
||||||
func(args, upstream)
|
|
||||||
assert str(e.value).startswith("You can update your local checkout with")
|
|
||||||
|
|
||||||
# APKBUILD > binary
|
# APKBUILD > binary
|
||||||
apkbuild = {"pkgver": "3.0", "pkgrel": "0"}
|
apkbuild = {"pkgver": "3.0", "pkgrel": "0"}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue