ALPM
    
    
  
  
  
view release on metacpan or search on metacpan
that was screwing up the perl stack.
Reported by Radu Andries. Thank you!
* Release 3.01
** set_pkg_reason moved to ALPM::DB::Local and renamed set_install_reason.
The ALPM object method was relocated to the ALPM::DB::Local class and I have
renamed it to set_install_reason. This was prompted by the libalpm function
name change from alpm_db_set_pkgreason to alpm_pkg_set_reason.
** New ALPM::Package accessors.
 - origin
 - validation
 - signature
** New "desc" field in depends hashref.
If a dependency is optional, it contains a "desc" entry in the hash
what this means in libalpm because I never use deltas.
* Release 3.00
** Major rewrite to continue compatibility with Pacman 4.
I rewrote quit a bit of code in order to continue compatibility with the
new pacman 4. This release comes a bit late after pacman 4 but I was
seriously considering not updating this module anymore. I no longer use
ArchLinux as much as I used to. I tried to keep things as backwards
compatible as possible but there were many changes to the API that reflect
libalpm's many API changes.
** ALPM "handle" objects.
The ALPM class now creates objects when an instance of ALPM is
initialized. In libalpm these are called handles. Here they are simply
objects. You will have to change every class method (ALPM->foo) to use
an ALPM object method instead ($alpm->foo). Luckily I decided to use
class methods years ago so this will be less painful.
*** ALPM errors are stored inside handles.
This makes things more difficult for me. Given an ALPM::DB object, if you
call a method on that object and the method fails, I cannot croak an error
message internally because the ALPM handle is not available.
** ALPM::Group is no longer a class.
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.
*** alpm_db_register_local removed
    You don't have to call ALPM->register() to register the local DB.
    ALPM->localdb aka ALPM->get_opt( 'localdb' ).  ALPM::ParseConfig
    no longer takes the 'autoregister' parameter.
*** Transaction functions absorbed into install() and uninstall()
    The two new ALPM::Transaction methods, install and uninstall,
    replace the old sync, pkgfile, remove, and sync_from_db
    methods.
    The new methods take package objects as arguments. The old
    methods took package names as arguments. This reflects the same
    libalpm changes.
** ALPM method aliases removed
   For some reason I made aliases everytime I changed a function name.
   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        |
2009-09-03  Justin Davis  <jrcd83@gmail.com>
	* ALPM.xs: s/alpm_pkg_get_/alpm_pkg_/;
	* lib/ALPM/DB.pm: Renamed get_pkg_cache() to packages().
	* lib/ALPM.pm: Changed methods local_db to localdb, get_sync_dbs
	to syncdbs, get_repo_db to repodb, and added search.
	- Updated to version 3.30 of pacman.  The upgrade changes
	many constants and functions.
	- I have declared war on the get_ named methods.  It seems silly
	to have all these get_ methods when there is no set_ method for
	anything except ALPM options (whose prefix I will keep).
2005-08-05  Justin Davis  <jrcd83@gmail.com>
	0.03
        - Added transaction support with ALPM::Transaction.
	- Implemented callback options to ALPM and also transaction
        callbacks using the transaction() method.
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.
Small utility scripts, like the examples, can also be quickly drawn up. This
is the new goal of the module.
lib/ALPM.pod view on Meta::CPAN
=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>
lib/ALPM/Package.pod view on Meta::CPAN
=item * replaces
=item * files
=item * backup
=item * has_scriptlet
=item * download_size
=item * changelog
=item * requiredby
=item * optionalfor
=item * db
=item * checkmd5sum
=item * origin
=head1 SYNOPSIS
  perl ppport.h [options] [source files]
  Searches current directory for files if no [source files] are given
  --help                      show short help
  --version                   show version
  --patch=file                write one patch file with changes
  --copy=suffix               write changed copies with suffix
  --diff=program              use diff program and options
  --compat-version=version    provide compatibility with Perl version
  --cplusplus                 accept C++ comments
  --quiet                     don't output anything except fatal errors
  --nodiag                    don't show diagnostics
  --nohints                   don't show hints
  --nochanges                 don't suggest changes
  --nofilter                  don't filter input files
  --strip                     strip all script and doc functionality from
                              ppport.h
  --list-provided             list provided API
  --list-unsupported          list unsupported API
  --api-info=name             show Perl API portability information
=head1 COMPATIBILITY
Display a brief usage summary.
=head2 --version
Display the version of F<ppport.h>.
=head2 --patch=I<file>
If this option is given, a single patch file will be created if
any changes are suggested. This requires a working diff program
to be installed on your system.
=head2 --copy=I<suffix>
If this option is given, a copy of each file will be saved with
the given suffix that contains the suggested changes. This does
not require any external programs. Note that this does not
automagially add a dot between the original filename and the
suffix. If you want the dot, you have to include it in the option
argument.
If neither C<--patch> or C<--copy> are given, the default is to
simply print the diffs for each file. This requires either
C<Text::Diff> or a C<diff> program to be installed.
=head2 --diff=I<program>
=head2 --nodiag
Don't output any diagnostic messages. Only portability
alerts will be printed.
=head2 --nohints
Don't output any hints. Hints often contain useful portability
notes. Warnings will still be displayed.
=head2 --nochanges
Don't suggest any changes. Only give diagnostic output and hints
unless these are also deactivated.
=head2 --nofilter
Don't filter the list of input files. By default, files not looking
like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
=head2 --strip
Strip all script and documentation functionality from F<ppport.h>.
    sv_2pvbyte()              NEED_sv_2pvbyte              NEED_sv_2pvbyte_GLOBAL
    sv_catpvf_mg()            NEED_sv_catpvf_mg            NEED_sv_catpvf_mg_GLOBAL
    sv_catpvf_mg_nocontext()  NEED_sv_catpvf_mg_nocontext  NEED_sv_catpvf_mg_nocontext_GLOBAL
    sv_pvn_force_flags()      NEED_sv_pvn_force_flags      NEED_sv_pvn_force_flags_GLOBAL
    sv_setpvf_mg()            NEED_sv_setpvf_mg            NEED_sv_setpvf_mg_GLOBAL
    sv_setpvf_mg_nocontext()  NEED_sv_setpvf_mg_nocontext  NEED_sv_setpvf_mg_nocontext_GLOBAL
    vload_module()            NEED_vload_module            NEED_vload_module_GLOBAL
    vnewSVpvf()               NEED_vnewSVpvf               NEED_vnewSVpvf_GLOBAL
    warner()                  NEED_warner                  NEED_warner_GLOBAL
To avoid namespace conflicts, you can change the namespace of the
explicitly exported functions / variables using the C<DPPP_NAMESPACE>
macro. Just C<#define> the macro before including C<ppport.h>:
    #define DPPP_NAMESPACE MyOwnNamespace_
    #include "ppport.h"
The default namespace is C<DPPP_>.
=back
The good thing is that most of the above can be checked by running
F<ppport.h> on your source code. See the next section for
details.
=head1 EXAMPLES
To verify whether F<ppport.h> is needed for your module, whether you
should make any changes to your code, and whether any special defines
should be used, F<ppport.h> can be run as a Perl script to check your
source code. Simply say:
    perl ppport.h
The result will usually be a list of patches suggesting changes
that should at least be acceptable, if not necessarily the most
efficient solution, or a fix for all possible problems.
If you know that your XS module uses features only available in
newer Perl releases, if you're aware that it uses C++ comments,
and if you want all suggestions as a single patch file, you could
use something like this:
    perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
If you only want your code to be scanned without any suggestions
for changes, use:
    perl ppport.h --nochanges
You can specify a different C<diff> program or options, using
the C<--diff> option:
    perl ppport.h --diff='diff -C 10'
This would output context diffs with 10 lines of context.
If you want to create patched copies of your files instead, use:
# Disable broken TRIE-optimization
BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
my $VERSION = 3.17;
my %opt = (
  quiet     => 0,
  diag      => 1,
  hints     => 1,
  changes   => 1,
  cplusplus => 0,
  filter    => 1,
  strip     => 0,
  version   => 0,
);
my($ppport) = $0 =~ /([\w.]+)$/;
my $LF = '(?:\r\n|[\r\n])';   # line feed
my $HS = "[ \t]";             # horizontal whitespace
# Never use C comments in this file!
my $ccs  = '/'.'*';
my $cce  = '*'.'/';
my $rccs = quotemeta $ccs;
my $rcce = quotemeta $cce;
eval {
  require Getopt::Long;
  Getopt::Long::GetOptions(\%opt, qw(
    help quiet diag! filter! hints! changes! cplusplus strip version
    patch=s copy=s diff=s compat-version=s
    list-provided list-unsupported api-info=s
  )) or usage();
};
if ($@ and grep /^-/, @ARGV) {
  usage() if "@ARGV" =~ /^--?h(?:elp)?$/;
  die "Getopt::Long not found. Please don't use any options.\n";
}
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
  unless (open IN, "<$filename") {
    warn "Unable to read from $filename: $!\n";
    next;
  }
  info("Scanning $filename ...");
  my $c = do { local $/; <IN> };
  close IN;
  my %file = (orig => $c, changes => 0);
  # Temporarily remove C/XS comments and strings from the code
  my @ccom;
  $c =~ s{
    ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]*
    | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* )
  | ( ^$HS*\#[^\r\n]*
    | "[^"\\]*(?:\\.[^"\\]*)*"
    | '[^'\\]*(?:\\.[^'\\]*)*'
  info("=== Analyzing $filename ===");
  my %file = %{$files{$filename}};
  my $func;
  my $c = $file{code};
  my $warnings = 0;
  for $func (sort keys %{$file{uses_Perl}}) {
    if ($API{$func}{varargs}) {
      unless ($API{$func}{nothxarg}) {
        my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))}
                              { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge);
        if ($changes) {
          warning("Doesn't pass interpreter argument aTHX to Perl_$func");
          $file{changes} += $changes;
        }
      }
    }
    else {
      warning("Uses Perl_$func instead of $func");
      $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*}
                                {$func$1(}g);
    }
  }
  for $func (sort keys %{$file{uses_replace}}) {
    warning("Uses $func instead of $replace{$func}");
    $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g);
  }
  for $func (sort keys %{$file{uses_provided}}) {
    if ($file{uses}{$func}) {
      if (exists $file{uses_deps}{$func}) {
        diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}}));
      }
      else {
        diag("Uses $func");
      }
  for $func (sort keys %{$file{needed_static}}) {
    my $message = '';
    if (not exists $file{uses}{$func}) {
      $message = "No need to define NEED_$func if $func is never used";
    }
    elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') {
      $message = "No need to define NEED_$func when already needed globally";
    }
    if ($message) {
      diag($message);
      $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg);
    }
  }
  for $func (sort keys %{$file{needed_global}}) {
    my $message = '';
    if (not exists $global{uses}{$func}) {
      $message = "No need to define NEED_${func}_GLOBAL if $func is never used";
    }
    elsif (exists $file{needs}{$func}) {
      if ($file{needs}{$func} eq 'extern') {
        $message = "No need to define NEED_${func}_GLOBAL when already needed globally";
      }
      elsif ($file{needs}{$func} eq 'static') {
        $message = "No need to define NEED_${func}_GLOBAL when only used in this file";
      }
    }
    if ($message) {
      diag($message);
      $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg);
    }
  }
  $file{needs_inc_ppport} = keys %{$file{uses}};
  if ($file{needs_inc_ppport}) {
    my $pp = '';
    for $func (sort keys %{$file{needs}}) {
      my $type = $file{needs}{$func};
        }
        else {
          diag("File needs $func, adding static request");
        }
        $pp .= "#define NEED_$func$suffix\n";
      }
    }
    if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) {
      $pp = '';
      $file{changes}++;
    }
    unless ($file{has_inc_ppport}) {
      diag("Needs to include '$ppport'");
      $pp .= qq(#include "$ppport"\n)
    }
    if ($pp) {
      $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms)
                     || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m)
                     || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m)
                     || ($c =~ s/^/$pp/);
    }
  }
  else {
    if ($file{has_inc_ppport}) {
      diag("No need to include '$ppport'");
      $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m);
    }
  }
  # put back in our C comments
  my $ix;
  my $cppc = 0;
  my @ccom = @{$file{ccom}};
  for $ix (0 .. $#ccom) {
    if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) {
      $cppc++;
      $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/;
    }
    else {
      $c =~ s/$rccs$ix$rcce/$ccom[$ix]/;
    }
  }
  if ($cppc) {
    my $s = $cppc != 1 ? 's' : '';
    warning("Uses $cppc C++ style comment$s, which is not portable");
  }
  my $s = $warnings != 1 ? 's' : '';
  my $warn = $warnings ? " ($warnings warning$s)" : '';
  info("Analysis completed$warn");
  if ($file{changes}) {
    if (exists $opt{copy}) {
      my $newfile = "$filename$opt{copy}";
      if (-e $newfile) {
        error("'$newfile' already exists, refusing to write copy of '$filename'");
      }
      else {
        local *F;
        if (open F, ">$newfile") {
          info("Writing copy of '$filename' with changes to '$newfile'");
          print F $c;
          close F;
        }
        else {
          error("Cannot open '$newfile' for writing: $!");
        }
      }
    }
    elsif (exists $opt{patch} || $opt{changes}) {
      if (exists $opt{patch}) {
        unless ($patch_opened) {
          if (open PATCH, ">$opt{patch}") {
            $patch_opened = 1;
          }
          else {
            error("Cannot open '$opt{patch}' for writing: $!");
            delete $opt{patch};
            $opt{changes} = 1;
            goto fallback;
          }
        }
        mydiff(\*PATCH, $filename, $c);
      }
      else {
fallback:
        info("Suggested changes:");
        mydiff(\*STDOUT, $filename, $c);
      }
    }
    else {
      my $s = $file{changes} == 1 ? '' : 's';
      info("$file{changes} potentially required change$s detected");
    }
  }
  else {
    info("Looks good");
  }
}
close PATCH if $patch_opened;
exit 0;
yy_parser DPPP_(dummy_PL_parser);
#else
extern yy_parser DPPP_(dummy_PL_parser);
#endif
# endif
/* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */
/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf
 * Do not use this variable unless you know exactly what you're
 * doint. It is internal to the perl parser and may change or even
 * be removed in the future. As of perl 5.9.5, you have to check
 * for (PL_parser != NULL) for this variable to have any effect.
 * An always non-NULL PL_parser dummy is provided for earlier
 * perl versions.
 * If PL_parser is NULL when you try to access this variable, a
 * dummy is being accessed instead and a warning is issued unless
 * you define DPPP_PL_parser_NO_DUMMY_WARNING.
 * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access
 * this variable will croak with a panic message.
 */
t/03-Package.t view on Meta::CPAN
                    conflicts provides deltas replaces
                    files backup };
for my $mname (@methnames) {
    my $method_ref = $ALPM::Package::{$mname};
    ok $method_ref, "$mname is a package method";
    my $result = $method_ref->($pkg);
    ok defined $result, "$mname has a defined value";
}
ok defined $pkg->changelog;
done_testing;
xs/Package.xs view on Meta::CPAN
const char *
signature(pkg)
	ALPM_Package pkg
 CODE:
	RETVAL = alpm_pkg_get_base64_sig(pkg);
 OUTPUT:
	RETVAL
SV *
changelog(pkg)
	ALPM_Package pkg
 PREINIT:
	void *fp;
	char buffer[128];
	size_t bytes_read;
	SV *changelog_txt;
 CODE:
	changelog_txt = newSVpv("", 0);
	RETVAL = changelog_txt;
	fp = alpm_pkg_changelog_open(pkg);
	if(fp){
		while(1){
			bytes_read = alpm_pkg_changelog_read((void *)buffer, 128,
												  pkg, fp);
			/*fprintf(stderr,"DEBUG: read %d bytes of changelog\n", */
			/*		  bytes_read); */
			if(bytes_read == 0) break;
			sv_catpvn(changelog_txt, buffer, bytes_read);
		}
		alpm_pkg_changelog_close(pkg, fp);
	}
 OUTPUT:
	RETVAL
MODULE=ALPM    PACKAGE=ALPM::Package    PREFIX=alpm_pkg_compute_
StringListFree
pkg_compute(pkg)
	ALPM_Package pkg
 INTERFACE:
( run in 0.441 second using v1.01-cache-2.11-cpan-c333fce770f )