Change in osmo-ci[master]: repo-install-test: support centos

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 May 27 10:35:07 UTC 2020


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


Change subject: repo-install-test: support centos
......................................................................

repo-install-test: support centos

Related: OS#4563
Depends: I50743c304728444ede8e0d40b8abef9d17c44d8d (docker-playground)
Change-Id: I399360ee6389591180859b52f0ef08883447b90b
---
M scripts/repo-install-test.sh
A scripts/repo-install-test/blacklist_centos.txt
R scripts/repo-install-test/blacklist_debian.txt
M scripts/repo-install-test/run-inside-docker.sh
4 files changed, 107 insertions(+), 17 deletions(-)



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

diff --git a/scripts/repo-install-test.sh b/scripts/repo-install-test.sh
index e0367ec..4bc0fab 100755
--- a/scripts/repo-install-test.sh
+++ b/scripts/repo-install-test.sh
@@ -4,10 +4,19 @@
 # * FEED: binary package feed (e.g. "latest", "nightly")
 # * KEEP_CACHE: set to 1 to keep downloaded binary packages (for development)
 . "$(dirname "$0")/common.sh"
-docker_images_require "debian-repo-install-test"
+
+# Show usage
+if [ "$#" -ne 1 ]; then
+	echo "usage: repo-install-test.sh DISTRO"
+	echo "DISTRO: debian or centos"
+	exit 1
+fi
+
+DISTRO="$1"
+docker_images_require "$DISTRO-repo-install-test"
 
 [ -z "$FEED" ] && FEED="nightly"
-CONTAINER="repo-install-test-$FEED"
+CONTAINER="$DISTRO-repo-install-test-$FEED"
 
 # Try to run "systemctl status" 10 times, kill the container on failure
 check_if_systemd_is_running() {
@@ -34,6 +43,7 @@
 if [ -n "$KEEP_CACHE" ]; then
 	args="$args -e KEEP_CACHE=1"
 	args="$args -v $OSMO_CI_DIR/_repo_install_test_cache/debian/apt:/var/cache/apt"
+	args="$args -v $OSMO_CI_DIR/_repo_install_test_cache/centos/dnf:/var/cache/dnf"
 fi
 
 # Run the container
@@ -45,6 +55,7 @@
 		-v "$OSMO_CI_DIR/_repo_install_test_data:/data" \
 		--name "$CONTAINER" \
 		-e FEED="$FEED" \
+		-e DISTRO="$DISTRO" \
 		-e container=docker \
 		--tmpfs /run \
 		--tmpfs /run/lock \
@@ -53,7 +64,7 @@
 		--cap-add SYS_ADMIN \
 		--cap-add SYS_NICE \
 		$args \
-		"$USER/debian-repo-install-test" \
+		"$USER/$DISTRO-repo-install-test" \
 		/lib/systemd/systemd &
 check_if_systemd_is_running
 
diff --git a/scripts/repo-install-test/blacklist_centos.txt b/scripts/repo-install-test/blacklist_centos.txt
new file mode 100644
index 0000000..83d2cbd
--- /dev/null
+++ b/scripts/repo-install-test/blacklist_centos.txt
@@ -0,0 +1,11 @@
+# These packages will not get explicitly installed in this test.
+# Package lines must have nothing but the package (no comment,
+# no additional space etc).
+
+# The ulfius package in network:osmocom:* is linked to the opensuse version,
+# which has dependencies that exist under another name in centos
+# (libgnutls-devel, libjansson-devel). Linking to the opensuse version has the
+# advantage that we don't need to worry about updating the package. However,
+# the dependency problem means that we can't simply install the package in
+# centos. In OBS we work around this in the project config.
+ulfius-devel
diff --git a/scripts/repo-install-test/blacklist.txt b/scripts/repo-install-test/blacklist_debian.txt
similarity index 100%
rename from scripts/repo-install-test/blacklist.txt
rename to scripts/repo-install-test/blacklist_debian.txt
diff --git a/scripts/repo-install-test/run-inside-docker.sh b/scripts/repo-install-test/run-inside-docker.sh
index eed33d2..4265180 100755
--- a/scripts/repo-install-test/run-inside-docker.sh
+++ b/scripts/repo-install-test/run-inside-docker.sh
@@ -2,6 +2,7 @@
 # Environment variables:
 # * FEED: binary package feed (e.g. "latest", "nightly")
 # * KEEP_CACHE: set to 1 to keep downloaded binary packages (for development)
+# * DISTRO: linux distribution  name (e.g. "debian", "centos")
 
 # Systemd services that must start up successfully after installing all packages (OS#3369)
 # Disabled services:
@@ -43,16 +44,37 @@
 		echo "ERROR: missing environment variable \$FEED!"
 		exit 1
 	fi
+	if [ -n "$DISTRO" ]; then
+		echo "Linux distribution: $DISTRO"
+	else
+		echo "ERROR: missing environment variable \$DISTRO!"
+		exit 1
+	fi
 }
 
-configure_osmocom_repo() {
+configure_osmocom_repo_debian() {
 	echo "Configuring Osmocom repository"
 	echo "deb $HTTP ./" \
 		> /etc/apt/sources.list.d/osmocom-latest.list
 	apt-get update
 }
 
-configure_keep_cache() {
+configure_osmocom_repo_centos() {
+	echo "Configuring Osmocom repository"
+	# Generate this file, based on the feed:
+	# https://download.opensuse.org/repositories/network:osmocom:latest/CentOS_8_Stream/network:osmocom:latest.repo
+	cat << EOF > /etc/yum.repos.d/network:osmocom:$FEED.repo
+[network_osmocom_$FEED]
+name=$FEED packages of the Osmocom project (CentOS_8_Stream)
+type=rpm-md
+baseurl=https://download.opensuse.org/repositories/network:/osmocom:/$FEED/CentOS_8_Stream/
+gpgcheck=1
+gpgkey=https://download.opensuse.org/repositories/network:/osmocom:/$FEED/CentOS_8_Stream/repodata/repomd.xml.key
+enabled=1
+EOF
+}
+
+configure_keep_cache_debian() {
 	if [ -z "$KEEP_CACHE" ]; then
 		return
 	fi
@@ -65,7 +87,25 @@
 		> /etc/apt/apt.conf.d/01keep-debs
 }
 
-install_repo_packages() {
+configure_keep_cache_centos() {
+	if [ -z "$KEEP_CACHE" ]; then
+		return
+	fi
+	echo "keepcache=1" >> /etc/dnf/dnf.conf
+}
+
+# Filter /data/osmocom_packages_all.txt through a blacklist_$DISTRO.txt and store the result in
+# /data/osmocom_packages.txt.
+filter_packages_txt() {
+	# Copy distro specific blacklist file, remove comments and sort it
+	grep -v "^#" /repo-install-test/blacklist_$DISTRO.txt | sort -u > /data/blacklist.txt
+
+	# Generate list of pkgs to be installed from available pkgs minus the ones blacklisted
+	comm -23 /data/osmocom_packages_all.txt \
+		/data/blacklist.txt > /data/osmocom_packages.txt
+}
+
+install_repo_packages_debian() {
 	echo "Installing all repository packages"
 
 	# Get a list of all packages from the repository. Reference:
@@ -74,15 +114,25 @@
 		"?origin($OBS) ?architecture(native)" | sort \
 		> /data/osmocom_packages_all.txt
 
-	# Remove comments from blacklist.txt (and sort it)
-	grep -v "^#" /repo-install-test/blacklist.txt | sort -u > /data/blacklist.txt
-
-	# Install all repo packages which are not on the blacklist
-	comm -23 /data/osmocom_packages_all.txt \
-		/data/blacklist.txt > /data/osmocom_packages.txt
+	filter_packages_txt
 	apt install -y $(cat /data/osmocom_packages.txt)
 }
 
+install_repo_packages_centos() {
+	echo "Installing all repository packages"
+
+	# Get a list of all packages from the repository
+	LANG=C.UTF-8 repoquery \
+		--quiet \
+		--repoid="network_osmocom_$FEED" \
+		--archlist="x86_64,noarch" \
+		--qf="%{name}" \
+		> /data/osmocom_packages_all.txt
+
+	filter_packages_txt
+	dnf install -y $(cat /data/osmocom_packages.txt)
+}
+
 test_binaries_version() {
 	# Make sure --version runs and does not output UNKNOWN
 	failed=""
@@ -122,8 +172,12 @@
 		osmo-sgsn \
 		osmo-sip-connector \
 		osmo-stp \
-		osmo-trx-uhd \
-		osmo-trx-usrp1
+		osmo-trx-uhd
+
+	if [ "$DISTRO" = "debian" ]; then
+		test_binaries_version \
+			osmo-trx-usrp1
+	fi
 }
 
 services_check() {
@@ -156,8 +210,22 @@
 }
 
 check_env
-configure_keep_cache
-configure_osmocom_repo
-install_repo_packages
+
+case "$DISTRO" in
+debian)
+	configure_keep_cache_debian
+	configure_osmocom_repo_debian
+	install_repo_packages_debian
+	;;
+centos)
+	configure_keep_cache_centos
+	configure_osmocom_repo_centos
+	install_repo_packages_centos
+	;;
+*)
+	echo "ERROR: unknown DISTRO=$DISTRO"
+	exit 1
+esac
+
 test_binaries
 services_check

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

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I399360ee6389591180859b52f0ef08883447b90b
Gerrit-Change-Number: 18514
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/20200527/ab7a555c/attachment.htm>


More information about the gerrit-log mailing list