summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-01-03 11:49:32 +0200
committerPanu Matilainen <pmatilai@redhat.com>2012-01-03 12:12:12 +0200
commit4c022382384f01c73eb5112160c436960e7a74f5 (patch)
tree7664cd6754c7201103958f33e09d7a9aa5f9c7cf
parent59378e52205728f7a78be1b329aa159f72e5686e (diff)
downloadlibrpm-tizen-4c022382384f01c73eb5112160c436960e7a74f5.tar.gz
librpm-tizen-4c022382384f01c73eb5112160c436960e7a74f5.tar.bz2
librpm-tizen-4c022382384f01c73eb5112160c436960e7a74f5.zip
Eliminate pointless rpmcliPackagesTotal fiddling
- The total number of packages equals transaction order count, which is passed as total to transaction start callback. In particular messing with this from rpmtsAddInstallElement() is just stupid. - This will break callers that are relying on rpmcliPackagesTotal value outside a running transaction, but that's just stupid anyway. The correct way to get number of elements in transaction set is calling rpmtsNElements(), which has been there for a good part of a decade.
-rw-r--r--lib/depends.c3
-rw-r--r--lib/rpminstall.c3
2 files changed, 1 insertions, 5 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 6ad97aa60..208aca5de 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -4,8 +4,6 @@
#include "system.h"
-#include <rpm/rpmcli.h> /* XXX rpmcliPackagesTotal */
-
#include <rpm/rpmlib.h> /* rpmVersionCompare, rpmlib provides */
#include <rpm/rpmtag.h>
#include <rpm/rpmlog.h>
@@ -347,7 +345,6 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
tsmem->order[oc] = p;
if (oc == tsmem->orderCount) {
tsmem->orderCount++;
- rpmcliPackagesTotal++;
}
rpmalAdd(tsmem->addedPackages, p);
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 3b64e63ef..6082db026 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -167,6 +167,7 @@ void * rpmShowProgress(const void * arg,
rpmcliHashesCurrent = 0;
rpmcliProgressTotal = 1;
rpmcliProgressCurrent = 0;
+ rpmcliPackagesTotal = total;
if (!(flags & INSTALL_LABEL))
break;
if (flags & INSTALL_HASH)
@@ -381,8 +382,6 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
if (fileArgv == NULL) goto exit;
- rpmcliPackagesTotal = 0;
-
(void) rpmtsSetFlags(ts, ia->transFlags);
relocations = ia->relocations;