From a3ac6e388a3ef851c91305c760e5b23026d541f5 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 15 May 2020 10:09:40 +0200 Subject: install_test: reproduce install failure with cache Change-Id: Iaae28a209701f5c5987b27316ad82a3d5f25a4a8 --- rpm-local/install_test.sh | 20 ++++++++++++++++++++ rpm-local/scripts/build_pkg.sh | 2 +- rpm-local/scripts/install_test.sh | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100755 rpm-local/install_test.sh create mode 100755 rpm-local/scripts/install_test.sh diff --git a/rpm-local/install_test.sh b/rpm-local/install_test.sh new file mode 100755 index 0000000..0aa04ee --- /dev/null +++ b/rpm-local/install_test.sh @@ -0,0 +1,20 @@ +#!/bin/sh -ex +DIR="$(cd "$(dirname "$0")" && pwd -P)" +IMAGE="centos8" + +if ! [ -e ".build.docker.$IMAGE" ]; then + echo "ERROR: run build.sh first, to generate the docker img" + exit 1 +fi + + +docker run \ + -it \ + --rm \ + -v "$DIR/rpmbuild:/home/user/rpmbuild" \ + -v "$DIR/scripts:/scripts" \ + -v "$DIR/cache/$IMAGE/dnf:/var/cache/dnf" \ + -v "$DIR/cache/yum_repos:/root/yum_repos" \ + -v "$DIR/cache/distfiles:/home/user/distfiles" \ + "$IMAGE:latest" \ + /scripts/install_test.sh diff --git a/rpm-local/scripts/build_pkg.sh b/rpm-local/scripts/build_pkg.sh index 5d94a76..d7e83d3 100755 --- a/rpm-local/scripts/build_pkg.sh +++ b/rpm-local/scripts/build_pkg.sh @@ -29,7 +29,7 @@ cd /home/user/rpmbuild/SPECS # Install systemd-rpm-macros if needed, so the .spec can be parsed if grep "^BuildRequires:" "$1.spec" | grep -q systemd-rpm-macros; then - dnf -y install systemd-rpm-macros + dnf --setopt=keepcache=1 -y install systemd-rpm-macros fi # keepcache: /var/cache/dnf is mounted from outside docker dir, so downloaded rpm depends are cached diff --git a/rpm-local/scripts/install_test.sh b/rpm-local/scripts/install_test.sh new file mode 100755 index 0000000..28b66b1 --- /dev/null +++ b/rpm-local/scripts/install_test.sh @@ -0,0 +1,19 @@ +#!/bin/sh -ex +REPO_FILE="home:osmith42.repo" + +# Download repo file +cd /root/yum_repos +if ! [ -e "$REPO_FILE" ]; then + dnf --setopt=keepcache=1 -y install wget + wget https://download.opensuse.org/repositories/home:osmith42/CentOS_8_Stream/home:osmith42.repo +fi + +# Enable repo +cp "/root/yum_repos/$REPO_FILE" "/etc/yum.repos.d/$REPO_FILE" + +# update index +dnf --setopt=keepcache=1 -y check-update /etc/yum.repos.d/$REPO_FILE + +# install packages +# somehow -y is not enough +yes | dnf --setopt=keepcache=1 -y install osmo-trx-uhd -- cgit v1.2.3