Change in osmo-ci[master]: OBS: latest: support new 2021q1 feed

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/+/23951 )


Change subject: OBS: latest: support new 2021q1 feed
......................................................................

OBS: latest: support new 2021q1 feed

Related: SYS#5370
Change-Id: I7a59a6ad94b21ba397349813b56b9bd5ea01c7c3
---
M scripts/osmocom-latest-packages.sh
1 file changed, 54 insertions(+), 10 deletions(-)



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

diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index fd89471..767d866 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -3,15 +3,38 @@
 # New packages are only uploaded if the source changed.
 # Environment variables:
 # * PROJ: the OBS namespace to upload to (e.g. network:osmocom:latest)
+# * FEED:
+#   * "latest": use latest tagged release (default)
+#   * other (e.g. "2021q1"): use last commit of branch of same name, exit with
+#     error if it does not exist
 . "$(dirname "$0")/common.sh"
 . "$(dirname "$0")/common-obs.sh"
 
+FEEDS="
+  2021q1
+  latest
+"
+
 set -e
 set -x
 
 DT=$(date +%Y%m%d%H%M)
 TOP=$(pwd)
 DEBSRCDIR="$TOP/debsrc"
+FEED="${FEED:-latest}"
+
+verify_feed() {
+  local i
+
+  for i in $FEEDS; do
+    if [ "$i" = "$FEED" ]; then
+      return
+    fi
+  done
+
+  echo "unsupported feed: $FEED"
+  exit 1
+}
 
 ### OBS build
 prepare() {
@@ -25,7 +48,15 @@
   mkdir "$DEBSRCDIR"
 
   cd "$TOP"
-  osmo_obs_prepare_conflict "osmocom-latest" "osmocom-nightly" "osmocom-next"
+  
+  local conflict_args="osmocom-nightly osmocom-next"
+  local i
+  for i in $FEEDS; do
+    if [ "$i" != "$FEED" ]; then
+      conflict_args="$conflict_args osmocom-$i"
+    fi
+  done
+  osmo_obs_prepare_conflict "osmocom-$FEED" $conflict_args
 }
 
 get_last_tag() {
@@ -54,8 +85,14 @@
   [ -d "$project" ] || osmo_git_clone_date "$url" "$project"
   cd "$project"
   git fetch
-  VER=$(get_last_tag "$project")
-  git checkout -f -B "$VER" "refs/tags/$VER"
+
+  if [ "$FEED" = "latest" ]; then
+    VER=$(get_last_tag "$project")
+    git checkout -f -B "$VER" "refs/tags/$VER"
+  else
+    git checkout -f -B "$FEED" "origin/$FEED"
+  fi
+
   if [ "$project" = "open5gs" ]; then
       meson subprojects download freeDiameter
   fi
@@ -68,12 +105,18 @@
   echo
   echo "====> Building $project"
   cd "$TOP/$project"
-  VER=$(get_last_tag "$project")
+
+  if [ "$FEED" = "latest" ]; then
+    debian_branch=$(get_last_tag "$project")
+  else
+    debian_branch="$FEED"
+  fi
+
   if [ -x ./git-version-gen ]; then
     ./git-version-gen . > .tarball-version 2>/dev/null
   fi
 
-  osmo_obs_add_depend_deb "./debian/control" "$project" "osmocom-latest"
+  osmo_obs_add_depend_deb "./debian/control" "$project" "osmocom-$FEED"
 
   if [ "$project" = "open5gs" ]; then
     # we cannot control the output directory of the generated source :(
@@ -82,11 +125,11 @@
     mv "../$name"*.tar* "../$name"*.dsc "$output"
   elif [ -x ./git-version-gen ]; then
     gbp buildpackage -S -uc -us -d --git-ignore-branch "--git-export-dir=$output" \
-		     "--git-debian-branch=$VER" --git-ignore-new $gitbpargs \
+		     "--git-debian-branch=$debian_branch" --git-ignore-new $gitbpargs \
 		     --git-postexport='cp $GBP_GIT_DIR/../.tarball-version $GBP_TMP_DIR/'
   else
     gbp buildpackage -S -uc -us -d --git-ignore-branch "--git-export-dir=$output" \
-		     "--git-debian-branch=$VER" --git-ignore-new $gitbpargs
+		     "--git-debian-branch=$debian_branch" --git-ignore-new $gitbpargs
   fi
 
   if [ ! -d "$TOP/$PROJ/$project" ] ; then
@@ -109,7 +152,7 @@
     fi
   fi
 
-  osmo_obs_add_rpm_spec "$TOP/$PROJ/$project" "$TOP/$project" "$project" "osmocom-latest"
+  osmo_obs_add_rpm_spec "$TOP/$PROJ/$project" "$TOP/$project" "$project" "osmocom-$FEED"
 
   cd "$TOP"
 }
@@ -159,7 +202,7 @@
   cd "$TOP"
   osmo_obs_checkout_copy debian8 osmo-gsm-manuals
 
-  build osmocom-latest
+  build osmocom-$FEED
   build limesuite --git-upstream-tree="$(get_last_tag limesuite)"
   build osmo-gsm-manuals
   build osmo-gsm-manuals-debian8
@@ -196,7 +239,8 @@
   build osmo-gbproxy
 
   cd "$TOP/$PROJ"
-  osc ci -m "Latest Tagged versions of $DT" --noservice
+  osc ci -m "$FEED versions of $DT" --noservice
 }
 
+verify_feed
 build_osmocom

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I7a59a6ad94b21ba397349813b56b9bd5ea01c7c3
Gerrit-Change-Number: 23951
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/c398d2d8/attachment.htm>


More information about the gerrit-log mailing list