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
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 "https://metacpan.org/pod/system">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

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
    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";
  }
   
  ## $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

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
=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

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

386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
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

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.
 
=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

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

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) = @_;
 
        # 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

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

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

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
=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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
=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

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

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'};
  }
   
  ## 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

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;
}
#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

4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
#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

5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
#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

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;
        }
    }
#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

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);
 
#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

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:



( run in 0.720 second using v1.01-cache-2.11-cpan-702932259ff )