ALPM
view release on metacpan or search on metacpan
Packages groups are now simply lists of packages. When you lookup one
specific group then a list is returned. When querying every single
group (i.e. with ALPM::DB's groups method) a list of name/value pairs
is returned to store it into a hash.
* Release 2.01
** Fix tests to work with custom PKGEXT :BUGFIX:
Tests were failing to work when using a different PKGEXT.
** load_pkgfile error changes to croak instead of die :BUGFIX:
A minor problem I found.
* Release 2.00
** Upgrade for Pacman 3.5
Converted to the new libalpm that is distributed with pacman 3.5.
Makefile.PL view on Meta::CPAN
use ExtUtils::MakeMaker;
use warnings;
use strict;
# Avoid useless FAIL reports from CPAN Testers...
require DynaLoader;
unless(DynaLoader::dl_findfile('-lalpm')){
print STDERR "ERROR: pacman/libalpm must be installed to compile ALPM!\n";
exit 0;
}
sub MY::postamble {
return <<'END_MAKE';
ALPM.xs: xs/DB.xs xs/Package.xs xs/Options.xs
END_MAKE
t/00-ALPM.t view on Meta::CPAN
#!/usr/bin/perl
##
# Initialize ALPM then set and check a few options.
# Checks add/remove on what we can.
# Then create the test repositories.
use Test::More;
BEGIN { use_ok('ALPM') };
## I could not hack this into the Makefile so we initialize
## test repositories here so the modules required are
## only needed when running the tests.
if(system 'perl' => 't/preptests.pl'){
die 'failed to initialize our test root/packages/repos';
}
t/00-ALPM.t view on Meta::CPAN
for $i (0 .. $#v){
is $x[$i], $v[$i], "get_$k has same value as set_$k args";
}
next unless($k =~ s/s$//);
is meth("remove_$k", $v[0]), 1, "remove_$k reported success";
@w = meth("get_${k}s");
ok @w == (@v - 1), "$v[0] removed from ${k}s";
}
# TODO: Test SigLevels more in a later test.
is_deeply $alpm->get_defsiglvl, { 'pkg' => 'never', 'db' => 'never' };
if(grep { /signatures/ } @caps){
$siglvl = { 'pkg' => 'optional', 'db' => 'required' };
ok $alpm->set_defsiglvl($siglvl);
is_deeply $alpm->get_defsiglvl, $siglvl;
$siglvl = { 'pkg' => 'never', 'db' => 'optional trustall' };
ok $alpm->set_defsiglvl($siglvl);
is_deeply $alpm->get_defsiglvl, $siglvl;
t/01-Conf.t view on Meta::CPAN
use Test::More;
chomp(my $arch = `uname -m`);
use_ok 'ALPM::Conf';
$conf = ALPM::Conf->new('t/test.conf');
ok $alpm = $conf->parse();
undef $alpm;
ALPM::Conf->import('t/test.conf');
use Test::More;
use ALPM::Conf 't/test.conf';
ok $alpm;
sub checkpkgs
{
my $db = shift;
my $dbname = $db->name;
my %set = map { ($_ => 1) } @_;
for my $p ($db->pkgs){
t/03-Package.t view on Meta::CPAN
use Test::More;
use ALPM::Conf 't/test.conf';
sub pkgpath
{
my($dbname, $pkgname) = @_;
$db = $alpm->db($dbname);
$db->update or die $alpm->err;
my($url) = $db->get_servers;
$pkg = $db->find($pkgname) or die "$dbname/$pkgname package is missing";
$url .= q{/} . $pkg->filename;
t/04-Misc.t view on Meta::CPAN
# Test miscellanious functions.
use Test::More;
use ALPM;
## Test vercmp.
is(ALPM->vercmp('0.1', '0.2'), -1);
is(ALPM->vercmp('0.10', '0.2'), 1);
is(ALPM->vercmp('0.001', '0.1'), 0); # 0's are skipped
is(ALPM->vercmp('0.100', '0.2'), 1); # 100 > 2
## Test find_dbs_satisfier.
require ALPM::Conf;
ALPM::Conf->import('t/test.conf');
$foo = $alpm->find_dbs_satisfier('foo>1.0', $alpm->syncdbs);
ok $foo;
if($foo){
is $foo->db->name, 'upgradetest';
}
## Test find_satisfier.
$p1 = $alpm->db('simpletest')->find('foo');
$p2 = $alpm->db('upgradetest')->find('foo');
ok $p1 && $p2;
if($p1 && $p2){
$p3 = $alpm->find_satisfier('foo>1.0', $p1, $p2);
is $p3->db->name, 'upgradetest';
}
done_testing;
t/05-Callbacks.t view on Meta::CPAN
use Test::More;
use ALPM::Conf 't/test.conf';
ok !defined $alpm->get_logcb;
$cb = sub { print "LOG: @_" };
die 'internal error' unless(ref($cb) eq 'CODE');
$alpm->set_logcb($cb);
$tmp = $alpm->get_logcb($cb);
is ref($tmp), 'CODE';
ok $tmp eq $cb;
( run in 0.319 second using v1.01-cache-2.11-cpan-4d50c553e7e )