osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/34403?usp=email )


Change subject: OBS: keep going if version can't be parsed
......................................................................

OBS: keep going if version can't be parsed

Don't crash in Osmocom_OBS_wireshark because the version can't be
parsed.

Fix for:
  packaging.version.InvalidVersion: Invalid version: '4.1.1rc0.238'

Change-Id: I0cf6c7c2d5939dccc14107f0a8c15593ea8bc4c2
---
M scripts/obs/lib/debian.py
1 file changed, 28 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/03/34403/1

diff --git a/scripts/obs/lib/debian.py b/scripts/obs/lib/debian.py
index 2995185..6703f8b 100644
--- a/scripts/obs/lib/debian.py
+++ b/scripts/obs/lib/debian.py
@@ -98,13 +98,19 @@
     version_changelog = get_last_version_from_changelog(project)

     # Don't use a lower number (OS#6173)
-    if packaging.version.parse(version_changelog.split("-")[0]) > \
-            packaging.version.parse(version.split("-")[0]):
-        print(f"{project}: WARNING: version from changelog"
-              f" ({version_changelog}) is higher than version based on git tag"
-              f" ({version}), using version from changelog (git tag not pushed"
-              " yet?)")
-        return
+    try:
+        if packaging.version.parse(version_changelog.split("-")[0]) > \
+                packaging.version.parse(version.split("-")[0]):
+            print(f"{project}: WARNING: version from changelog"
+                  f" ({version_changelog}) is higher than version based on git 
tag"
+                  f" ({version}), using version from changelog (git tag not 
pushed"
+                  " yet?)")
+            return
+    except packaging.version.InvalidVersion:
+        # packaging.version.parse can parse the version numbers used in Osmocom
+        # projects (where we need the above check), but not e.g. some versions
+        # from wireshark. Don't abort here if that is the case.
+        pass

     if version_changelog == version:
         return

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/34403?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I0cf6c7c2d5939dccc14107f0a8c15593ea8bc4c2
Gerrit-Change-Number: 34403
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-MessageType: newchange

Reply via email to