RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Olivier Thauvin Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: rpm Date: 06-Aug-2007 00:14:13 Branch: HEAD Handle: 2007080523141201 Added files: rpm/perl RPM_PackageIterator.xs rpm/perl/RPM PackageIterator.pm Log: - return of perl class RPM::PackageIterator Summary: Revision Changes Path 1.1 +6 -0 rpm/perl/RPM/PackageIterator.pm 1.1 +85 -0 rpm/perl/RPM_PackageIterator.xs ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/perl/RPM/PackageIterator.pm ============================================================================ $ cvs diff -u -r0 -r1.1 PackageIterator.pm --- /dev/null 2007-08-06 00:11:00 +0200 +++ PackageIterator.pm 2007-08-06 00:14:13 +0200 @@ -0,0 +1,6 @@ +package RPM::PackageIterator; + +use strict; +use RPM; + +1; @@ . patch -p0 <<'@@ .' Index: rpm/perl/RPM_PackageIterator.xs ============================================================================ $ cvs diff -u -r0 -r1.1 RPM_PackageIterator.xs --- /dev/null 2007-08-06 00:11:00 +0200 +++ RPM_PackageIterator.xs 2007-08-06 00:14:13 +0200 @@ -0,0 +1,85 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#undef Fflush +#undef Mkdir +#undef Stat + +#include <stdio.h> +#include <string.h> +#include <utime.h> +#include "rpmlib.h" +#include <rpmio.h> +#include "rpmcli.h" + +#include "rpmts.h" +#include "rpmte.h" + +#include "header.h" +#include "rpmdb.h" +#include "misc.h" + +#include "rpmxs.h" + +MODULE = RPM::PackageIterator PACKAGE = RPM::PackageIterator + +PROTOTYPES: ENABLE + +void +new(class, sv_tagname = NULL, sv_tagvalue = NULL, keylen = 0) + char * class + SV * sv_tagname + SV * sv_tagvalue + int keylen + PREINIT: + rpmts ts = rpmtsCreate(); + CODE: + _newiterator(ts, sv_tagname, sv_tagvalue, keylen); + SPAGAIN; + ts = rpmtsFree(ts); + +void +prune(mi, ...) + rpmdbMatchIterator mi + PREINIT: + int * exclude = NULL; + int exclude_count = 0; + int i = 0; + CODE: + exclude_count = items - 1; + exclude = malloc(exclude_count * sizeof(int)); + for (i = 1; i < items; i++) { + if (!SvIOK(ST(i))) { /* TODO: */ } + exclude[i - 1] = SvIV(ST(i)); + } + rpmdbPruneIterator(mi, exclude, exclude_count, 0); + _free(exclude); + +unsigned int +getoffset(mi) + rpmdbMatchIterator mi + CODE: + RETVAL = rpmdbGetIteratorOffset(mi); + OUTPUT: + RETVAL + +int +count(mi) + rpmdbMatchIterator mi + CODE: + RETVAL = rpmdbGetIteratorCount(mi); + OUTPUT: + RETVAL + +void +next(mi) + rpmdbMatchIterator mi + PREINIT: + Header header = NULL; + PPCODE: + header = rpmdbNextIterator(mi); + if (header) { + XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), "RPM::Header", headerLink(header)))); + } + @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org