Change in osmo-ci[master]: OBS: refactor osmo_obs_prepare_conflict

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 May 19 06:35:58 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/24255 )

Change subject: OBS: refactor osmo_obs_prepare_conflict
......................................................................

OBS: refactor osmo_obs_prepare_conflict

Determine the package name of the conflict package itself and all
conflicting packages automatically, so we don't need to have it
duplicated in the OBS latest and OBS nightly scripts.

This is in preparation to move osmocom-2021q1 from latest to nightly.
With the current logic in nightly for the conflict package, it would not
be possible.

Related: SYS#5370
Change-Id: I183b9040250e66e0d7d17ef4b95af9e7d4a26f04
---
M scripts/common-obs-conflict.sh
M scripts/common-obs.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
4 files changed, 40 insertions(+), 26 deletions(-)

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



diff --git a/scripts/common-obs-conflict.sh b/scripts/common-obs-conflict.sh
index b6b381a..98c8b70 100644
--- a/scripts/common-obs-conflict.sh
+++ b/scripts/common-obs-conflict.sh
@@ -113,18 +113,28 @@
 
 }
 
-# Create conflicting packages
-# $1: name of dummy package (e.g. "osmocom-nightly")
-# $2-*: name of conflicting packages (e.g. "osmocom-latest")
+# Print names of packages that the conflict package from the current feed
+# (e.g. osmocom-nightly) should conflict with (e.g. osmocom-latest,
+# osmocom-next, osmocom-2021q1)
+osmo_obs_prepare_conflict_args() {
+	for i in $FEEDS_ALL; do
+		if [ "$i" != "$FEED" ]; then
+			echo "osmocom-$i"
+		fi
+	done
+}
+
+# Create conflicting packages, based on global $FEED and $FEEDS_ALL vars
 osmo_obs_prepare_conflict() {
-	local pkgname="$1"
+	local pkgname="osmocom-$FEED"
+	local conflict_args="$(osmo_obs_prepare_conflict_args)"
 	local oldpwd="$PWD"
 
 	mkdir -p "$pkgname"
 	cd "$pkgname"
 
-	osmo_obs_prepare_conflict_deb "$@"
-	osmo_obs_prepare_conflict_rpm "$@"
+	osmo_obs_prepare_conflict_deb "$pkgname" $conflict_args
+	osmo_obs_prepare_conflict_rpm "$pkgname" $conflict_args
 
 	# Put in git repository
 	git init .
diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 3a5c0c1..1a10eb6 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -2,6 +2,13 @@
 # Various common code used in the OBS (opensuse build service) related osmo-ci shell scripts
 . "$(dirname "$0")/common-obs-conflict.sh"
 
+FEEDS_ALL="
+	2021q1
+	latest
+	next
+	nightly
+"
+
 osmo_cmd_require \
 	dch \
 	dh \
@@ -281,14 +288,24 @@
 	echo -n "$version"
 }
 
-# Verify that $FEED is in $FEEDS
+# Verify that $FEED is in $FEEDS and $FEEDS_ALL
 osmo_obs_verify_feed() {
 	local i
+	local j
 
 	for i in $FEEDS; do
-		if [ "$i" = "$FEED" ]; then
-			return
+		if [ "$i" != "$FEED" ]; then
+			continue
 		fi
+
+		for j in $FEEDS_ALL; do
+			if [ "$j" = "$i" ]; then
+				return
+			fi
+		done
+
+		echo "feed found in FEEDS but not FEEDS_ALL: $FEED"
+		exit 1
 	done
 
 	echo "unsupported feed: $FEED"
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index 31fc877..c5c19c4 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -11,6 +11,7 @@
 . "$(dirname "$0")/common.sh"
 . "$(dirname "$0")/common-obs.sh"
 
+# Values for FEED env var. Adjust FEEDS_ALL in common-obs when changing.
 FEEDS="
   2021q1
   latest
@@ -36,15 +37,7 @@
   mkdir "$DEBSRCDIR"
 
   cd "$TOP"
-
-  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
+  osmo_obs_prepare_conflict
 }
 
 get_last_tag() {
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index 62528c2..b9a56a3 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -11,6 +11,7 @@
 . "$(dirname "$0")/common.sh"
 . "$(dirname "$0")/common-obs.sh"
 
+# Values for FEED env var. Adjust FEEDS_ALL in common-obs when changing.
 FEEDS="
   next
   nightly
@@ -32,14 +33,7 @@
   osc co "$PROJ"
 
   cd "$REPO"
-  case "$FEED" in
-  nightly)
-    osmo_obs_prepare_conflict "osmocom-nightly" "osmocom-latest" "osmocom-next"
-    ;;
-  next)
-    osmo_obs_prepare_conflict "osmocom-next" "osmocom-latest" "osmocom-nightly"
-    ;;
-  esac
+  osmo_obs_prepare_conflict
 }
 
 get_last_tag() {

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I183b9040250e66e0d7d17ef4b95af9e7d4a26f04
Gerrit-Change-Number: 24255
Gerrit-PatchSet: 2
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/20210519/1fb92b8a/attachment.htm>


More information about the gerrit-log mailing list