osmith has uploaded this change for review.

View Change

OBS: get_git_version: debian/changelog as fallback

Fix osmocom-bb getting 0.1.0 as version:

osmocom-bb: has no git tags, using 0.0.0 as version
osmocom-bb: building source package 0.0.0.3621-d70e
osmocom-bb: WARNING: version from changelog (0.1.0) is higher than version based on git tag (0.0.0.3621-d70e), using version from changelog (git tag not pushed yet?)

With this patch:

osmocom-bb: has no git tags
osmocom-bb: getting version from debian/changelog
osmocom-bb: building source package 0.1.0.3621-d70e
osmocom-bb: adding debian/changelog entry (0.1.0 => 0.1.0.3621-d70e)

Change-Id: I3a284b50ca62a2faff16702b7108ca391229caf1
---
M scripts/obs/lib/srcpkg.py
1 file changed, 30 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/79/37179/1
diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py
index 4da6b70..e24f25e 100644
--- a/scripts/obs/lib/srcpkg.py
+++ b/scripts/obs/lib/srcpkg.py
@@ -49,12 +49,18 @@
"HEAD"], cwd=repo_path, check=False)

if result.returncode == 128:
- print(f"{project}: has no git tags, using 0.0.0 as version")
+ print(f"{project}: has no git tags")
commit = lib.run_cmd(["git", "rev-parse", "HEAD"],
cwd=repo_path).output[0:4]
count = lib.run_cmd(["git", "rev-list", "--count", "HEAD"],
cwd=repo_path).output.rstrip()
- return f"0.0.0.{count}-{commit}"
+ try:
+ print(f"{project}: getting version from debian/changelog")
+ version = lib.debian.get_last_version_from_changelog(project)
+ return f"{version}.{count}-{commit}"
+ except:
+ print(f"{project}: using 0.0.0 as version")
+ return f"0.0.0.{count}-{commit}"

if result.returncode != 0:
lib.exit_error_cmd(result, "command failed unexpectedly")

To view, visit change 37179. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I3a284b50ca62a2faff16702b7108ca391229caf1
Gerrit-Change-Number: 37179
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-MessageType: newchange