parse: allow "-r" in pkgver

this seems to be parsed correctly, other than this one check

bug: https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2260
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230813202045.24493-1-lauren@selfisekai.rocks%3E
This commit is contained in:
Lauren N. Liberda 2023-08-13 22:20:45 +02:00 committed by Oliver Smith
parent 9045bfb2b9
commit 753e563ccc
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
3 changed files with 16 additions and 2 deletions

View File

@ -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")

View File

@ -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"

View File

@ -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"