Change in osmo-ci[master]: repo-install-test: no distro version in function

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 Jan 22 11:07:32 UTC 2021


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


Change subject: repo-install-test: no distro version in function
......................................................................

repo-install-test: no distro version in function

Instead of calling various foo_debian and foo_centos8 versions with
foo_$DISTRO, create new foo functions that call the right
distro-specific function based on debian* or centos* being in DISTRO.
Rename all foo_centos8 functions to foo_centos.

This is in preparation to run this script with debian10 too, not just
debian9. This can also be used to test a different centos version in the
future.

Related: OS#4969
Change-Id: Ibb9f93af16af7ebe947f7efcd4e709f3e62d12c0
---
M scripts/repo-install-test/run-inside-docker.sh
1 file changed, 60 insertions(+), 18 deletions(-)



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

diff --git a/scripts/repo-install-test/run-inside-docker.sh b/scripts/repo-install-test/run-inside-docker.sh
index dddad30..2e9d6a8 100755
--- a/scripts/repo-install-test/run-inside-docker.sh
+++ b/scripts/repo-install-test/run-inside-docker.sh
@@ -105,7 +105,7 @@
 }
 
 # $1: OBS project (e.g. "network:osmocom:nightly")
-configure_osmocom_repo_centos8() {
+configure_osmocom_repo_centos() {
 	local proj="$1"
 	local baseurl="https://download.opensuse.org/repositories/$(proj_with_slashes "$proj")/CentOS_8"
 
@@ -124,16 +124,24 @@
 }
 
 # $1: OBS project (e.g. "network:osmocom:nightly")
-configure_osmocom_repo_centos8_remove() {
+configure_osmocom_repo_centos_remove() {
 	local proj="$1"
 	rm "/etc/yum.repos.d/$proj.repo"
 }
 
-configure_keep_cache_debian() {
-	if [ -z "$KEEP_CACHE" ]; then
-		return
-	fi
+# $1: OBS project (e.g. "network:osmocom:nightly")
+configure_osmocom_repo() {
+	case "$DISTRO" in
+		debian*)
+			configure_osmocom_repo_debian "$@"
+			;;
+		centos*)
+			configure_osmocom_repo_centos "$@"
+			;;
+	esac
+}
 
+configure_keep_cache_debian() {
 	rm /etc/apt/apt.conf.d/docker-clean
 
 	# "apt" will actually remove the cache by default, even if "apt-get" keeps it.
@@ -142,11 +150,23 @@
 		> /etc/apt/apt.conf.d/01keep-debs
 }
 
-configure_keep_cache_centos8() {
+configure_keep_cache_centos() {
+	echo "keepcache=1" >> /etc/dnf/dnf.conf
+}
+
+configure_keep_cache() {
 	if [ -z "$KEEP_CACHE" ]; then
 		return
 	fi
-	echo "keepcache=1" >> /etc/dnf/dnf.conf
+
+	case "$DISTRO" in
+		debian*)
+			configure_keep_cache_debian
+			;;
+		centos*)
+			configure_keep_cache_centos
+			;;
+	esac
 }
 
 # $1: file
@@ -190,11 +210,11 @@
 	configure_osmocom_repo_debian "$PROJ"
 }
 
-test_conflict_centos8() {
+test_conflict_centos() {
 	dnf -y install libosmocore-devel
 
-	configure_osmocom_repo_centos8_remove "$PROJ"
-	configure_osmocom_repo_centos8 "$PROJ_CONFLICT"
+	configure_osmocom_repo_centos_remove "$PROJ"
+	configure_osmocom_repo_centos "$PROJ_CONFLICT"
 
 	(dnf -y install osmo-mgw 2>&1 && touch /tmp/fail) | tee /tmp/out
 
@@ -209,8 +229,19 @@
 		"but none of the providers can be installed" \
 		"conflicts with osmocom-"
 
-	configure_osmocom_repo_centos8_remove "$PROJ_CONFLICT"
-	configure_osmocom_repo_centos8 "$PROJ"
+	configure_osmocom_repo_centos_remove "$PROJ_CONFLICT"
+	configure_osmocom_repo_centos "$PROJ"
+}
+
+test_conflict() {
+	case "$DISTRO" in
+		debian*)
+			test_conflict_debian
+			;;
+		centos*)
+			test_conflict_centos
+			;;
+	esac
 }
 
 # Filter $PWD/osmocom_packages_all.txt through a blacklist_$DISTRO.txt and store the result in
@@ -239,7 +270,7 @@
 	apt install -y $(cat osmocom_packages.txt)
 }
 
-install_repo_packages_centos8() {
+install_repo_packages_centos() {
 	echo "Installing all repository packages"
 
 	# Get a list of all packages from the repository
@@ -254,6 +285,17 @@
 	dnf install -y $(cat osmocom_packages.txt)
 }
 
+install_repo_packages() {
+	case "$DISTRO" in
+		debian*)
+			install_repo_packages_debian
+			;;
+		centos*)
+			install_repo_packages_centos
+			;;
+	esac
+}
+
 test_binaries_version() {
 	# Make sure --version runs and does not output UNKNOWN
 	failed=""
@@ -331,8 +373,8 @@
 }
 
 check_env
-configure_keep_cache_${DISTRO}
-configure_osmocom_repo_${DISTRO} "$PROJ"
+configure_keep_cache
+configure_osmocom_repo "$PROJ"
 
 for test in $TESTS; do
 	set +x
@@ -343,10 +385,10 @@
 
 	case "$test" in
 		test_conflict)
-			test_conflict_${DISTRO}
+			test_conflict
 			;;
 		install_repo_packages)
-			install_repo_packages_${DISTRO}
+			install_repo_packages
 			;;
 		test_binaries)
 			# install_repo_packages must run first!

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ibb9f93af16af7ebe947f7efcd4e709f3e62d12c0
Gerrit-Change-Number: 22374
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/20210122/537540ee/attachment.htm>


More information about the gerrit-log mailing list