aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2018-09-14 10:59:37 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2018-09-14 15:42:25 +0200
commitffd6d10ee61b986340939c364c4a44a64882610d (patch)
treef58f6bbc725d4eaa98aeff1d6ba2bf46f6820158
parent1ef694894b813f69959072fc0acbab285adcbd70 (diff)
downloadperl-URPM-ffd6d10ee61b986340939c364c4a44a64882610d.tar
perl-URPM-ffd6d10ee61b986340939c364c4a44a64882610d.tar.gz
perl-URPM-ffd6d10ee61b986340939c364c4a44a64882610d.tar.bz2
perl-URPM-ffd6d10ee61b986340939c364c4a44a64882610d.tar.xz
perl-URPM-ffd6d10ee61b986340939c364c4a44a64882610d.zip
add support for verify callback when installing
Resolves: mga#15350
-rw-r--r--NEWS2
-rw-r--r--URPM.pm1
-rw-r--r--URPM.xs14
3 files changed, 16 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 28fa12c..bee94cd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- add support for verify callback when installing (mga#15350)
+
Version 5.18 - 25 June 2018
- Don't select an obsolete package to resolve dependencies/conflicts
diff --git a/URPM.pm b/URPM.pm
index 8395372..4e78d94 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -874,6 +874,7 @@ Recognized options are:
callback_open => sub { ... }
callback_trans => sub { ... }
callback_uninst => sub { ... }
+ callback_verify => sub { ... }
delta => used for progress callbacks (trans, uninst, inst)
excludedocs => 0 / 1
force => 0 / 1
diff --git a/URPM.xs b/URPM.xs
index 2d52299..c8d4364 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -72,6 +72,7 @@ struct s_TransactionData {
SV* callback_inst;
SV* callback_error;
SV* callback_elem;
+ SV* callback_verify;
long min_delta;
SV *data; /* chain with another data user provided */
};
@@ -1252,6 +1253,12 @@ static void *rpmRunTransactions_callback(__attribute__((unused)) const void *h,
callback = td->callback_uninst;
callback_type = "uninst";
break;
+ case RPMCALLBACK_VERIFY_START:
+ case RPMCALLBACK_VERIFY_PROGRESS:
+ case RPMCALLBACK_VERIFY_STOP:
+ callback = td->callback_verify;
+ callback_type = "verify";
+ break;
case RPMCALLBACK_INST_START:
case RPMCALLBACK_INST_PROGRESS:
case RPMCALLBACK_INST_STOP:
@@ -1284,12 +1291,14 @@ static void *rpmRunTransactions_callback(__attribute__((unused)) const void *h,
case RPMCALLBACK_INST_START:
case RPMCALLBACK_TRANS_START:
case RPMCALLBACK_UNINST_START:
+ case RPMCALLBACK_VERIFY_START:
callback_subtype = "start";
gettimeofday(&tprev, NULL);
break;
case RPMCALLBACK_INST_PROGRESS:
case RPMCALLBACK_TRANS_PROGRESS:
case RPMCALLBACK_UNINST_PROGRESS:
+ case RPMCALLBACK_VERIFY_PROGRESS:
callback_subtype = "progress";
gettimeofday(&tcurr, NULL);
delta = 1000000 * (tcurr.tv_sec - tprev.tv_sec) + (tcurr.tv_usec - tprev.tv_usec);
@@ -1301,6 +1310,7 @@ static void *rpmRunTransactions_callback(__attribute__((unused)) const void *h,
case RPMCALLBACK_INST_STOP:
case RPMCALLBACK_TRANS_STOP:
case RPMCALLBACK_UNINST_STOP:
+ case RPMCALLBACK_VERIFY_STOP:
callback_subtype = "stop";
break;
case RPMCALLBACK_CPIO_ERROR:
@@ -2690,7 +2700,7 @@ Trans_run(trans, data, ...)
URPM::Transaction trans
SV *data
PREINIT:
- struct s_TransactionData td = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 100000, data };
+ struct s_TransactionData td = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 100000, data };
rpmtransFlags transFlags = RPMTRANS_FLAG_NONE;
int probFilter = 0;
int translate_message = 0, raw_message = 0;
@@ -2745,6 +2755,8 @@ Trans_run(trans, data, ...)
if (SvROK(ST(i+1))) td.callback_trans = ST(i+1);
} else if (len == 9+6 && !memcmp(s+9, "uninst", 6)) {
if (SvROK(ST(i+1))) td.callback_uninst = ST(i+1);
+ } else if (len == 9+6 && !memcmp(s+9, "verify", 6)) {
+ if (SvROK(ST(i+1))) td.callback_verify = ST(i+1);
} else if (len == 9+4 && !memcmp(s+9, "inst", 4)) {
if (SvROK(ST(i+1))) td.callback_inst = ST(i+1);
} else if (len == 9+5 && !memcmp(s+9, "error", 5)) {