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
Thu Apr 29 14:08:43 UTC 2021


osmith has submitted this change. ( 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, 38 insertions(+), 32 deletions(-)

Approvals:
  osmith: Looks good to me, approved; Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve



diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index a585e46..e7148bc 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -252,3 +252,32 @@
 		./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 (e.g. "2.2.6"). 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"
+	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 5ba5a7b..d942e9d 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -119,14 +119,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 cee1382..ef2d7ef 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -53,35 +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 (e.g. "2.2.6").
-# 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"
-  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
@@ -145,7 +116,7 @@
   if [ "$changelog" != "no_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: 4
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210429/061bed74/attachment.htm>


More information about the gerrit-log mailing list