aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-05-17 17:10:05 +0200
committerosmith <osmith@sysmocom.de>2021-05-19 06:35:56 +0000
commit33be93bcc950d49243bf2fcd598e53997320a430 (patch)
treef89c4454a00f1efb1aeafda7125106a91392f988
parent58d02c548351303c7f0412908e8070cbd3a24f9e (diff)
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
-rw-r--r--scripts/common-obs-conflict.sh22
-rw-r--r--scripts/common-obs.sh23
-rwxr-xr-xscripts/osmocom-latest-packages.sh11
-rwxr-xr-xscripts/osmocom-nightly-packages.sh10
4 files changed, 40 insertions, 26 deletions
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 @@ EOF
}
-# 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 @@ osmo_obs_get_commit_version() {
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 @@ prepare() {
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 @@ prepare() {
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() {