summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Festi <ffesti@redhat.com>2016-11-22 09:10:26 +0100
committerPanu Matilainen <pmatilai@redhat.com>2018-03-28 13:26:58 +0300
commit153f39abe3c7673a519be5bb0862f10fad7af4d0 (patch)
treeedfc42a33808f7462a717f765448d030cf0c1a66
parentb1f76f67414e2504a08bec77003ee502319772a9 (diff)
downloadrpm-153f39abe3c7673a519be5bb0862f10fad7af4d0.tar.gz
Move RPMCALLBACK_ELEM_PROGRESS to rpmteProcess to have header available
The header of the rpmte is only available after rpmteOpen(). Added num param to rpmteProcess to be able to signal the progress to the callback. (cherry picked from commit 124ed29259b05fdf574d5e3e145bc1201b24ae4d)
-rw-r--r--lib/rpmte.c7
-rw-r--r--lib/rpmte_internal.h2
-rw-r--r--lib/transaction.c8
3 files changed, 10 insertions, 7 deletions
diff --git a/lib/rpmte.c b/lib/rpmte.c
index 248956cf0..d571d7fd4 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -737,7 +737,7 @@ rpmfs rpmteGetFileStates(rpmte te)
return te->fs;
}
-int rpmteProcess(rpmte te, pkgGoal goal)
+int rpmteProcess(rpmte te, pkgGoal goal, int num)
{
/* Only install/erase resets pkg file info */
int scriptstage = (goal != PKG_INSTALL && goal != PKG_ERASE);
@@ -753,6 +753,11 @@ int rpmteProcess(rpmte te, pkgGoal goal)
}
if (rpmteOpen(te, reset_fi)) {
+ if (!scriptstage) {
+ rpmtsNotify(te->ts, te, RPMCALLBACK_ELEM_PROGRESS, num,
+ rpmtsMembers(te->ts)->orderCount);
+ }
+
failed = rpmpsmRun(te->ts, te, goal);
rpmteClose(te, reset_fi);
}
diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h
index 464f47628..a5a991ec5 100644
--- a/lib/rpmte_internal.h
+++ b/lib/rpmte_internal.h
@@ -58,7 +58,7 @@ RPM_GNUC_INTERNAL
FD_t rpmtePayload(rpmte te);
RPM_GNUC_INTERNAL
-int rpmteProcess(rpmte te, pkgGoal goal);
+int rpmteProcess(rpmte te, pkgGoal goal, int num);
RPM_GNUC_INTERNAL
void rpmteAddProblem(rpmte te, rpmProblemType type,
diff --git a/lib/transaction.c b/lib/transaction.c
index 4f90782ac..31308d10c 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1194,11 +1194,12 @@ static int runTransScripts(rpmts ts, pkgGoal goal)
rpmte p;
rpmtsi pi = rpmtsiInit(ts);
rpmElementTypes types = TR_ADDED;
+ int i = 0;
if (goal == PKG_TRANSFILETRIGGERUN)
types = TR_REMOVED;
while ((p = rpmtsiNext(pi, types)) != NULL) {
- rc += rpmteProcess(p, goal);
+ rc += rpmteProcess(p, goal, i++);
}
rpmtsiFree(pi);
return rc;
@@ -1345,7 +1346,6 @@ exit:
static int rpmtsProcess(rpmts ts)
{
rpmtsi pi; rpmte p;
- tsMembers tsmem = rpmtsMembers(ts);
int rc = 0;
int i = 0;
@@ -1353,12 +1353,10 @@ static int rpmtsProcess(rpmts ts)
while ((p = rpmtsiNext(pi, 0)) != NULL) {
int failed;
- rpmtsNotify(ts, NULL, RPMCALLBACK_ELEM_PROGRESS, i++,
- tsmem->orderCount);
rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
- failed = rpmteProcess(p, rpmteType(p));
+ failed = rpmteProcess(p, rpmteType(p), i++);
if (failed) {
rpmlog(RPMLOG_ERR, "%s: %s %s\n", rpmteNEVRA(p),
rpmteTypeString(p), failed > 1 ? _("skipped") : _("failed"));