diff --git a/pmb/parse/_apkbuild.py b/pmb/parse/_apkbuild.py index 39b27868..6e9d004f 100644 --- a/pmb/parse/_apkbuild.py +++ b/pmb/parse/_apkbuild.py @@ -320,8 +320,7 @@ def apkbuild(path, check_pkgver=True, check_pkgname=True): # Sanity check: pkgver if check_pkgver: - if ("-r" in ret["pkgver"] or not - pmb.parse.version.validate(ret["pkgver"])): + if not pmb.parse.version.validate(ret["pkgver"]): logging.info( "NOTE: Valid pkgvers are described here: " "https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#pkgver") diff --git a/test/test_parse_apkbuild.py b/test/test_parse_apkbuild.py index d34072d5..2b91ca12 100644 --- a/test/test_parse_apkbuild.py +++ b/test/test_parse_apkbuild.py @@ -154,3 +154,10 @@ def test_parse_unmaintained(): path = (f"{pmb_test.const.testdata}/apkbuild" "/APKBUILD.missing-pkgdesc-in-subpackage") assert pmb.parse._apkbuild.unmaintained(path) == "This is broken!" + + +def test_weird_pkgver(): + path = (f"{pmb_test.const.testdata}/apkbuild" + "/APKBUILD.weird-pkgver") + apkbuild = pmb.parse.apkbuild(path, check_pkgname=False, check_pkgver=True) + assert apkbuild["pkgver"] == "3.0.0_alpha369-r0" diff --git a/test/testdata/apkbuild/APKBUILD.weird-pkgver b/test/testdata/apkbuild/APKBUILD.weird-pkgver new file mode 100644 index 00000000..a4754416 --- /dev/null +++ b/test/testdata/apkbuild/APKBUILD.weird-pkgver @@ -0,0 +1,8 @@ +pkgname=dart-stage0 +pkgver=3.0.0_alpha369-r0 +pkgrel=1 +pkgdesc="Dart is a client-optimized language for fast apps on any platform (temporary bootstrap package)" +url="https://dart.dev/" +arch="aarch64 armv7 x86_64" +license="BSD-3-Clause" +options="!check"