Skip to content

Commit

Permalink
Drop the %_dbpath override in root's ~/.rpmmacros from our test-conta…
Browse files Browse the repository at this point in the history
…iner

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.
  • Loading branch information
pmatilai committed Jan 17, 2025
1 parent 34e8d9c commit a6c86c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions tests/Dockerfile.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 6 additions & 0 deletions tests/mktree.common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a6c86c2

Please sign in to comment.