ALPM

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

   I don't think anyone uses this module anyways so I just yanked out
   a bunch of old method aliases I had setup. The following are
   removed from the ALPM class, just use their alternate names.

   |----------------+--------------|
   | Removed Method | "New" Method |
   |----------------+--------------|
   | register_db    | register     |
   | transaction    | trans        |
   | action         | trans        |
   | databases      | dbs          |
   | repodb         | db           |
   |----------------+--------------|

** New Changelog Format
   Ditched the old GNU-style ChangeLog format for an org-mode file. Old
   ChangeLog entries are at the end of the file...

* Previous Releases

2011-03-05  Justin Davis  <juster@cpan.org>

MANIFEST  view on Meta::CPAN

lib/ALPM/DB.pod
lib/ALPM/Package.pod
lib/ALPM.pm
lib/ALPM.pod
ex/ownzors
ex/dangles
ex/lspkg
xs/Options.xs
xs/Package.xs
xs/DB.xs
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)

README  view on Meta::CPAN

ALPM 3.06

INTRODUCTION

This is a perl XS module which provides an interface to the libalpm C library.
libalpm is used by Archlinux (and other distributions) who use pacman as the
package managing program.

Read-only access is provided to the database. All transaction creation logic
was removed from this module. After each major pacman upgrade, and sub-
sequent libalpm API change, I would be forced to rewrite a majority of this
module. After the third or fourth time I decided it was not worth the effort
for a feature possibly no one uses in an obscure perl module no one knows
about.

If you really need transactions why not call pacman with "system" or
backticks? In contrast, complicated queries becomes ugly and convoluted
when calling pacman in shell scripts. With the aid of this module, queries
should instead be possible in the quintessential ugly and succinct perl form.

lib/ALPM.pod  view on Meta::CPAN

  use ALPM;
  my $alpm = ALPM->new('/', '/var/lib/db'); # root and dbpath
  $alpm->set_cachedirs('/var/cache/pacman/pkg');
  $alpm->set_logfile('/var/log/pacman.log');
  
  ## Or use ALPM::Conf, a handy module for pacman.conf parsing.
  use ALPM::Conf qw(/etc/pacman.conf);
  ## ALPM::Conf loads an object into "our" package variable.
  our $alpm;
  
  ## Querying databases & packages
  my $localdb = $alpm->localdb;
  my $pkg = $localdb->find('perl') or die 'wtfbbq';
  printf "%s %s %s %d\n", $pkg->name, $pkg->version,
      $pkg->arch, $pkg->size;
  
  my $extradb = $alpm->register('extra') or die $alpm->strerror;
  $extradb->add_mirror('ftp://ftp.archlinux.org/extra/os/i686')
      or die $alpm->strerror;
  $extradb->update or die $alpm->strerror;
  my @perlpkgs = $extradb->search('perl');

lib/ALPM.pod  view on Meta::CPAN

  	print "greater than\n";
  }
  
  ## $found is undef or the package object for findme.
  my @syncdbs = $alpm->syncdbs;
  my $found = $alpm->find_dbs_satisfier('findme', @syncdbs);
  $found = $alpm->find_satisfier('findme', $extradb->pkgs);
  
  ## These are perl wrappers around localdb and syncdbs:
  
  ## Search all databases/repos (includes localdb).
  printf "%10s: %s %s\n", $_->db->get_name, $_->name,
  	$_->version for $alpm->search('perl');
  
  ## Find a database by name of repository.
  my $coredb = $alpm->db('core');

=head1 DESCRIPTION

Archlinux uses a package manager called pacman.  Pacman internally
uses the alpm library for handling its database of packages.  This
module creates a perlish object-oriented interface to the libalpm C library.

In the past this module implemented transactions as well, allowing you
to modify the system/database. This is no longer implemented because
I grew tired of rewriting this module every time the pacman API was
changed.

=head1 CLASS METHODS

=head2 new

  $OBJ = ALPM->new($ROOTDIR, $DBDIR);

=over 4

=item C<$ROOTDIR>

The root directory for all deployed packages managed by libalpm.

=item C<$DBDIR>

The database directory where the local database and sync databases are kept.

=item C<$OBJ>

An ALPM object which is used for all other method calls. This is referenced in
the object method definitions below.

=back

=head2 version

lib/ALPM.pod  view on Meta::CPAN

=item nls

Foreign language support.

=item downloader

If libcurl is installed then a downloader is embedded.

=item signatures

If gpgme is installed then package/database signatures are supported.

=back

=back

=head1 ALPM OBJECT METHODS

These methods can be used with ALPM objects created from the "new" method
above. In the following methods, C<$OBJ> represents an ALPM object.

lib/ALPM.pod  view on Meta::CPAN

=item C<$DB>

An L<ALPM::DB::Local> object.

=back

=head2 register

  $DB | undef = $OBJ->register($NAME, $SIGLEVEL?)

Registers a remote synchronizable database.

=over 4

=item C<$NAME>

The name to use for the database (e.g. core, extra, community.)

=item C<$SIGLEVEL> I<(Optional>)

The signature level to use for the database, including the database file and each
package file downloaded from the database mirror. If none is specified, then the
signature level is set to C<'default'> which is equivalent to the signature level set with
the I<set_defsiglvl> method.

=item C<$DB>

On success, an L<ALPM::DB::Sync> object.

=item C<undef>

On failure. Check L</strerror>.

=back

=head2 syncdbs

  @DBS = $OBJ->syncdbs()

Retrieve a list of sync databases that have previously been registered.

=over 4

=item C<@DBS>

A list of L<ALPM::DB::Sync> objects.

=back

=head2 unregister_all

  1 | undef = $OBJ->unregister_all()

Unregisters all sync databases. If you try to use previously registered
L<ALPM::DB::Sync> objects, they will probable cause a segfault...

Returns 1 on success or undef on error. Check L</strerror> on error.

=head1 ALPM OPTIONS

ALPM has a number of options corresponding to the
C<alpm_option_get_...> and C<alpm_option_set...> C functions in the
library.  Options which take multiple values (hint: they have a plural
name) accept multiple arguments in the corresponding methods.

lib/ALPM.pod  view on Meta::CPAN

You're welcome.

=back

=head2 Read-only options

=over

=item B<root> - path to the installation root

=item B<dbpath> - path to the database

=item B<lockfile> - path to the lockfile

=back

  * = the option is set with (and gets you) a list

=head2 Callback options

Callbacks can only be set to code references.

lib/ALPM.pod  view on Meta::CPAN

This is one of the following strings: error, warning, debug, function, or unknown.

=item 2. message

This is the message itself.

=back

=head1 DATA TYPES

Several libalpm data types have been converted into hash references. The
alternative is to turn them into full-blown objects, which seems pointless
considering the only methods are data accessors.

=head2 Dependency

Dependencies specify constraints on a set of packages. Only certain packages
satisfy a dependency. These can be used in places other than dependencies,
such as conflicts. Dependencies have the following keys:

=over 4

=item name

lib/ALPM.pod  view on Meta::CPAN


=item reason

A hashref that is identical to a dependency. See L</Dependency>.

=back

=head2 Signature Level

Signature levels describe the level of security which is required for packages files
and by databases files. Different degrees of signature checking can be used for
either type of file. The signature checking is performed after the file is downloaded
in order to verify the original packager. B<When gpg is not available an invalid argument
error will be raised from libalpm if you try to set the siglevel.>

A "siglvl" can either be the string C<"default"> or a hash reference. A value of C<"default">
can be used when registering a database to instruct libalpm to use the default siglevel
that is set by I<set_defsiglvl>. A siglvl hashref must contain a C<"pkg"> key
and a C<"db"> key. Other keys are ignored.

Possible hash values include:

=over 4

=item C<"never">

No signature verification is performed.

lib/ALPM/Conf.pm  view on Meta::CPAN


sub _nullhooks
{
	map { ($_ => \&_null) } @_
}

sub _getdb
{
	my($dbs, $name) = @_;

	# The order databases are added must be preserved as must the order of URLs.
	for my $db (@$dbs){
		return $db if($db->{'name'} eq $name);
	}
	my $new = { 'name' => $name };
	push @$dbs, $new;
	return $new;
}

sub _setsiglvl
{

lib/ALPM/Conf.pm  view on Meta::CPAN

	}

	my $usesl = grep { /signatures/ } $alpm->caps;
	for my $db (@$dbs){
		my($r, $sl, $mirs) = @{$db}{'name', 'siglvl', 'mirrors'};
		next if(!@$mirs);

		_expurls($mirs, $opts->{'arch'}, $r);
		$sl = 'default' if(!$usesl);
		my $x = $alpm->register($r, $sl)
			or die "Failed to register $r database: " . $alpm->strerror;
		$x->add_server($_) for(@$mirs);
	}
	return $alpm;
}

sub parse
{
	my($self) = @_;

	my (%opts, @dbs, $currsect, $defsiglvl);

lib/ALPM/DB.pod  view on Meta::CPAN

=head1 NAME

ALPM::DB - Database base class, inherited by local and sync databases.

=head1 SYNOPSIS

  use ALPM::Conf qw(/etc/pacman.conf);
  my $db = $alpm->localdb;
  printf "Playing with %s database\n", $db->name;
  my $perl = $db->find('perl') or die 'where is perl';
  
  $db = $alpm->register('community') or die;
  $db->add_server('ftp://ftp.archlinux.org/community/os/i686') or die;
  
  for my $pkg ($db->search('perl')){
      printf "%s\t%s\n", $pkg->name, $pkg->version;
  }
  
  for my $pkg ($db->find_group('xfce4')){

lib/ALPM/DB.pod  view on Meta::CPAN

=head1 OBJECT METHODS

=head2 name

  $NAME = $DB->name()

=over 4

=item C<$NAME>

The previously assigned name of the database or 'local' for the local database.

=back

=head2 pkgs

  @PKGS = $DB->pkgs()

=over 4

=item C<@PKGS>

A list of packages in the package cache for this database.

=back

=head2 find

  $PKGS | undef = $DB->find($NAME)

=over 4

=item C<$NAME>

lib/ALPM/DB.pod  view on Meta::CPAN

=back

=head2 groups

  %GROUPS = $DB->groups()

=over 4

=item C<%GROUPS>

A hash (name/value pairs) of groups contained within the database. Each group
name is followed by an arrayref of L<ALPM::Package> objects. This may be empty.

=back

=head2 find_group

  @PKGS = $DB->find_group($NAME)

=over 4

lib/ALPM/DB/Local.pod  view on Meta::CPAN

=pod

=head1 NAME

ALPM::DB::Local - Machine-local package database.

=head1 SYNOPSIS

  $db = $alpm->localdb;
  $pkg = $db->find('perl');
  $db->set_install_reason($pkg, 'implicit') or die $alpm->strerror;

=head1 OBJECT METHODS

This is a subclass of I<ALPM::DB> and inherits all of its methods.

lib/ALPM/DB/Sync.pod  view on Meta::CPAN

=pod

=head1 NAME

ALPM::DB::Sync - Synchronized remote databases.

=head1 OBJECT METHODS

=head2 servers

  $SUCCESS = $DB->add_server($URL)
  $SUCCESS = $DB->remove_server($URL)
  $SUCCESS = $DB->set_servers(@URLS)
  @URLS = $DB->get_servers()

A plethora of accessors and mutators for the repo URLs of databases.

=over 4

=item C<$URL>

The base url where database files are publicly available.

=item C<@URLS>

Like $URL, only more so.

=item C<$SUCCESS>

Returns 1 on success, undef on failure.

=back

=head2 update

  $UPDATE_STATUS = $DB->update()
  $SUCCESS = $DB->force_update()

Updating the database is like pacman -Su. Forcing an update will download a new
copy of the database even if it seems that we do not need to.

=over 4

=item C<$UPDATE_STATUS>

Returns 1 on success, -1 if the update was unnecessary, or 0 on error.

=item C<SUCCESS>

Returns 1 on success or 0 on error.

=back

=head1 valid

  $VALID = $DB->valid()

Perform validity checks upon the database, such as a signature check.

=head1 siglvl

  $SIGLEVEL = $DB->siglvl()

Retrieve the signature level requirements that package and database files of this database
must fulfill.

=head1 unregister

  $SUCCESS = $DB->unregister()

Unregister the sync database. You probably shouldn't try to use the $DB object
anymore. Right now there are no safety checks.

=over 4

=item C<$SUCCESS>

Returns 1 on success or undef on error.

=back

lib/ALPM/Package.pod  view on Meta::CPAN

  for my $f (@{$perlpkg->files}){
      printf "\t%s %o %d\n", $f->{'name'}, $f->{'mode'}, $f->{'size'};
  }
  
  ## Others lists are arrayrefs of scalars:
  print "$name is licensed under: @{$perlpkg->licenses}";

=head1 DESCRIPTION

This class is a wrapper for all of the C<alpm_pkg_...> C library functions
of libalpm.  You retrieve the package from the database and you can then
access its information.

=head1 ACCESSORS

The accessors are named almost exactly the same as the C<alpm_pkg_get...>
functions. I have removed the get_ prefix on the accessors.  This is
because you can't really I<set> anything so you should know it's a get
anyways.

=over

ppport.h  view on Meta::CPAN

PERL_MAGIC_glob|5.011000||p
PERL_MAGIC_isaelem|5.007002||p
PERL_MAGIC_isa|5.007002||p
PERL_MAGIC_mutex|5.011000||p
PERL_MAGIC_nkeys|5.007002||p
PERL_MAGIC_overload_elem|5.007002||p
PERL_MAGIC_overload_table|5.007002||p
PERL_MAGIC_overload|5.007002||p
PERL_MAGIC_pos|5.007002||p
PERL_MAGIC_qr|5.007002||p
PERL_MAGIC_regdata|5.007002||p
PERL_MAGIC_regdatum|5.007002||p
PERL_MAGIC_regex_global|5.007002||p
PERL_MAGIC_shared_scalar|5.007003||p
PERL_MAGIC_shared|5.007003||p
PERL_MAGIC_sigelem|5.007002||p
PERL_MAGIC_sig|5.007002||p
PERL_MAGIC_substr|5.007002||p
PERL_MAGIC_sv|5.007002||p
PERL_MAGIC_taint|5.007002||p
PERL_MAGIC_tiedelem|5.007002||p

ppport.h  view on Meta::CPAN

ZeroD|5.009002||p
Zero|||
_aMY_CXT|5.007003||p
_pMY_CXT|5.007003||p
aMY_CXT_|5.007003||p
aMY_CXT|5.007003||p
aTHXR_|5.011000||p
aTHXR|5.011000||p
aTHX_|5.006000||p
aTHX|5.006000||p
add_data|||n
addmad|||
allocmy|||
amagic_call|||
amagic_cmp_locale|||
amagic_cmp|||
amagic_i_ncmp|||
amagic_ncmp|||
any_dup|||
ao|||
append_elem|||

ppport.h  view on Meta::CPAN

magic_getsubstr|||
magic_gettaint|||
magic_getuvar|||
magic_getvec|||
magic_get|||
magic_killbackrefs|||
magic_len|||
magic_methcall|||
magic_methpack|||
magic_nextpack|||
magic_regdata_cnt|||
magic_regdatum_get|||
magic_regdatum_set|||
magic_scalarpack|||
magic_set_all_env|||
magic_setamagic|||
magic_setarylen|||
magic_setcollxfrm|||
magic_setdbline|||
magic_setdefelem|||
magic_setenv|||

ppport.h  view on Meta::CPAN

missingterm|||
mode_from_discipline|||
modkids|||
mod|||
more_bodies|||
more_sv|||
moreswitches|||
mro_get_from_name||5.011000|
mro_get_linear_isa_dfs|||
mro_get_linear_isa||5.009005|
mro_get_private_data||5.011000|
mro_isa_changed_in|||
mro_meta_dup|||
mro_meta_init|||
mro_method_changed_in||5.009005|
mro_register||5.011000|
mro_set_mro||5.011000|
mro_set_private_data||5.011000|
mul128|||
mulexp10|||n
my_atof2||5.007002|
my_atof||5.006000|
my_attrs|||
my_bcopy|||n
my_betoh16|||n
my_betoh32|||n
my_betoh64|||n
my_betohi|||n

ppport.h  view on Meta::CPAN

	PL_hints = oldhints;
	PL_curcop->cop_stash = old_cop_stash;
	PL_curstash = old_curstash;
	PL_curcop->cop_line = oldline;
}
#endif
#endif

/*
 * Boilerplate macros for initializing and accessing interpreter-local
 * data from C.  All statics in extensions should be reworked to use
 * this, if you want to make the extension thread-safe.  See ext/re/re.xs
 * for an example of the use of these macros.
 *
 * Code that uses these macros is responsible for the following:
 * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
 * 2. Declare a typedef named my_cxt_t that is a structure that contains
 *    all the data that needs to be interpreter-local.
 * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
 * 4. Use the MY_CXT_INIT macro such that it is called exactly once
 *    (typically put in the BOOT: section).
 * 5. Use the members of the my_cxt_t structure everywhere as
 *    MY_CXT.member.
 * 6. Use the dMY_CXT macro (a declaration) in all the functions that
 *    access MY_CXT.
 */

#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
    defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)

#ifndef START_MY_CXT

/* This must appear in all extensions that define a my_cxt_t structure,
 * right after the definition (i.e. at file scope).  The non-threads
 * case below uses it to declare the data as static. */
#define START_MY_CXT

#if (PERL_BCDVERSION < 0x5004068)
/* Fetches the SV that keeps the per-interpreter data. */
#define dMY_CXT_SV \
	SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
#else /* >= perl5.004_68 */
#define dMY_CXT_SV \
	SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,		\
				  sizeof(MY_CXT_KEY)-1, TRUE)
#endif /* < perl5.004_68 */

/* This declaration should be used within all functions that use the
 * interpreter-local data. */
#define dMY_CXT	\
	dMY_CXT_SV;							\
	my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))

/* Creates and zeroes the per-interpreter data.
 * (We allocate my_cxtp in a Perl SV so that it will be released when
 * the interpreter goes away.) */
#define MY_CXT_INIT \
	dMY_CXT_SV;							\
	/* newSV() allocates one more than needed */			\
	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
	Zero(my_cxtp, 1, my_cxt_t);					\
	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))

/* This macro must be used to access members of the my_cxt_t structure.
 * e.g. MYCXT.some_data */
#define MY_CXT		(*my_cxtp)

/* Judicious use of these macros can reduce the number of times dMY_CXT
 * is used.  Use is similar to pTHX, aTHX etc. */
#define pMY_CXT		my_cxt_t *my_cxtp
#define pMY_CXT_	pMY_CXT,
#define _pMY_CXT	,pMY_CXT
#define aMY_CXT		my_cxtp
#define aMY_CXT_	aMY_CXT,
#define _aMY_CXT	,aMY_CXT

#endif /* START_MY_CXT */

#ifndef MY_CXT_CLONE
/* Clones the per-interpreter data. */
#define MY_CXT_CLONE \
	dMY_CXT_SV;							\
	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
	Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\
	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
#endif

#else /* single interpreter */

#ifndef START_MY_CXT

ppport.h  view on Meta::CPAN

#ifndef SvREFCNT_inc_simple_void_NN
#  define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
#endif

#if (PERL_BCDVERSION < 0x5006000)
# define D_PPP_CONSTPV_ARG(x)  ((char *) (x))
#else
# define D_PPP_CONSTPV_ARG(x)  (x)
#endif
#ifndef newSVpvn
#  define newSVpvn(data,len)             ((data)                                              \
                                    ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \
                                    : newSV(0))
#endif
#ifndef newSVpvn_utf8
#  define newSVpvn_utf8(s, len, u)       newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0)
#endif
#ifndef SVf_UTF8
#  define SVf_UTF8                       0
#endif

#ifndef newSVpvn_flags

ppport.h  view on Meta::CPAN

#endif

#ifndef PERL_MAGIC_overload_table
#  define PERL_MAGIC_overload_table      'c'
#endif

#ifndef PERL_MAGIC_bm
#  define PERL_MAGIC_bm                  'B'
#endif

#ifndef PERL_MAGIC_regdata
#  define PERL_MAGIC_regdata             'D'
#endif

#ifndef PERL_MAGIC_regdatum
#  define PERL_MAGIC_regdatum            'd'
#endif

#ifndef PERL_MAGIC_env
#  define PERL_MAGIC_env                 'E'
#endif

ppport.h  view on Meta::CPAN

    if (radix && IN_LOCALE) {
        STRLEN len = strlen(radix);
        if (*sp + len <= send && memEQ(*sp, radix, len)) {
            *sp += len;
            return TRUE;
        }
    }
#endif
#endif /* USE_LOCALE_NUMERIC */
    /* always try "." if numeric radix didn't match because
     * we may have data from different locales mixed */
    if (*sp < send && **sp == '.') {
        ++*sp;
        return TRUE;
    }
    return FALSE;
}
#endif
#endif

#ifndef grok_number

t/repos/repoadd.pl  view on Meta::CPAN


sub fromPath
{
	my $self = bless {}, shift;
	$self->{'dir'} = shift;
	$self;
}

sub writeFile
{
	my($self, $path, $data) = @_;

	open my $of, '>', $path or die "open: $!";
	while(my($k, $v) = each %$data){
		my $str = join "\n", @$v;
		my $uck = uc $k;
		print $of "%$uck%\n$str\n\n";
	}
	close $of or die "close: $!";
	$self;
}

sub addEntry
{

types.c  view on Meta::CPAN

}

/*
This deals with only raw bits, which is bad form, but I prefer the design.
If the alpm_siglevel_t bitflag enum was not so strange, I wouldn't have
chosen to do this.

The bit flags are separated into two halves with a special case of the
"default value" where bit 32 (the MSB) is on. Reading from LSB to MSB,
the package flags consist of the first four bits. 6 unused bits follow.
The database flags consist of the next four bits. 17 unused bits follow.
Finally, the bit flag for ALPM_USE_DEFAULT is the MSB.

Here is the form of the package and database bitmask. Remember the
database flags are shifted to the left by 10 places.

BIT	DESCRIPTION
1	Signature checking is enabled for packages or databases respectively.
2	Signature checking is optional, used only when available.
3	MARGINAL_OK?
4	UNKNOWN_OK?

A setting of TrustAll in pacman.conf enables MARGINAL_OK and UNKNOWN_OK.
These two flags are not enabled separately from one another.

ALPM_SIG_USE_DEFAULT is the default value when set_default_siglevel is never
called but I have no idea what that could mean when this is the value of the default.
This seems to be a circular argument with no end.

types.c  view on Meta::CPAN

}

/* LIST CONVERSIONS */

AV *
list2av(alpm_list_t *L, scalarmap F)
{
	AV *av;
	av = newAV();
	while(L){
		av_push(av, F(L->data));
		L = alpm_list_next(L);
	}
	return av;
}

alpm_list_t *
av2list(AV *A, listmap F)
{
	alpm_list_t *L;
	int i;

types.h  view on Meta::CPAN

SV* c2p_pkgfrom(alpm_pkgfrom_t);
SV* c2p_pkgvalidation(alpm_pkgvalidation_t);

/* LIST CONVERTER FUNC PROTOS */

AV* list2av(alpm_list_t*, scalarmap);
alpm_list_t* av2list(AV*, listmap);

#define LIST2STACK(L, F)\
	while(L){\
		XPUSHs(sv_2mortal(F(L->data)));\
		L = alpm_list_next(L);\
	}

#define STACK2LIST(I, L, F)\
	L = NULL;\
	while(I < items){\
		L = alpm_list_add(L, (void*)F(ST(I++)));\
	}

#define ZAPLIST(L, F)\

xs/DB.xs  view on Meta::CPAN

void
groups(db)
	ALPM_DB db
 PREINIT:
	alpm_list_t *grps;
	alpm_group_t *grp;
	AV *pkgarr;
 PPCODE:
	grps = alpm_db_get_groupcache(db);
	while(grps){
		grp = grps->data;
		XPUSHs(sv_2mortal(newSVpv(grp->name, strlen(grp->name))));
		pkgarr = list2av(grp->packages, c2p_pkg);
		XPUSHs(sv_2mortal(newRV_noinc((SV*)pkgarr)));
		grps = alpm_list_next(grps);
	}

const char *
name(db)
	ALPM_DB db
 CODE:



( run in 1.316 second using v1.01-cache-2.11-cpan-49f99fa48dc )