From 826cbb8869e7d640fe3c2582a3a8dacf393e1ee0 Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Wed, 21 Aug 2024 15:02:36 +0200
Subject: [PATCH] Fix -V option usage in our tests

Conflict:adapt context because 760eb8638 is not merged
Reference:https://github.com/rpm-software-management/rpm/commit/826cbb8869e7d640fe3c2582a3a8dacf393e1ee0

Coupling -V with -a when querying for specific packages makes little
sense and only causes the order of the output lines to depend on the
database ordering.

This is known to vary between the ndb and sqlite backends in particular,
confusing some of the tests that expect the lines to be in a specific
order.

While at it, fix all such questionable usages, even those that only
entail one package argument.

Fixes: #3242
---
 tests/rpme.at      | 16 ++++++++--------
 tests/rpmverify.at | 38 +++++++++++++++++++-------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/tests/rpme.at b/tests/rpme.at
index ead757579..058d929fd 100644
--- a/tests/rpme.at
+++ b/tests/rpme.at
@@ -293,9 +293,9 @@ done
 RPMTEST_CHECK([
 runroot rpm -U --ignoreos /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
 runroot rpm -U --ignoreos --excludepath=/usr/share /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
-runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -Vv --nogroup --nouser conflicta conflictb
 runroot rpm -e conflicta
-runroot rpm -Vav --nogroup --nouser conflictb
+runroot rpm -Vv --nogroup --nouser conflictb
 runroot rpm -e conflictb
 runroot rpm -Vp --nogroup --nouser /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
 ],
@@ -310,9 +310,9 @@ missing     /usr/share/my.version
 RPMTEST_CHECK([
 runroot rpm -U --ignoreos --excludepath=/usr/share /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
 runroot rpm -U --ignoreos /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
-runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -Vv --nogroup --nouser conflicta conflictb
 runroot rpm -e conflicta
-runroot rpm -Vav --nogroup --nouser conflictb
+runroot rpm -Vv --nogroup --nouser conflictb
 runroot rpm -e conflictb
 runroot rpm -Vp --nogroup --nouser /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
 ],
@@ -327,9 +327,9 @@ missing     /usr/share/my.version
 RPMTEST_CHECK([
 runroot rpm -U --ignoreos /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm 
 runroot rpm -U --ignoreos --force /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
-runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -Vv --nogroup --nouser conflicta conflictb
 runroot rpm -e conflicta
-runroot rpm -Vav --nogroup --nouser conflictb
+runroot rpm -Vv --nogroup --nouser conflictb
 runroot rpm -e conflictb
 runroot rpm -Vp --nogroup --nouser /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
 ],
@@ -344,9 +344,9 @@ missing     /usr/share/my.version
 RPMTEST_CHECK([
 runroot rpm -U --ignoreos /build/RPMS/noarch/conflicta-1.0-1.noarch.rpm
 runroot rpm -U --ignoreos --force /build/RPMS/noarch/conflictb-1.0-1.noarch.rpm
-runroot rpm -Vav --nogroup --nouser conflicta conflictb
+runroot rpm -Vv --nogroup --nouser conflicta conflictb
 runroot rpm -e conflictb
-runroot rpm -Vav --nogroup --nouser conflicta
+runroot rpm -Vv --nogroup --nouser conflicta
 runroot rpm -e conflicta
 ],
 [0],
diff --git a/tests/rpmverify.at b/tests/rpmverify.at
index 3a87b085f..32427021d 100644
--- a/tests/rpmverify.at
+++ b/tests/rpmverify.at
@@ -304,13 +304,13 @@ touch -t 201703171717 ${tf}
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 cat "${tf}"
 
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 cat "${tf}"
 
 echo "xx" > "${tf}"
@@ -319,7 +319,7 @@ cat "${tf}"
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-4.0-1.noarch.rpm
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 cat "${tf}"
 
 touch -t 201703171717 ${tf}
@@ -327,7 +327,7 @@ touch -t 201703171717 ${tf}
 runroot rpm -U --oldpackage \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 cat "${tf}"
 ],
 [0],
@@ -352,7 +352,7 @@ touch -t 201703171717 ${tf}
 runroot rpm -Uvv --fsmdebug \
 	--define "_minimize_writes 1" \
 	 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm > output.txt 2>&1
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c "touch" output.txt
 cat "${tf}"
 
@@ -360,7 +360,7 @@ cat "${tf}"
 runroot rpm -Uvv --fsmdebug \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm  > output.txt 2>&1
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c "touch" output.txt
 cat "${tf}"
 echo "xx" > "${tf}"
@@ -369,7 +369,7 @@ cat "${tf}"
 runroot rpm -Uvv --fsmdebug \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-4.0-1.noarch.rpm  > output.txt 2>&1
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c "touch" output.txt
 cat "${tf}"
 
@@ -378,7 +378,7 @@ touch -t 201703171717 ${tf}
 runroot rpm -U -Uvv --fsmdebug  --oldpackage \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm  > output.txt 2>&1
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c  "touch" output.txt
 cat "${tf}"
 ],
@@ -449,13 +449,13 @@ readlink "${tf}"
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 readlink "${tf}"
 
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 readlink "${tf}"
 
 ln -sf "xx" "${tf}"
@@ -464,13 +464,13 @@ readlink "${tf}"
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-4.0-1.noarch.rpm
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 readlink "${tf}"
 
 runroot rpm -U --oldpackage \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 readlink "${tf}"
 ],
 [0],
@@ -494,7 +494,7 @@ readlink "${tf}"
 runroot rpm -Uvv --fsmdebug \
 	--define "_minimize_writes 1" \
 	 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm > output.txt 2>&1
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c "touch" output.txt
 readlink "${tf}"
 
@@ -502,7 +502,7 @@ readlink "${tf}"
 runroot rpm -Uvv --fsmdebug \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm > output.txt 2>&1
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c "touch" output.txt
 readlink "${tf}"
 ln -sf "xx" "${tf}"
@@ -511,14 +511,14 @@ readlink "${tf}"
 runroot rpm -Uvv --fsmdebug \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-4.0-1.noarch.rpm  > output.txt 2>&1
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c "touch" output.txt
 readlink "${tf}"
 
 runroot rpm -U -Uvv --fsmdebug  --oldpackage \
 	--define "_minimize_writes 1" \
 	/build/RPMS/noarch/replacetest-3.0-1.noarch.rpm  > output.txt 2>&1
-runroot rpm -Va  --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 grep -c  "touch" output.txt
 readlink "${tf}"
 ],
@@ -554,17 +554,17 @@ for v in "1.0" "2.0"; do
 done
 
 runroot rpm -U /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 runroot rpm -U \
 	--define "_minimize_writes 1" \
 	 /build/RPMS/noarch/replacetest-2.0-1.noarch.rpm
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 chmod 777 "${tf}"
 runroot rpm -U \
 	--oldpackage \
 	--define "_minimize_writes 1" \
 	 /build/RPMS/noarch/replacetest-1.0-1.noarch.rpm
-runroot rpm -Va --nouser --nogroup replacetest
+runroot rpm -V --nouser --nogroup replacetest
 ],
 [0],
 [],
-- 
2.33.0

