From a6c86c2e50b238cda0f5d734c58caa10043d8311 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 17 Jan 2025 15:12:22 +0200 Subject: [PATCH] Drop the %_dbpath override in root's ~/.rpmmacros from our test-container This override exists to make system rpmdb accessible in eg "make shell" but it causes complications wrt the prefix (see below + next commits) and also masks test bugs (see previous commits). We can resurrect this functionality later on if we find solutions that avoid the issues. Instead of trying to inject the system rpmdb path into the test-image in a prefix-independent manner, set + create an empty, test-suite specific rpmdb path for all the tests to use by default. This dodges the pesky prefix question and accidental test-dependencies on system rpmdb. It should also allow us to optimize away a bunch of RPMDB_INIT's in the tests later on, but that's an exercise for another day. This is the first step to fixing #3521. --- tests/Dockerfile.fedora | 2 -- tests/mktree.common | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Dockerfile.fedora b/tests/Dockerfile.fedora index d325c60493..def449db83 100644 --- a/tests/Dockerfile.fedora +++ b/tests/Dockerfile.fedora @@ -61,8 +61,6 @@ RUN rm -f /usr/lib/rpm/macros.d/macros.transaction_ima RUN dnf -y --enablerepo=updates install "sequoia-sq >= 1.0" RUN dnf clean all -RUN echo "%_dbpath $(rpm --eval '%_dbpath')" > /root/.rpmmacros - # Workaround for pkgconf(1)'s unlisted dependency on rpm. # This is needed for cmake to work without an rpm installation. RUN ln -sf $(rpm --eval '%{_target_platform}%{?_gnu}')-pkg-config \ diff --git a/tests/mktree.common b/tests/mktree.common index 6c00a95b19..c1bcd4d2ae 100644 --- a/tests/mktree.common +++ b/tests/mktree.common @@ -24,6 +24,12 @@ make_install() mkdir -p $DESTDIR/build ln -sf ../data/SOURCES $DESTDIR/build/ + # setup an empty db that all tests are pointed to by default + dbpath="/var/lib/rpm-testsuite" + mkdir -p $DESTDIR/$dbpath + echo "%_dbpath $dbpath" > $DESTDIR/@CMAKE_INSTALL_FULL_SYSCONFDIR@/rpm/macros.db + rpmdb --dbpath $DESTDIR/$dbpath --initdb + # append in case Dockerfile put something in there already cat @CMAKE_CURRENT_SOURCE_DIR@/data/macros.testenv >> $DESTDIR/root/.rpmmacros # gpg-connect-agent is very, very unhappy if this doesn't exist