|
|
648606 |
From 08473f4ad8d79e6d232832c6863b2848f8a41734 Mon Sep 17 00:00:00 2001
|
|
|
648606 |
From: Michal Domonkos <mdomonko@redhat.com>
|
|
|
648606 |
Date: Mon, 7 Dec 2015 17:13:26 +0100
|
|
|
648606 |
Subject: [PATCH] Add RPMCALLBACK_ELEM_PROGRESS callback type
|
|
|
648606 |
|
|
|
648606 |
Currently, there's no callback type that would be issued per each
|
|
|
648606 |
transaction element. RPMCALLBACK_TRANS_PROGRESS is only issued during
|
|
|
648606 |
the prepare phase but not when packages are actually installed or
|
|
|
648606 |
erased. Likewise, RPMCALLBACK_INST_ST* and RPMCALLBACK_UNINST_ST* won't
|
|
|
648606 |
be issued if an install or erase operation is skipped for some reason (a
|
|
|
648606 |
script or package upgrade failure).
|
|
|
648606 |
|
|
|
648606 |
Having such a callback would allow the Python API consumers to always
|
|
|
648606 |
know upfront which element is about to be processed, before any other
|
|
|
648606 |
callbacks are issued. This is important since not every callback type
|
|
|
648606 |
carries enough data about the subject package; while the INST types
|
|
|
648606 |
provide the user object passed to a former addInstall call, the UNINST
|
|
|
648606 |
types only provide the package name (which may not be unique within the
|
|
|
648606 |
transaction set).
|
|
|
648606 |
|
|
|
648606 |
This commit adds such a callback.
|
|
|
648606 |
|
|
|
648606 |
(cherry picked from commit 448db68ceb5be3c7171b7ec0ea908d905792dc2f)
|
|
|
648606 |
---
|
|
|
648606 |
lib/rpmcallback.h | 1 +
|
|
|
648606 |
lib/transaction.c | 4 ++++
|
|
|
648606 |
python/rpmmodule.c | 1 +
|
|
|
648606 |
3 files changed, 6 insertions(+)
|
|
|
648606 |
|
|
|
648606 |
diff --git a/lib/rpmcallback.h b/lib/rpmcallback.h
|
|
|
648606 |
index b3b05c6c1..b6d434c01 100644
|
|
|
648606 |
--- a/lib/rpmcallback.h
|
|
|
648606 |
+++ b/lib/rpmcallback.h
|
|
|
648606 |
@@ -31,6 +31,7 @@ typedef enum rpmCallbackType_e {
|
|
|
648606 |
RPMCALLBACK_SCRIPT_START = (1 << 16),
|
|
|
648606 |
RPMCALLBACK_SCRIPT_STOP = (1 << 17),
|
|
|
648606 |
RPMCALLBACK_INST_STOP = (1 << 18),
|
|
|
648606 |
+ RPMCALLBACK_ELEM_PROGRESS = (1 << 19),
|
|
|
648606 |
} rpmCallbackType;
|
|
|
648606 |
|
|
|
648606 |
/**
|
|
|
648606 |
diff --git a/lib/transaction.c b/lib/transaction.c
|
|
|
648606 |
index 45c30b5ba..1cd9ca674 100644
|
|
|
648606 |
--- a/lib/transaction.c
|
|
|
648606 |
+++ b/lib/transaction.c
|
|
|
648606 |
@@ -1410,12 +1410,16 @@ exit:
|
|
|
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 |
pi = rpmtsiInit(ts);
|
|
|
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 |
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
|
|
|
648606 |
index 04285a63f..fc8115d30 100644
|
|
|
648606 |
--- a/python/rpmmodule.c
|
|
|
648606 |
+++ b/python/rpmmodule.c
|
|
|
648606 |
@@ -459,6 +459,7 @@ static int initModule(PyObject *m)
|
|
|
648606 |
REGISTER_ENUM(RPMCALLBACK_SCRIPT_START);
|
|
|
648606 |
REGISTER_ENUM(RPMCALLBACK_SCRIPT_STOP);
|
|
|
648606 |
REGISTER_ENUM(RPMCALLBACK_INST_STOP);
|
|
|
648606 |
+ REGISTER_ENUM(RPMCALLBACK_ELEM_PROGRESS);
|
|
|
648606 |
|
|
|
648606 |
REGISTER_ENUM(RPMPROB_BADARCH);
|
|
|
648606 |
REGISTER_ENUM(RPMPROB_BADOS);
|
|
|
648606 |
--
|
|
|
648606 |
2.13.2
|
|
|
648606 |
|