Change in osmo-ci[master]: scripts/common-obs.sh: move osmo_obs_checkout_copy

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
Mon May 25 11:39:50 UTC 2020


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

Change subject: scripts/common-obs.sh: move osmo_obs_checkout_copy
......................................................................

scripts/common-obs.sh: move osmo_obs_checkout_copy

Refactor checkout_copy_debian8_jessie from osmocom-latest-packages.sh
and osmocom-nightly-packages.sh to take the distribution name as
argument and merge both to osmo_obs_checkout_copy in common-obs.sh.

Use debian8 as distribution name instead of debian8-jessie, so the
distribution name matches the suffix of the patch file
(build-for-debian8.patch).

A follow-up commit will apply a debian10 specific patch with this new
function.

Related: OS#4562
Change-Id: I2b69571ebc08a920c9147ce544fa8a2e6d950e65
---
M scripts/common-obs.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
3 files changed, 49 insertions(+), 34 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  osmith: Verified



diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index c07fbaa..3d86865 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -120,3 +120,44 @@
 
 	osc add "$name.spec"
 }
+
+# Copy an already checked out repository dir and apply a distribution specific patch.
+# $PWD must be where all repositories are checked out in subdirs.
+# $1: distribution name (e.g. "debian8")
+# $2: Osmocom repository (e.g. "osmo-trx")
+osmo_obs_checkout_copy() {
+	local distro="$1"
+	local repo="$2"
+
+	echo
+	echo "====> Checking out $repo-$distro"
+
+	# Verify distro name for consistency
+	local distros="
+		debian8
+	"
+	local found=0
+	local distro_i
+	for distro_i in $distros; do
+		if [ "$distro_i" = "$distro" ]; then
+			found=1
+			break
+		fi
+	done
+	if [ "$found" -eq 0 ]; then
+		echo "ERROR: invalid distro name: $distro, should be one of: $distros"
+		exit 1
+	fi
+
+	# Copy
+	if [ -d "$repo-$distro" ]; then
+		rm -rf "$repo-$distro"
+	fi
+	cp -a "$repo" "$repo-$distro"
+	cd "$repo-$distro"
+
+	# Commit patch
+	patch -p1 < "debian/patches/build-for-$distro.patch"
+	git commit --amend --no-edit debian/
+	cd ..
+}
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index 5e35659..8bf4fb2 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -63,22 +63,6 @@
   fi
 }
 
-# Copy an already checked out repository dir and apply its debian 8 patch.
-# $1: Osmocom repository
-checkout_copy_debian8_jessie() {
-  echo
-  echo "====> Checking out $1-debian8-jessie"
-  cd "$TOP"
-  if [ -d "$1-debian8-jessie" ]; then
-    rm -rf "$1-debian8-jessie"
-  fi
-  cp -a "$1" "$1-debian8-jessie"
-  cd "$1-debian8-jessie"
-  patch -p1 < debian/patches/build-for-debian8.patch
-  git commit --amend --no-edit debian/
-  cd ..
-}
-
 build() {
   project=$1
   gitbpargs="$2"
@@ -170,12 +154,13 @@
   checkout neocon https://github.com/laf0rge/neocon
   checkout osmo-uecups
 
-  checkout_copy_debian8_jessie "osmo-gsm-manuals"
+  cd "$TOP"
+  osmo_obs_checkout_copy debian8 osmo-gsm-manuals
 
   build osmocom-latest
   build limesuite --git-upstream-tree="$(get_last_tag limesuite)"
   build osmo-gsm-manuals
-  build osmo-gsm-manuals-debian8-jessie
+  build osmo-gsm-manuals-debian8
   build libosmocore
   build libosmo-sccp
   build libosmo-abis
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index a79a754..ca4b253 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -164,18 +164,6 @@
   meson subprojects download freeDiameter
 }
 
-
-# Copy an already checked out repository dir and apply its debian 8 patch.
-# $1: Osmocom repository
-checkout_copy_debian8_jessie() {
-  cd "$REPO"
-  cp -a "$1" "$1-debian8-jessie"
-  cd "$1-debian8-jessie"
-  patch -p1 < debian/patches/build-for-debian8.patch
-  git commit -m 'auto-commit: allow debian8 to build' debian/
-  cd ..
-}
-
 build_osmocom() {
   DATA=$TOP/data
   REPO=$TOP/repo
@@ -223,13 +211,14 @@
   checkout neocon https://github.com/laf0rge/neocon
   checkout osmo-uecups
 
-  checkout_copy_debian8_jessie "osmo-gsm-manuals"
-  checkout_copy_debian8_jessie "osmo-trx"
+  cd "$REPO"
+  osmo_obs_checkout_copy debian8 osmo-gsm-manuals
+  osmo_obs_checkout_copy debian8 osmo-trx
 
   build osmocom-nightly
   build limesuite no_commit --git-upstream-tree="$(get_last_tag limesuite)"
   build osmo-gsm-manuals
-  build osmo-gsm-manuals-debian8-jessie
+  build osmo-gsm-manuals-debian8
   build libosmocore
   build libosmo-sccp
   build libosmo-abis
@@ -244,7 +233,7 @@
   build openbsc
   build osmo-pcap
   build osmo-trx
-  build osmo-trx-debian8-jessie
+  build osmo-trx-debian8
   build osmo-sip-connector
   build osmo-bts
   build osmo-pcu

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I2b69571ebc08a920c9147ce544fa8a2e6d950e65
Gerrit-Change-Number: 18393
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/20200525/fa318827/attachment.htm>


More information about the gerrit-log mailing list