Change in osmo-ci[master]: OBS: latest: add commit to version for 2021q1 feed

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
Wed Apr 28 16:11:34 UTC 2021


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


Change subject: OBS: latest: add commit to version for 2021q1 feed
......................................................................

OBS: latest: add commit to version for 2021q1 feed

Move get_commit_version to common-obs.sh and call it in
osmocom-latest-packages.sh, if the feed is not "latest". This way, the
packages don't have the latest tag as version anymore, and the version
changes if commits get pushed to the feed's branch.

Related: SYS#5370
Change-Id: I4a4fa3b8f66652ef36a7fe62047a88a69c473f19
---
M scripts/common-obs.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
3 files changed, 39 insertions(+), 33 deletions(-)



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

diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index a585e46..0fba061 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -252,3 +252,33 @@
 		./git-version-gen . > .tarball-version 2>/dev/null
 	fi
 }
+
+# Return a version based on the latest tag and commit (e.g. "1.5.1.93.47cc")
+# or fall back to the last debian version with current date appended
+# (e.g. "2.2.6.202104270126"). Run osmo_obs_git_version_gen before.
+# $PWD must be inside a git repository.
+osmo_obs_get_commit_version() {
+	local version=""
+
+	if [ -e ".tarball-version" ]; then
+		version=$(cat .tarball-version)
+		# debian doesn't allow '-' in version.
+		version=$(echo "$version" | sed	's/-/./g' )
+	fi
+
+	# deb version
+	deb_version=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,'	| sed 's,),,')
+	if [ -z "$version" ] || [ "$version" = "UNKNOWN" ]; then
+		version="$deb_version.$DT"
+	else
+		# add epoch from debian/changelog
+		case $deb_version in
+		*:*)
+			epoch=$(echo "$deb_version" | cut -d : -f 1)
+			version=$epoch:$version
+			;;
+		esac
+	fi
+
+	echo -n "$version"
+}
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index a0bac45..1f0ed77 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -116,14 +116,20 @@
   echo "====> Building $project"
   cd "$TOP/$project"
 
+  osmo_obs_git_version_gen
+
   if [ "$FEED" = "latest" ]; then
     debian_branch=$(get_last_tag "$project")
   else
     debian_branch="$FEED"
+    # Set new debian changelog version with commit appended. This version will
+    # become part of resulting filenames, and will change if commits have been
+    # added to the feed's branch.
+    VER="$(osmo_obs_get_commit_version)"
+    dch -b -v "$VER" -m "Snapshot build"
+    git commit -m "$VER snapshot" debian/
   fi
 
-  osmo_obs_git_version_gen
-
   osmo_obs_add_depend_deb "./debian/control" "$project" "osmocom-$FEED"
 
   if [ "$project" = "open5gs" ]; then
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index 07b0c81..3b5304d 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -53,36 +53,6 @@
   echo "${VER}"
 }
 
-# Return a version based on the latest tag and commit (e.g. "1.5.1.93.47cc")
-# or fall back to the last debian version with current date appended
-# (e.g. "2.2.6.202104270126"). Run osmo_obs_git_version_gen before.
-# $PWD must be inside a git repository.
-get_commit_version() {
-  local version=""
-
-  if [ -e ".tarball-version" ]; then
-    version=$(cat .tarball-version)
-    # debian doesn't allow '-' in version.
-    version=$(echo "$version" | sed  's/-/./g' )
-  fi
-
-  # deb version
-  deb_version=$(head -1 debian/changelog | cut -d ' ' -f 2 | sed 's,(,,'  | sed 's,),,')
-  if [ -z "$version" ] || [ "$version" = "UNKNOWN" ]; then
-    version="$deb_version.$DT"
-  else
-    # add epoch from debian/changelog
-    case $deb_version in
-    *:*)
-      epoch=$(echo "$deb_version" | cut -d : -f 1)
-      version=$epoch:$version
-      ;;
-    esac
-  fi
-
-  echo -n "$version"
-}
-
 ### common
 checkout() {
   local name=$1
@@ -144,7 +114,7 @@
   if [ "$changelog" = "commit" ] ; then
     osmo_obs_git_version_gen
     # Add date to increase version even if commit did not change (OS#5135)
-    VER="$(get_commit_version).$DT"
+    VER="$(osmo_obs_get_commit_version).$DT"
     osmo_obs_add_depend_deb "./debian/control" "$name" "osmocom-$FEED" "$dependver"
     dch -b -v "$VER" -m "Snapshot build"
     git commit -m "$VER snapshot" debian/

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I4a4fa3b8f66652ef36a7fe62047a88a69c473f19
Gerrit-Change-Number: 23954
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/20210428/a6e39839/attachment.htm>


More information about the gerrit-log mailing list