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/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/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

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.

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:

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.291 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )