Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move test-suite configuration out of root's ~/.rpmmacros #3527

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/data/macros.testenv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# root's macro config in the test-environment
# common macro config in the test-environment
%_buildhost testhost
%_topdir %{getenv:RPMTEST}/build
%_tmppath %{getenv:RPMTEST}/tmp
8 changes: 6 additions & 2 deletions tests/mktree.common
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ make_install()
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
# system-wide config to match our test environment
cp @CMAKE_CURRENT_SOURCE_DIR@/data/macros.testenv $DESTDIR/@CMAKE_INSTALL_FULL_SYSCONFDIR@/rpm/

# gpg-connect-agent is very, very unhappy if this doesn't exist
mkdir -p $DESTDIR/root/.gnupg
chmod 700 $DESTDIR/root/.gnupg

# set up new-style XDG config directory
mkdir -p $DESTDIR/root/.config/rpm
}
3 changes: 1 addition & 2 deletions tests/rpmdb.at
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ AT_KEYWORDS([rpmdb query])
AT_SKIP_IF([test x$PGP = xdummy])
RPMDB_INIT

# root's .rpmmacros used to keep this build prefix independent
echo "%_keyring rpmdb" >> "${RPMTEST}"/root/.rpmmacros
echo "%_keyring rpmdb" >> "${RPMTEST}"/"${RPMSYSCONFDIR}"/macros.keyring

RPMTEST_CHECK([
runroot rpm -U --nodeps --ignorearch --ignoreos --nosignature \
Expand Down
2 changes: 1 addition & 1 deletion tests/rpmi.at
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ for e in 1 2; do
runroot_other cp /build/RPMS/noarch/versiontest-1.0-1.noarch.rpm /tmp/epoch${e}.rpm
done
# for testing sanity
echo '%_query_all_fmt %%{nevra}' >> ${HOME}/.rpmmacros
echo '%_query_all_fmt %%{nevra}' >> ${HOME}/.config/rpm/macros

RPMTEST_CHECK([
RPMDB_INIT
Expand Down
3 changes: 2 additions & 1 deletion tests/rpmmacro.at
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RPMDB_INIT

# .rpmmacros exists, new directory not
RPMTEST_CHECK([[
rm -f ~/.config/rpm
rm -rf ~/.config/rpm ~/.rpmmacros
touch ~/.rpmmacros
rpm --showrc | awk '/^Macro path/{print(a[split($0,a,":")])}'
]],
Expand All @@ -19,6 +19,7 @@ rpm --showrc | awk '/^Macro path/{print(a[split($0,a,":")])}'

# prefer new style if it exists
RPMTEST_CHECK([[
rm -rf ~/.config/rpm ~/.rpmmacros
mkdir -p ~/.config/rpm
rpm --showrc | awk '/^Macro path/{print(a[split($0,a,":")])}'
]],
Expand Down
18 changes: 7 additions & 11 deletions tests/rpmsigdig.at
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ AT_SETUP([rpmkeys key update and delete (rpmdb)])
AT_KEYWORDS([rpmkeys signature])
RPMDB_INIT
# currently the default but make it explicit
# root's .rpmmacros used to keep this build prefix independent
echo "%_keyring rpmdb" >> "${RPMTEST}"/root/.rpmmacros
echo "%_keyring rpmdb" >> "${RPMTEST}"/"${RPMSYSCONFDIR}"/macros.keyring
RPMTEST_CHECK([
runroot rpmkeys --import /data/keys/rpm.org-rsa-2048-test.pub
runroot rpmkeys -Kv /data/RPMS/hello-2.0-1.x86_64-signed-with-new-subkey.rpm
Expand Down Expand Up @@ -164,8 +163,7 @@ RPMTEST_CLEANUP
AT_SETUP([rpmkeys migrate from keyid to fingerprint (fs)])
AT_KEYWORDS([rpmkeys rpmdb])
RPMDB_INIT
# root's .rpmmacros used to keep this build prefix independent
echo "%_keyring fs" >> "${RPMTEST}"/root/.rpmmacros
echo "%_keyring fs" >> "${RPMTEST}"/"${RPMSYSCONFDIR}"/macros.keyring
krpath="$(rpm --eval %{_keyringpath})"

RPMTEST_CHECK([
Expand Down Expand Up @@ -199,8 +197,7 @@ RPMTEST_CLEANUP
AT_SETUP([rpmkeys key update (fs)])
AT_KEYWORDS([rpmkeys signature])
RPMDB_INIT
# root's .rpmmacros used to keep this build prefix independent
echo "%_keyring fs" >> "${RPMTEST}"/root/.rpmmacros
echo "%_keyring fs" >> "${RPMTEST}"/"${RPMSYSCONFDIR}"/macros.keyring
RPMTEST_CHECK([
runroot rpmkeys --import /data/keys/rpm.org-rsa-2048-test.pub
runroot rpmkeys -Kv /data/RPMS/hello-2.0-1.x86_64-signed-with-new-subkey.rpm
Expand Down Expand Up @@ -278,8 +275,7 @@ RPMTEST_CLEANUP
AT_SETUP([rpmkeys key update (openpgp)])
AT_KEYWORDS([rpmkeys signature])
RPMDB_INIT
# root's .rpmmacros used to keep this build prefix independent
echo "%_keyring openpgp" >> "${RPMTEST}"/root/.rpmmacros
echo "%_keyring openpgp" >> "${RPMTEST}"/"${RPMSYSCONFDIR}"/macros.keyring
krpath=$(rpm --eval "%{_keyringpath}")

RPMTEST_CHECK([
Expand Down Expand Up @@ -1411,7 +1407,7 @@ AT_SKIP_IF([test x$PGP = xdummy])
RPMDB_INIT

RPMTEST_CHECK([
cat << EOF >> ${HOME}/.rpmmacros
cat << EOF >> ${HOME}/.config/rpm/macros
%_openpgp_sign sq
%_openpgp_sign_id 771B18D3D7BAA28734333C424344591E1964C5FC
EOF
Expand Down Expand Up @@ -1471,7 +1467,7 @@ AT_SKIP_IF([test x$PGP = xdummy])
RPMDB_INIT

RPMTEST_CHECK([
cat << EOF >> ${HOME}/.rpmmacros
cat << EOF >> ${HOME}/.config/rpm/macros
%_openpgp_sign sq
%_openpgp_sign_id 771B18D3D7BAA28734333C424344591E1964C5FC
EOF
Expand Down Expand Up @@ -1581,7 +1577,7 @@ AT_SKIP_IF([test x$PGP = xdummy])
RPMDB_INIT

RPMTEST_CHECK([
cat << EOF >> ${HOME}/.rpmmacros
cat << EOF >> ${HOME}/.config/rpm/macros
%_openpgp_sign sq
%_openpgp_sign_id 771B18D3D7BAA28734333C424344591E1964C5FC
EOF
Expand Down