Change in osmo-ci[master]: OBS: check required programs before start

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
Fri May 22 09:56:25 UTC 2020


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/18391 )


Change subject: OBS: check required programs before start
......................................................................

OBS: check required programs before start

osmocom-*-packages.sh take some time to execute and has quite a few
programs that are not commonly installed. Check the required
dependencies first, so it doesn't abort in the middle of the scripts if
these are missing. I just ran into this with the new meson dependency.

Change-Id: I46cf1aeedd61dbd4fc8fa3f24c60e29033339ead
---
M scripts/common-obs.sh
M scripts/common.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
4 files changed, 28 insertions(+), 10 deletions(-)



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

diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 5e21574..c07fbaa 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -1,6 +1,19 @@
 #!/bin/sh
 # Various common code used in the OBS (opensuse build service) related osmo-ci shell scripts
 
+osmo_cmd_require \
+	dch \
+	dh \
+	dpkg-buildpackage \
+	gbp \
+	git \
+	meson \
+	mktemp \
+	osc \
+	patch \
+	sed \
+	wget
+
 # Create the source for a dummy package, that conflicts with another dummy package in the current directory. Example
 # of the structure that will be generated:
 # osmocom-nightly
diff --git a/scripts/common.sh b/scripts/common.sh
index af7c354..917962e 100644
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -157,3 +157,18 @@
 	cd "$oldpwd"
 	return $ret
 }
+
+# Abort the script if required programs are missing
+# $1...$n: program name
+osmo_cmd_require() {
+	local fail=0
+	for i in "$@"; do
+		if ! command -v "$i" >/dev/null 2>&1; then
+			echo "Required program not found: $i"
+			fail=1
+		fi
+	done
+	if [ "$fail" = 1 ]; then
+		exit 1
+	fi
+}
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index 88c5094..ddf5359 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -15,11 +15,6 @@
 TOP=$(pwd)
 DEBSRCDIR="$TOP/debsrc"
 
-if ! which osc >/dev/null 2>/dev/null ; then
-  echo "osc binary not found"
-  exit 1
-fi
-
 ### OBS build
 prepare() {
   # start with a checkout of the project
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index b3f0461..8f36377 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -14,11 +14,6 @@
 DT=$(date +%Y%m%d)
 TOP=$(pwd)/$(mktemp -d nightly-3g_XXXXXX)
 
-if ! which osc >/dev/null 2>/dev/null ; then
-  echo "osc binary not found"
-  exit 1
-fi
-
 ### OBS build
 prepare() {
   # clean up the whole space

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I46cf1aeedd61dbd4fc8fa3f24c60e29033339ead
Gerrit-Change-Number: 18391
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/20200522/a1e555c5/attachment.htm>


More information about the gerrit-log mailing list