teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame SOURCES/rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch

648606
Move RPMCALLBACK_ELEM_PROGRESS to rpmteProcess to have header available
648606
648606
The header of the rpmte is only available after rpmteOpen().
648606
Added num param to rpmteProcess to be able to signal the progress to the
648606
callback.
648606
648606
(cherry picked from commit 124ed29259b05fdf574d5e3e145bc1201b24ae4d)
648606
---
648606
diff -uNr rpm-4.11.3.orig/lib/rpmte.c rpm-4.11.3/lib/rpmte.c
648606
--- rpm-4.11.3.orig/lib/rpmte.c	2017-08-23 15:39:18.195927789 +0200
648606
+++ rpm-4.11.3/lib/rpmte.c	2017-08-23 15:40:12.857349575 +0200
648606
@@ -939,7 +939,7 @@
648606
     return rc;
648606
 }
648606
 
648606
-int rpmteProcess(rpmte te, pkgGoal goal)
648606
+int rpmteProcess(rpmte te, pkgGoal goal, int num)
648606
 {
648606
     /* Only install/erase resets pkg file info */
648606
     int scriptstage = (goal != PKG_INSTALL && goal != PKG_ERASE);
648606
@@ -959,6 +959,11 @@
648606
     }
648606
 
648606
     if (rpmteOpen(te, reset_fi)) {
648606
+	if (!scriptstage) {
648606
+	    rpmtsNotify(te->ts, te, RPMCALLBACK_ELEM_PROGRESS, num,
648606
+			rpmtsMembers(te->ts)->orderCount);
648606
+	}
648606
+
648606
 	failed = rpmpsmRun(te->ts, te, goal);
648606
 	rpmteClose(te, reset_fi);
648606
     }
648606
diff -uNr rpm-4.11.3.orig/lib/rpmte_internal.h rpm-4.11.3/lib/rpmte_internal.h
648606
--- rpm-4.11.3.orig/lib/rpmte_internal.h	2013-11-22 11:31:31.000000000 +0100
648606
+++ rpm-4.11.3/lib/rpmte_internal.h	2017-08-23 15:40:24.654440605 +0200
648606
@@ -56,7 +56,7 @@
648606
 FD_t rpmtePayload(rpmte te);
648606
 
648606
 RPM_GNUC_INTERNAL
648606
-int rpmteProcess(rpmte te, pkgGoal goal);
648606
+int rpmteProcess(rpmte te, pkgGoal goal, int num);
648606
 
648606
 RPM_GNUC_INTERNAL
648606
 void rpmteAddProblem(rpmte te, rpmProblemType type,
648606
diff -uNr rpm-4.11.3.orig/lib/transaction.c rpm-4.11.3/lib/transaction.c
648606
--- rpm-4.11.3.orig/lib/transaction.c	2017-08-23 15:39:18.257928268 +0200
648606
+++ rpm-4.11.3/lib/transaction.c	2017-08-23 15:42:24.986369126 +0200
648606
@@ -1170,10 +1170,11 @@
648606
 static int runTransScripts(rpmts ts, pkgGoal goal) 
648606
 {
648606
     int rc = 0;
648606
+    int i = 0;
648606
     rpmte p;
648606
     rpmtsi pi = rpmtsiInit(ts);
648606
     while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
648606
-	rc += rpmteProcess(p, goal);
648606
+	rc += rpmteProcess(p, goal, i++);
648606
     }
648606
     rpmtsiFree(pi);
648606
     return rc;
648606
@@ -1415,7 +1416,6 @@
648606
 static int rpmtsProcess(rpmts ts)
648606
 {
648606
     rpmtsi pi;	rpmte p;
648606
-    tsMembers tsmem = rpmtsMembers(ts);
648606
     int rc = 0;
648606
     int i = 0;
648606
 
648606
@@ -1423,8 +1423,6 @@
648606
     while ((p = rpmtsiNext(pi, 0)) != NULL) {
648606
 	int failed;
648606
 
648606
-	rpmtsNotify(ts, NULL, RPMCALLBACK_ELEM_PROGRESS, i++,
648606
-		tsmem->orderCount);
648606
 	rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
648606
 		rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
648606
 
648606
@@ -1432,7 +1430,7 @@
648606
 	    rpmtsSELabelInit(ts, 0);
648606
 	}
648606
 
648606
-	failed = rpmteProcess(p, rpmteType(p));
648606
+	failed = rpmteProcess(p, rpmteType(p), i++);
648606
 	if (failed) {
648606
 	    rpmlog(RPMLOG_ERR, "%s: %s %s\n", rpmteNEVRA(p),
648606
 		   rpmteTypeString(p), failed > 1 ? _("skipped") : _("failed"));