ALPM
view release on metacpan
or search on metacpan
Changes
view on Meta::CPAN
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | 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
36 37 38 39 40 41 42 43 44 45 46 47 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 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.
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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | my $alpm = ALPM->new( '/' , '/var/lib/db' );
$alpm ->set_cachedirs( '/var/cache/pacman/pkg' );
$alpm ->set_logfile( '/var/log/pacman.log' );
our $alpm ;
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;
or die $alpm ->strerror;
$extradb ->update or die $alpm ->strerror;
my @perlpkgs = $extradb ->search( 'perl' );
|
lib/ALPM.pod
view on Meta::CPAN
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | print "greater than\n" ;
}
my @syncdbs = $alpm ->syncdbs;
my $found = $alpm ->find_dbs_satisfier( 'findme' , @syncdbs );
$found = $alpm ->find_satisfier( 'findme' , $extradb ->pkgs);
printf "%10s: %s %s\n" , $_ ->db->get_name, $_ ->name,
$_ ->version for $alpm ->search( 'perl' );
my $coredb = $alpm ->db( 'core' );
|
lib/ALPM.pod
view on Meta::CPAN
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
lib/ALPM.pod
view on Meta::CPAN
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
lib/ALPM.pod
view on Meta::CPAN
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
lib/ALPM.pod
view on Meta::CPAN
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | This is one of the following strings: error, warning, debug, function, or unknown.
|
lib/ALPM.pod
view on Meta::CPAN
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | |
lib/ALPM/Conf.pm
view on Meta::CPAN
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | sub _nullhooks
{
map { ( $_ => \ &_null ) } @_
}
sub _getdb
{
my ( $dbs , $name ) = @_ ;
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
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | }
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
lib/ALPM/DB.pod
view on Meta::CPAN
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
lib/ALPM/DB.pod
view on Meta::CPAN
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
lib/ALPM/DB/Local.pod
view on Meta::CPAN
lib/ALPM/DB/Sync.pod
view on Meta::CPAN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
lib/ALPM/Package.pod
view on Meta::CPAN
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | for my $f (@{ $perlpkg ->files}){
printf "\t%s %o %d\n" , $f ->{ 'name' }, $f ->{ 'mode' }, $f ->{ 'size' };
}
print "$name is licensed under: @{$perlpkg->licenses}" ;
|
ppport.h
view on Meta::CPAN
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | 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
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | 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
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 | 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
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 | 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
4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 | PL_hints = oldhints;
PL_curcop->cop_stash = old_cop_stash;
PL_curstash = old_curstash;
PL_curcop->cop_line = oldline;
}
/*
* 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.
* 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.
*/
defined (PERL_CAPI) || defined (PERL_IMPLICIT_CONTEXT)
/* 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. */
/* Fetches the SV that keeps the per-interpreter data. */
SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
SV *my_cxt_sv = *hv_fetch (PL_modglobal, MY_CXT_KEY, \
sizeof(MY_CXT_KEY)-1, TRUE)
/* This declaration should be used within all functions that use the * interpreter- local data. */
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.) */
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 */
/* Judicious use of these macros can reduce the number of times dMY_CXT * is used. Use is similar to pTHX, aTHX etc. */
/* Clones the per-interpreter data. */
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))
|
ppport.h
view on Meta::CPAN
4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 | ? ((len) ? newSVpv((data), (len)) : newSVpv( "" , 0)) \
: newSV(0))
|
ppport.h
view on Meta::CPAN
5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 | |
ppport.h
view on Meta::CPAN
6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 | if (radix && IN_LOCALE) {
STRLEN len = strlen(radix);
if ( *sp + len <= send && memEQ( *sp , radix, len)) {
*sp += len;
return TRUE;
}
}
/* 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;
}
|
t/repos/repoadd.pl
view on Meta::CPAN
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 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
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | }
/*
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
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | }
/* 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
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 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);
while (L){\
XPUSHs(sv_2mortal(F(L->data)));\
L = alpm_list_next(L);\
}
L = NULL;\
while (I < items){\
L = alpm_list_add(L, (void*)F(ST(I++)));\
}
|
xs/DB.xs
view on Meta::CPAN
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 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:
|