From 61378e6146b314328699b0f41db8615245d3e82d Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Mon, 6 Jan 2020 13:00:53 +0000 Subject: [PATCH] rpm: assure we build and use a rpm repository Assures we also build a rpm repository and install rpms from inside it. This improves testing of packaging by assuring that we test the same way it is supposed to be used in production. Depends-On: https://review.rdoproject.org/r/24376 Signed-off-by: Sorin Sbarnea --- Makefile | 15 ++++++++++++--- contrib/build_rpm.sh | 30 ++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a9f1d17ba6..d7b21d3f5f 100644 --- a/Makefile +++ b/Makefile @@ -568,8 +568,17 @@ vendor-in-container: package: ## Build rpm packages ## TODO(ssbarnea): make version number predictable, it should not change ## on each execution, producing duplicates. - rm -f ~/rpmbuild/RPMS/x86_64/* ~/rpmbuild/RPMS/noarch/* + rm -rf build/* *.src.rpm ~/rpmbuild/RPMS/*/* ./contrib/build_rpm.sh -package-install: package ## Install rpm packages - sudo ${PKG_MANAGER} -y install --allowerasing ${HOME}/rpmbuild/RPMS/*/*.rpm +package-install: package ## Install rpm packages via a local podman.repo + # We use the repository approach with max priority and without disabling + # system packages in order to detect if our packages are + # creating any conflicts. + ls -la ${PWD}/build/buildset + sudo cp -f ${PWD}/build/podman.repo /etc/yum.repos.d/podman.repo + # --best needed to avoid accident where old rpms ones are picked instead + sudo ${PKG_MANAGER} -y install --best --allowerasing --nogpgcheck podman podman-remote + podman version + # info may require sudo and will also verify conman compatibility + sudo podman info --log-level debug diff --git a/contrib/build_rpm.sh b/contrib/build_rpm.sh index 088d8b7a5e..0edcb865de 100755 --- a/contrib/build_rpm.sh +++ b/contrib/build_rpm.sh @@ -2,7 +2,7 @@ set -euxo pipefail # returned path can vary: /usr/bin/dnf /bin/dnf ... -pkg_manager=`command -v dnf yum | head -n1` +pkg_manager=$(command -v dnf yum | head -n1) echo "Package manager binary: $pkg_manager" @@ -14,18 +14,22 @@ enabled=1 gpgcheck=0" > /etc/yum.repos.d/container_virt.repo fi -declare -a PKGS=(device-mapper-devel \ +declare -a PKGS=(\ + createrepo \ + device-mapper-devel \ git \ glib2-devel \ glibc-static \ + go-compilers-golang-compiler \ golang \ gpgme-devel \ libassuan-devel \ libseccomp-devel \ libselinux-devel \ make \ + redhat-rpm-config \ rpm-build \ - go-compilers-golang-compiler \ + rpmdevtools \ systemd-devel \ ) @@ -47,7 +51,7 @@ else fi echo ${PKGS[*]} -sudo $pkg_manager install -y ${PKGS[*]} +sudo $pkg_manager install --disablerepo podman -y ${PKGS[*]} make -f .copr/Makefile # workaround for https://github.com/containers/libpod/issues/4627 @@ -56,3 +60,21 @@ if [ -d ~/rpmbuild/BUILD ]; then fi rpmbuild --rebuild ${extra_arg:-} podman-*.src.rpm + +# build repository +mkdir -p build/buildset +pushd build/buildset +cp -l ~/rpmbuild/RPMS/*/*.rpm . +createrepo . + +cat <../podman.repo +[podman] +priority=1 +name=Podman Override +baseurl=file://${PWD} +enabled=1 +gpgcheck=0 +metadata_expire=1s +cost=0 +EOF +popd