diff options
author | Oliver Smith <osmith@sysmocom.de> | 2021-01-14 14:01:29 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2021-01-20 14:19:02 +0100 |
commit | 5ddc64b2924a880e30a7f06ed0ead0b9037df5ce (patch) | |
tree | 052929d13799a237623cd39fd074be3371204204 | |
parent | 98edd8f01d8efa06151a7f98542404ffb2284152 (diff) |
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
-rwxr-xr-x | scripts/repo-install-test.sh | 3 | ||||
-rwxr-xr-x | scripts/repo-install-test/run-inside-docker.sh | 33 |
2 files changed, 29 insertions, 7 deletions
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 @@ DISTRO="$1" 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 @@ docker run --rm \ -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 @@ SERVICES_NIGHTLY=" 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 @@ check_env() { 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_debian() { } 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 @@ install_repo_packages_centos8() { # 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 |