aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--URPM.pm3
-rw-r--r--URPM.xs12
3 files changed, 16 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index a75c538..f9d430d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- add support for "elem" callback
+ (needs rpm >= rpm-4.13.0-0.rc1.28)
+
Version 5.06 - 12 April 2015
- fix upgrade when package's in several media (mga#15350)
diff --git a/URPM.pm b/URPM.pm
index 25c6564..a429f25 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -868,6 +868,7 @@ It's usually the $urpm object.
Recognized options are:
callback_close => sub { ... }
+ callback_elem => sub { ... }
callback_error => sub { ... }
callback_inst => sub { ... }
callback_open => sub { ... }
@@ -893,7 +894,7 @@ C<$cb_type> is one of 'open' or 'close'.
Other Callbacks signature is callback(C<$data>, C<$cb_type>, C<$pkg_id>, C<$subtype>, C<$amout>, C<$total>, C<pkg_name>)
-C<$cb_type> is one of 'error', 'inst', 'trans' or 'uninst'. C<$subtype> can be 'start', 'progress' or 'stop'.
+C<$cb_type> is one of 'elem', 'error', 'inst', 'trans' or 'uninst'. C<$subtype> can be 'start', 'progress' or 'stop'.
For 'error', it can be 'cpio', 'script' or 'unpack'.
The purpose of those callbacks is to report progress (the two last parameters (C<$amount> & C<$total>) enable to compute progress percentage).
diff --git a/URPM.xs b/URPM.xs
index 40e3c46..99af00a 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -70,6 +70,7 @@ struct s_TransactionData {
SV* callback_uninst;
SV* callback_inst;
SV* callback_error;
+ SV* callback_elem;
long min_delta;
SV *data; /* chain with another data user provided */
};
@@ -1257,6 +1258,10 @@ static void *rpmRunTransactions_callback(const void *arg,
callback = td->callback_error;
callback_type = "error";
break;
+ case RPMCALLBACK_ELEM_PROGRESS:
+ callback = td->callback_elem;
+ callback_type = "elem";
+ break;
default:
break;
}
@@ -1288,6 +1293,9 @@ static void *rpmRunTransactions_callback(const void *arg,
case RPMCALLBACK_CPIO_ERROR:
callback_subtype = "cpio";
break;
+ case RPMCALLBACK_ELEM_PROGRESS:
+ callback_subtype = "progress";
+ break;
case RPMCALLBACK_SCRIPT_ERROR:
callback_subtype = "script";
break;
@@ -2680,7 +2688,7 @@ Trans_run(trans, data, ...)
URPM::Transaction trans
SV *data
PREINIT:
- struct s_TransactionData td = { NULL, NULL, NULL, NULL, NULL, NULL, 100000, data };
+ struct s_TransactionData td = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 100000, data };
rpmtransFlags transFlags = RPMTRANS_FLAG_NONE;
int probFilter = 0;
int translate_message = 0, raw_message = 0;
@@ -2729,6 +2737,8 @@ Trans_run(trans, data, ...)
if (SvROK(ST(i+1))) td.callback_open = ST(i+1);
} else if (len == 9+5 && !memcmp(s+9, "close", 5)) {
if (SvROK(ST(i+1))) td.callback_close = ST(i+1);
+ } else if (len == 9+4 && !memcmp(s+9, "elem", 4)) {
+ if (SvROK(ST(i+1))) td.callback_elem = ST(i+1);
} else if (len == 9+5 && !memcmp(s+9, "trans", 5)) {
if (SvROK(ST(i+1))) td.callback_trans = ST(i+1);
} else if (len == 9+6 && !memcmp(s+9, "uninst", 6)) {