osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/29097 )
Change subject: obs: meaningful error if debian/changelog is empty ......................................................................
obs: meaningful error if debian/changelog is empty
If there's an empty debian/changelog, packaging needs to be fixed in the git repository of the project. Print a meaningful error instead of:
File "/obs/lib/srcpkg.py", line 68, in get_version_for_feed if ":" in ret: TypeError: argument of type 'NoneType' is not iterable
Change-Id: I294d844ccccfa12599b6ba1def087e4a32d289e7 --- M scripts/obs/lib/debian.py M scripts/obs/lib/srcpkg.py 2 files changed, 6 insertions(+), 8 deletions(-)
Approvals: neels: Looks good to me, approved daniel: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/scripts/obs/lib/debian.py b/scripts/obs/lib/debian.py index 89153fb..3bba3ec 100644 --- a/scripts/obs/lib/debian.py +++ b/scripts/obs/lib/debian.py @@ -73,14 +73,15 @@ repo_path = lib.git.get_repo_path(project) changelog_path = f"{repo_path}/debian/changelog"
- if not os.path.exists(changelog_path): - return None + assert os.path.exists(changelog_path), f"{project}: missing debian/changelog"
changelog = open(changelog_path).read() - if not changelog: - return None + assert changelog, f"{project}: debian/changelog is empty"
- return changelog.split("(", 1)[1].split(")", 1)[0] + ret = changelog.split("(", 1)[1].split(")", 1)[0] + assert ret, f"{project}: couldn't find last version in debian/changelog" + + return ret
def changelog_add_entry_if_needed(project, feed, version): diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py index baf64a9..035cf81 100644 --- a/scripts/obs/lib/srcpkg.py +++ b/scripts/obs/lib/srcpkg.py @@ -70,9 +70,6 @@ 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: