osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ci/+/29097
)
Change subject: obs: fix building srcpkg with empty debian/changelog
......................................................................
obs: fix building srcpkg with empty debian/changelog
Change-Id: I294d844ccccfa12599b6ba1def087e4a32d289e7
---
M scripts/obs/lib/debian.py
M scripts/obs/lib/srcpkg.py
2 files changed, 12 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/97/29097/1
diff --git a/scripts/obs/lib/debian.py b/scripts/obs/lib/debian.py
index 89153fb..73c0d68 100644
--- a/scripts/obs/lib/debian.py
+++ b/scripts/obs/lib/debian.py
@@ -31,7 +31,10 @@
# Package name might be different from project name, read it from changelog
pkgname = changelog_old.split(" ", 1)[0]
- assert pkgname
+
+ if not pkgname:
+ # Empty debian/changelog
+ pkgname = project
# Debian doesn't allow '-' in version
version = version.replace("-", ".")
diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py
index 468a240..5df356c 100644
--- a/scripts/obs/lib/srcpkg.py
+++ b/scripts/obs/lib/srcpkg.py
@@ -64,13 +64,14 @@
# it with git-version-gen, like it was done in the previous OBS scripts
if ret == "UNKNOWN":
ret = lib.debian.get_last_version_from_changelog(project)
+ if not ret:
+ # Empty debian/changelog
+ ret = "0.0.0"
+
# cut off epoch, we retrieve it separately in get_epoch() below
if ":" in ret:
ret = ret.split(":")[1]
- if not ret:
- ret = "0.0.0"
-
# Append the conflict_version to increase the version even if the commit
# did not change (OS#5135)
if conflict_version:
@@ -90,6 +91,10 @@
:returns: the epoch number if set, e.g. "1" or an empty string
"""
version_epoch = lib.debian.get_last_version_from_changelog(project)
+ if not version_epoch:
+ # Empty debian/changelog
+ return ""
+
if ":" in version_epoch:
return version_epoch.split(":")[0]
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ci/+/29097
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I294d844ccccfa12599b6ba1def087e4a32d289e7
Gerrit-Change-Number: 29097
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange