121 lines
3.6 KiB
Diff
121 lines
3.6 KiB
Diff
From d09149df374b0faad1d58843369b461a35ec286b Mon Sep 17 00:00:00 2001
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Wed, 16 Apr 2025 12:16:41 +0300
|
|
Subject: [PATCH 5/5] Revert "Drop redundant argument from rpmcliTransaction()"
|
|
|
|
This reverts commit 99f8997082637889e6ef08c7893d583cfaea2f04.
|
|
|
|
The transaction does know the number of elements alright, but updates
|
|
are tracked as two elements so the exit code on a failed update of one
|
|
package becomes 2 which seems wrong. Just revert the change, it wasn't
|
|
a big cleanup anyhow, the alternative of filtering out update-related
|
|
erasures from the transaction would only be more code.
|
|
|
|
--restore was added in the meanwhile so a plain revert doesn't suffice.
|
|
In the case of --restore the number of elements is always simply the
|
|
elements in transaction so we can just use rpmtsNElements() for that.
|
|
|
|
Backported from commits:
|
|
c1b33879a7284cf311fa68d88f8df54b00a207ac
|
|
7931850da430c6187c3557a0dbecf753bb5be490
|
|
|
|
Fixes: RHEL-87384
|
|
---
|
|
lib/rpminstall.c | 10 +++++-----
|
|
tests/data/SPECS/deptest.spec | 4 +++-
|
|
tests/rpmdeps.at | 14 ++++++++++++++
|
|
3 files changed, 22 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
|
|
index 4c49507db..c7510dabb 100644
|
|
--- a/lib/rpminstall.c
|
|
+++ b/lib/rpminstall.c
|
|
@@ -252,10 +252,10 @@ struct rpmEIU {
|
|
rpmRC rpmrc;
|
|
};
|
|
|
|
-static int rpmcliTransaction(rpmts ts, struct rpmInstallArguments_s * ia)
|
|
+static int rpmcliTransaction(rpmts ts, struct rpmInstallArguments_s * ia,
|
|
+ int numPackages)
|
|
{
|
|
rpmps ps;
|
|
- int numPackages = rpmtsNElements(ts);
|
|
|
|
int rc = 0;
|
|
int stop = 0;
|
|
@@ -650,7 +650,7 @@ restart:
|
|
if (eiu->numFailed) goto exit;
|
|
|
|
if (eiu->numRPMS) {
|
|
- int rc = rpmcliTransaction(ts, ia);
|
|
+ int rc = rpmcliTransaction(ts, ia, eiu->numPkgs);
|
|
if (rc < 0)
|
|
eiu->numFailed += eiu->numRPMS;
|
|
else if (rc > 0)
|
|
@@ -756,7 +756,7 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
|
|
free(qfmt);
|
|
|
|
if (numFailed) goto exit;
|
|
- numFailed = rpmcliTransaction(ts, ia);
|
|
+ numFailed = rpmcliTransaction(ts, ia, numPackages);
|
|
exit:
|
|
rpmtsEmpty(ts);
|
|
rpmtsSetVSFlags(ts, ovsflags);
|
|
@@ -784,7 +784,7 @@ int rpmRestore(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
|
|
|
|
rc = rpmcliArgIter(ts, qva, argv);
|
|
if (rc == 0) {
|
|
- rc = rpmcliTransaction(ts, ia);
|
|
+ rc = rpmcliTransaction(ts, ia, rpmtsNElements(ts));
|
|
}
|
|
|
|
rpmtsEmpty(ts);
|
|
diff --git a/tests/data/SPECS/deptest.spec b/tests/data/SPECS/deptest.spec
|
|
index 164571a40..5a1ecdc55 100644
|
|
--- a/tests/data/SPECS/deptest.spec
|
|
+++ b/tests/data/SPECS/deptest.spec
|
|
@@ -1,5 +1,7 @@
|
|
+%{?!ver:%define ver 1.0}
|
|
+
|
|
Name: deptest-%{pkg}
|
|
-Version: 1.0
|
|
+Version: %{ver}
|
|
Release: 1
|
|
Summary: Testing dependency behavior
|
|
|
|
diff --git a/tests/rpmdeps.at b/tests/rpmdeps.at
|
|
index f839a5fad..fac541325 100644
|
|
--- a/tests/rpmdeps.at
|
|
+++ b/tests/rpmdeps.at
|
|
@@ -17,6 +17,11 @@ runroot rpmbuild --quiet -bb \
|
|
--define "reqs deptest-one" \
|
|
/data/SPECS/deptest.spec
|
|
|
|
+runroot rpmbuild --quiet -bb \
|
|
+ --define "pkg two" \
|
|
+ --define "ver 2.0" \
|
|
+ --define "reqs deptest-one deptest-not" \
|
|
+ /data/SPECS/deptest.spec
|
|
# missing dependency
|
|
RPMTEST_CHECK([
|
|
RPMDB_INIT
|
|
@@ -38,6 +43,15 @@ runroot rpm -U /build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm /build/RPMS/noarc
|
|
[0],
|
|
[],
|
|
[])
|
|
+
|
|
+RPMTEST_CHECK([
|
|
+runroot rpm -U /build/RPMS/noarch/deptest-two-2.0-1.noarch.rpm
|
|
+],
|
|
+[1],
|
|
+[],
|
|
+[error: Failed dependencies:
|
|
+ deptest-not is needed by deptest-two-2.0-1.noarch
|
|
+])
|
|
RPMTEST_CLEANUP
|
|
|
|
# ------------------------------
|
|
--
|
|
2.49.0
|
|
|