teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

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

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