Change in osmo-ci[master]: repo-install-test: add PROJ variable

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 Jan 20 13:32:27 UTC 2021


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


Change subject: repo-install-test: add PROJ variable
......................................................................

repo-install-test: add PROJ variable

Make debugging easier by having a PROJ variable that can be overridden
by an environment variable of the same name. Pass it to docker and use
it to generate all related URLs etc.

Add functions in run-inside-docker.sh to convert the PROJ variable into
the two other formates needed (with slashes, with underscore), so a
future patch can use these functions with a different PROJ variable too.

Related: OS#4733
Change-Id: I0ac05a79ad65b5664b5ba37227b65e3b1422a4bf
---
M scripts/repo-install-test.sh
M scripts/repo-install-test/run-inside-docker.sh
2 files changed, 29 insertions(+), 7 deletions(-)



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

diff --git a/scripts/repo-install-test.sh b/scripts/repo-install-test.sh
index a30c36d..a785b74 100755
--- a/scripts/repo-install-test.sh
+++ b/scripts/repo-install-test.sh
@@ -2,6 +2,7 @@
 # Environment variables:
 # * INTERACTIVE: set to 1 to keep an interactive shell open after the script ran (for debugging)
 # * FEED: binary package feed (e.g. "latest", "nightly")
+# * PROJ: OBS project namespace (e.g. "network:osmocom:latest")
 # * KEEP_CACHE: set to 1 to keep downloaded binary packages (for development)
 . "$(dirname "$0")/common.sh"
 
@@ -16,6 +17,7 @@
 docker_images_require "$DISTRO-repo-install-test"
 
 FEED="${FEED:-nightly}"
+PROJ="${PROJ:-network:osmocom:$FEED}"
 CONTAINER="$DISTRO-repo-install-test-$FEED"
 
 # Try to run "systemctl status" 10 times, kill the container on failure
@@ -54,6 +56,7 @@
 		-v "$OSMO_CI_DIR/scripts/repo-install-test:/repo-install-test:ro" \
 		--name "$CONTAINER" \
 		-e FEED="$FEED" \
+		-e PROJ="$PROJ" \
 		-e DISTRO="$DISTRO" \
 		-e container=docker \
 		--tmpfs /run \
diff --git a/scripts/repo-install-test/run-inside-docker.sh b/scripts/repo-install-test/run-inside-docker.sh
index 93e8b7f..f472645 100755
--- a/scripts/repo-install-test/run-inside-docker.sh
+++ b/scripts/repo-install-test/run-inside-docker.sh
@@ -1,6 +1,7 @@
 #!/bin/sh -ex
 # Environment variables:
 # * FEED: binary package feed (e.g. "latest", "nightly")
+# * PROJ: OBS project namespace (e.g. "network:osmocom:latest")
 # * KEEP_CACHE: set to 1 to keep downloaded binary packages (for development)
 # * DISTRO: linux distribution  name (e.g. "debian", "centos")
 
@@ -34,8 +35,18 @@
 	osmo-bts-virtual
 "
 
-HTTP="http://download.opensuse.org/repositories/network:/osmocom:/$FEED/Debian_9.0/"
-OBS="obs://build.opensuse.org/network:osmocom:$FEED/Debian_9.0"
+# $1: OBS project (e.g. "network:osmocom:nightly" -> "network:/osmocom:/nightly")
+proj_with_slashes() {
+	echo "$1" | sed "s.:.:/.g"
+}
+
+# $1: OBS project (e.g. "network:osmocom:nightly" -> "network_osmocom_nightly")
+proj_with_underscore() {
+	echo "$1" | tr : _
+}
+
+HTTP="http://download.opensuse.org/repositories/$(proj_with_slashes "$PROJ")/Debian_9.0/"
+OBS="obs://build.opensuse.org/$PROJ/Debian_9.0"
 
 check_env() {
 	if [ -n "$FEED" ]; then
@@ -44,6 +55,12 @@
 		echo "ERROR: missing environment variable \$FEED!"
 		exit 1
 	fi
+	if [ -n "$PROJ" ]; then
+		echo "Checking project: $PROJ"
+	else
+		echo "ERROR: missing environment variable \$PROJ!"
+		exit 1
+	fi
 	if [ -n "$DISTRO" ]; then
 		echo "Linux distribution: $DISTRO"
 	else
@@ -60,16 +77,18 @@
 }
 
 configure_osmocom_repo_centos8() {
+	local baseurl="https://download.opensuse.org/repositories/$(proj_with_slashes "$PROJ")/CentOS_8"
+
 	echo "Configuring Osmocom repository"
 	# Generate this file, based on the feed:
 	# https://download.opensuse.org/repositories/network:osmocom:latest/CentOS_8/network:osmocom:latest.repo
-	cat << EOF > /etc/yum.repos.d/network:osmocom:$FEED.repo
-[network_osmocom_$FEED]
+	cat << EOF > "/etc/yum.repos.d/$PROJ.repo"
+[$(proj_with_underscore "$PROJ")]
 name=$FEED packages of the Osmocom project (CentOS_8)
 type=rpm-md
-baseurl=https://download.opensuse.org/repositories/network:/osmocom:/$FEED/CentOS_8/
+baseurl=$baseurl/
 gpgcheck=1
-gpgkey=https://download.opensuse.org/repositories/network:/osmocom:/$FEED/CentOS_8/repodata/repomd.xml.key
+gpgkey=$baseurl/repodata/repomd.xml.key
 enabled=1
 EOF
 }
@@ -124,7 +143,7 @@
 	# Get a list of all packages from the repository
 	LANG=C.UTF-8 repoquery \
 		--quiet \
-		--repoid="network_osmocom_$FEED" \
+		--repoid="$(proj_with_underscore "$PROJ")" \
 		--archlist="x86_64,noarch" \
 		--qf="%{name}" \
 		> osmocom_packages_all.txt

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I0ac05a79ad65b5664b5ba37227b65e3b1422a4bf
Gerrit-Change-Number: 22328
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/20210120/df133f62/attachment.htm>


More information about the gerrit-log mailing list