Change in osmo-ci[master]: OBS: nightly: use epoch from debian/changelog

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Feb 15 14:03:39 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/22922 )


Change subject: OBS: nightly: use epoch from debian/changelog
......................................................................

OBS: nightly: use epoch from debian/changelog

If epoch is used in debian/changelog, prepend it to the version from
git-version-gen. Also set the epoch in the spec file.

For example, the version in debian/changelog may be 1:0.0.1. The epoch
is 1, therefore a 0.0.1.18.b5d18 version from git-version-gen would turn
into 1:0.0.1.18.b5d18.

Setting epoch=1 is needed for osmo-gbproxy, so apt on debian 10 with the
nightly Osmocom repository enabled does not try to install osmo-gbproxy
1.3.0 from the debian repositories instead of 0.0.1 from the Omsocom
repository.

Related: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
Related: OS#4992
Change-Id: I3d63f040058340bdcf9075c03387798c5314be03
---
M scripts/common-obs.sh
M scripts/osmocom-nightly-packages.sh
2 files changed, 24 insertions(+), 5 deletions(-)



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

diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 366d72e..edd48df 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -113,6 +113,7 @@
 	local spec="$oscdir/$name.spec"
 	local tarball
 	local version
+	local epoch
 
 	if [ -z "$spec_in" ]; then
 		echo "WARNING: RPM spec missing: $name.spec.in"
@@ -123,9 +124,19 @@
 
 	osmo_obs_add_depend_rpm "$spec" "$name" "$depend" "$dependver"
 
-	# Set version
-	version="$(grep "^Version: " "$oscdir"/*.dsc | cut -d: -f2 | xargs)"
-	sed -i "s/^Version:.*/Version:  $version/g" "$spec"
+	# Set version and epoch from "Version: [EPOCH:]VERSION" in .dsc
+	version="$(grep "^Version: " "$oscdir"/*.dsc | cut -d: -f2- | xargs)"
+	case $version in
+	*:*)
+		epoch=$(echo "$version" | cut -d : -f 1)
+		version=$(echo "$version" | cut -d : -f 2)
+		;;
+	esac
+	if [ -n "$epoch" ]; then
+		sed -i "s/^Version:.*/Version:  $version\nEpoch:    $epoch/g" "$spec"
+	else
+		sed -i "s/^Version:.*/Version:  $version/g" "$spec"
+	fi
 
 	# Set source file
 	tarball="$(ls -1 "${name}_"*".tar."*)"
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index d8338ae..09d832a 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -70,11 +70,19 @@
   version=$(echo "$version" | sed  's/-/./g' )
 
   # deb version
+  deb_version=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,'  | sed 's,),,')
   if [ -z "$version" ] || [ "$version" = "UNKNOWN" ]; then
-    version=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,'  | sed 's,),,')
-    version="$version.$DT"
+    version="$deb_version.$DT"
   fi
 
+  # add epoch from debian/changelog
+  case $deb_version in
+  *:*)
+    epoch=$(echo "$deb_version" | cut -d : -f 1)
+    version=$epoch:$version
+    ;;
+  esac
+
   echo -n "$version"
 }
 

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I3d63f040058340bdcf9075c03387798c5314be03
Gerrit-Change-Number: 22922
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210215/29663425/attachment.htm>


More information about the gerrit-log mailing list