aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs30
1 files changed, 30 insertions, 0 deletions
diff --git a/URPM.xs b/URPM.xs
index 182ebc8..b923648 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -2889,6 +2889,36 @@ Trans_remove(trans, name)
OUTPUT:
RETVAL
+int
+Trans_traverse(trans, callback)
+ URPM::Transaction trans
+ SV *callback
+ PREINIT:
+ rpmdbMatchIterator mi;
+ Header h;
+ int c = 0;
+ CODE:
+ mi = rpmtsInitIterator(trans->ts, RPMDBI_PACKAGES, NULL, 0);
+ while ((h = rpmdbNextIterator(mi))) {
+ if (SvROK(callback)) {
+ dSP;
+ URPM__Package pkg = calloc(1, sizeof(struct s_Package));
+ pkg->flag = FLAG_ID_INVALID | FLAG_NO_HEADER_FREE;
+ pkg->h = h;
+ PUSHMARK(SP);
+ XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "URPM::Package", pkg)));
+ PUTBACK;
+ call_sv(callback, G_DISCARD | G_SCALAR);
+ SPAGAIN;
+ pkg->h = 0; /* avoid using it anymore, in case it has been copied inside callback */
+ }
+ ++c;
+ }
+ rpmdbFreeIterator(mi);
+ RETVAL = c;
+ OUTPUT:
+ RETVAL
+
void
Trans_check(trans, ...)
URPM::Transaction trans