ci: simplify logic in check_changed_versions

Signed-off-by: Pablo Correa Gómez <pabloyoyoista@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/9363>
This commit is contained in:
Pablo Correa Gómez
2026-08-12 05:39:40 +00:00
parent 5d8cf85911
commit bec46b5311
+4 -6
View File
@@ -130,20 +130,18 @@ def check_versions(packages):
print(f"- {package}: {head} (HEAD) (new package)")
continue
is_device_pkg = os.path.basename(package).startswith('device-')
if is_device_pkg:
# Check pkgver follows expected format for device packages
pkgver = head.rpartition('-r')[0]
is_device_pkg = os.path.basename(package).startswith('device-')
if is_device_pkg and not pkgver.isdigit():
if not pkgver.isdigit():
print(f" - {package}: invalid pkgver \"{pkgver}\""
"See: https://docs.postmarketos.org/pmaports/main/packaging-guidelines.html#package-versioning-pkgver-pkgrel")
error = True
# Additional checks for device packages
if is_device_pkg:
# Check that pkgrel was reset to 0 when pkgver was changed
head_parsed = get_package_contents(package, "HEAD", False)
upstream_parsed = get_package_contents(package, commit, False)
# Check that pkgrel was reset to 0 when pkgver was changed
if head_parsed["pkgver"] != upstream_parsed["pkgver"] and head_parsed["pkgrel"] != "0":
print(f" - {package}: pkgrel should be 0 when pkgver changes."
"See: https://docs.postmarketos.org/pmaports/main/packaging-guidelines.html#package-versioning-pkgver-pkgrel")