ALPM

 view release on metacpan or  search on metacpan

ALPM.xs  view on Meta::CPAN

	enum alpm_caps c;
 PPCODE:
	c = alpm_capabilities();
	if(c & ALPM_CAPABILITY_NLS){
		XPUSHs(sv_2mortal(newSVpv("nls", 0)));
	}	
	if(c & ALPM_CAPABILITY_DOWNLOADER){
		XPUSHs(sv_2mortal(newSVpv("download", 0)));
	}
	if(c & ALPM_CAPABILITY_SIGNATURES){
		XPUSHs(sv_2mortal(newSVpv("signatures", 0)));
	}

const char *
version(class)
	SV * class
 CODE:
	RETVAL = alpm_version();
 OUTPUT:
	RETVAL

Changes  view on Meta::CPAN


** 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
reference representation.

** Delta options were renamed.

The old option "usedelta" was renamed to "deltaratio". You'll have to lookup
what this means in libalpm because I never use deltas.

* Release 3.00

** Major rewrite to continue compatibility with Pacman 4.

Changes  view on Meta::CPAN

2009-10-29  Justin Davis  <jrcd83@gmail.com>

	* 0.4: Released version 0.4

2009-10-08  Justin Davis  <jrcd83@gmail.com>

	* lib/ALPM.pm (transaction): 'flags' are now passed as a string
	of flag names separated by spaces.  Added the sysupgrade
	transaction 'type'.

	* ALPM.xs: Added conv and progress callbacks for transactions.

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.

META.json  view on Meta::CPAN

   },
   "name" : "ALPM",
   "no_index" : {
      "directory" : [
         "t",
         "inc"
      ]
   },
   "prereqs" : {
      "build" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {}
      }
   },
   "release_status" : "stable",
   "resources" : {
      "repository" : {
         "url" : "http://github.com/andrewgregory/perl-alpm"
      }
   },
   "version" : "3.06"
}

META.yml  view on Meta::CPAN

---
abstract: "readonly access to pacman's libalpm."
author:
  - 'Andrew Gregory <apg@cpan.org>'
  - 'Justin Davis <juster at cpan dot org>'
build_requires:
  ExtUtils::MakeMaker: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: ALPM
no_index:
  directory:
    - t
    - inc
requires: {}
resources:
  repository: http://github.com/andrewgregory/perl-alpm
version: '3.06'

Makefile.PL  view on Meta::CPAN

    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
}

my %meta = ('resources' => { 'repository' => 'http://github.com/andrewgregory/perl-alpm' });
WriteMakefile(
	'NAME' => 'ALPM',
	'VERSION_FROM' => 'lib/ALPM.pm',
	'LICENSE' => 'perl',
	'ABSTRACT_FROM' => 'lib/ALPM.pod',
	'AUTHOR' => [
		'Andrew Gregory <apg@cpan.org>',
		'Justin Davis <juster at cpan dot org>'
	],
	'LIBS' => [ '-lalpm' ],

README  view on Meta::CPAN


To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES

This module requires the alpm C library that is included with pacman.
libalpm 9.0.0 included with pacman version 4.2.0 was the latest version
used to build and test this module.

DOCUMENTATION

The online documentation is bundled with this module in the form of POD
files under the lib/ directory. To read a document right now you can run
``perldoc lib/ALPM.pod''. These also display formatted in github and are
published on cpan.org or metacpan.org.

alpm_xs.h  view on Meta::CPAN


/* Code references to use as callbacks. */
extern SV *cb_log_sub;
extern SV *cb_dl_sub;
extern SV *cb_totaldl_sub;
extern SV *cb_fetch_sub;

/* transactions */
extern SV *cb_trans_event_sub;
extern SV *cb_trans_conv_sub;
extern SV *cb_trans_progress_sub;

/* String constants to use for log levels (instead of bitflags) */
extern const char * log_lvl_error;
extern const char * log_lvl_warning;
extern const char * log_lvl_debug;
extern const char * log_lvl_function;
extern const char * log_lvl_unknown;

/* CALLBACKS ****************************************************************/

alpm_xs.h  view on Meta::CPAN

               ? &PL_sv_undef : cb_ ## CBTYPE ## _sub );

void cb_log_wrapper ( alpm_loglevel_t level, const char * format, va_list args );
void cb_dl_wrapper ( const char *filename, off_t xfered, off_t total );
void cb_totaldl_wrapper ( off_t total );
int  cb_fetch_wrapper ( const char *url, const char *localpath, int force );

/* TRANSACTIONS ************************************************************/

/* This macro is used inside alpm_trans_init.
   CB_NAME is one of the transaction callback types (event, conv, progress).

   * [CB_NAME]_sub is the argument to the trans_init XSUB.
   * [CB_NAME]_func is a variable to hold the function pointer to pass
     to the real C ALPM function.
   * cb_trans_[CB_NAME]_wrapper is the name of the C wrapper function which
     calls the perl sub stored in the global variable:
   * cb_trans_[CB_NAME]_sub.
*/
#define UPDATE_TRANS_CALLBACK( CB_NAME )                                \
    if ( SvOK( CB_NAME ## _sub ) ) {                                    \

alpm_xs.h  view on Meta::CPAN

        /* If no event callback was provided for this new transaction,  \
           and an event callback is active, then remove the old callback. */ \
        SvREFCNT_dec( cb_trans_ ## CB_NAME ## _sub );                   \
        cb_trans_ ## CB_NAME ## _sub = NULL;                            \
    }

void cb_trans_event_wrapper ( alpm_transevt_t event,
                              void *arg_one, void *arg_two );
void cb_trans_conv_wrapper ( alpm_transconv_t type,
                             void *arg_one, void *arg_two, void *arg_three,
                             int *result );
void cb_trans_progress_wrapper ( alpm_transprog_t type,
                                 const char * desc,
                                 int item_progress,
                                 size_t total_count,
                                 size_t total_pos );
 
SV * convert_packagelist ( alpm_list_t * package_list );
SV * convert_depend ( alpm_depend_t * depend );
SV * convert_depmissing ( alpm_depissing_t * depmiss );
SV * convert_conflict (alpm_conflict_t  * conflict );
SV * convert_fileconflict ( alpm_fileconflict_t * fileconflict );
SV * convert_trans_errors ( alpm_list_t * errors );

ex/ownzors  view on Meta::CPAN


unless(@ARGV){
    print STDERR "usage: ownzors [file paths]\n";
    exit 2;
}

for my $pkg ($alpm->localdb->pkgs) {
    $who_owns{$_->{'name'}} = $pkg->name for(@{$pkg->files});
}

push @{$results{$who_owns{$_}}}, $_
    for(map { s{\A/}{}; $_ } map { File::Spec->rel2abs($_) } @ARGV);
## Happy A! \o/

if($q){
    print $_, "\n" for(sort keys %results);
    exit 0;
}

for my $pkgname (sort keys %results){
    print $pkgname, "\n", map { "\t/$_\n" } sort @{$results{$pkgname}};
}

lib/ALPM.pod  view on Meta::CPAN

=back

=head2 caps

  @CAPS = ALPM->caps()

=over 4

=item C<@CAPS>

Corresponds to the I<alpm_capabilities> C function. A list of strings, describing
capabilities of libalpm. Any of the following capabilities may or may not be
present:

=over 4

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

=head2 errno

  $ERRNO = $OBJ->errno()

=over 4

=item C<$ERRNO>

The internal libalpm error number. If no error occurs this is zero.

lib/ALPM.pod  view on Meta::CPAN


  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.
Similarly the same options return a list.

=head2 Read-write options

=over

=item B<logfile> - path to the pacman logfile

=item B<arch> - the machine architecture to use

=item B<gpgdir> - path to gpg stuff

=item B<cachedirs>* - paths containing package caches

=item B<noupgrades>* - a list of package names to not upgrade

=item B<noextracts>* - a list of package names to not extract

=item B<assumeinstalled>* - a list of dependencies to assume are satisfied.
The setter methods take either a dependency hash or a string representing
a dependency.  The accessor returns a list of dependency hash references.

=item B<ignorepkgs>* - a list of package names to ignore for upgrade

=item B<ignoregroups>* - a list of groups to ignore for upgrade

=item B<usesyslog> - if true, log to the system log as well

=item B<deltaratio> - accepts a decimal from 0 to 1

lib/ALPM.pod  view on Meta::CPAN

Possible hash values include:

=over 4

=item C<"never">

No signature verification is performed.

=item C<"optional">

Signatures are optional. They are checked if they are available.

=item C<"required">

Signatures are required.

=back

The string C<"trustall">, preceded by a space, can be added to C<"optional"> or
C<"required"> options to specify that signatures from anyone are to be trusted.

Here are some example siglevels:

  $alpm->set_defsiglvl({ 'pkg' => 'never', 'db' => 'never' });
  $alpm->set_defsiglvl({ 'pkg' => 'optional', 'db' => 'required trustall' });
  $alpm->set_defsiglvl({ 'pkg' => 'required', 'db' => 'optional' });

=head1 ERRORS

In previous version of this module, errors were thrown automatically. Since then,
errors are no longer stored in a global variable (like UNIX's errno) but are instead
stored inside of the libalpm handle structure. In order to preserve the old functionality
I will have to either store a copy of the ALPM object inside every other object or use
the internal C representation which I'm technically not supposed to know.

Whatever. I'm too lazy for either of those. What this means for you is you really really
should check for errors yourself. If a method call returns undef you should follow it
up with an "or die". Something like this:

  $db->force_update or die $alpm->strerror;

This is annoying but not unlike most other perl error checking. If you find yourself
calling methods on an undefined value then an error most likely occurred.

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/Conf.pm  view on Meta::CPAN

	}

	my $alpm = ALPM->new($root, $dbpath);

	_setarch($opts);
	while(my ($opt, $val) = each %$opts){
		# The SetOption type in typemap croaks on error, no need to check.
		_setopt($alpm, $opt, $val);
	}

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

lib/ALPM/Conf.pod  view on Meta::CPAN

	% perl -MALPM::Conf=/etc/pacman.conf -e '
	for $p ($alpm->localdb->pkgs){
		print $p->name, " ", $p->version, "\n";
	}
	'

=head1 DESCRIPTION

This class is used to parse the pacman.conf files which are used by ArchLinux's
pacman for config files.  The configuration fields are used to set ALPM options.
A new I<ALPM> object instance is created with corresponding options set.

=head1 CONSTRUCTOR

=head2 new

	$OBJ = ALPM::Conf->new($CONF_PATH);

=over 4

=item C<$CONF_PATH>

lib/ALPM/Conf.pod  view on Meta::CPAN

are the field names (case sensitive) and the values are code references.
When a field is scanned the code reference is called with the entire line
of the field's value as the only argument.

=back

=head1 IMPORT MAGIC

When an import argument is given then special magic is performed. The
argument should be the path to a pacman configuration file to load. This
.conf file is parsed by a newly created I<ALPM::Conf> instance. The result
of the parsing is stored in the importing package's namespace under the
name of the C<$alpm> scalar. See the synopsis for an example. If you are
not familiar, you can give import arguments the following ways:

	# Using use:
	use ALPM::Conf '/etc/pacman.conf';
	
	# Require is more transparent:
	require ALPM::Conf;
	ALPM::Conf->import('/etc/pacman.conf');

ppport.h  view on Meta::CPAN


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>

Manually set the diff program and options to use. The default
is to use C<Text::Diff>, when installed, and output unified
context diffs.

=head2 --compat-version=I<version>

ppport.h  view on Meta::CPAN

=head2 --list-unsupported

Lists the API elements that are known not to be supported by
F<ppport.h> and below which version of Perl they probably
won't be available or work.

=head2 --api-info=I<name>

Show portability information for API elements matching I<name>.
If I<name> is surrounded by slashes, it is interpreted as a regular
expression.

=head1 DESCRIPTION

In order for a Perl extension (XS) module to be as portable as possible
across differing versions of Perl itself, certain steps need to be taken.

=over 4

=item *

ppport.h  view on Meta::CPAN

=item *

You should avoid using deprecated parts of the API. For example, using
global Perl variables without the C<PL_> prefix is deprecated. Also,
some API functions used to have a C<perl_> prefix. Using this form is
also deprecated. You can safely use the supported API, as F<ppport.h>
will provide wrappers for older Perl versions.

=item *

If you use one of a few functions or variables that were not present in
earlier versions of Perl, and that can't be provided using a macro, you
have to explicitly request support for these functions by adding one or
more C<#define>s in your source code before the inclusion of F<ppport.h>.

These functions or variables will be marked C<explicit> in the list shown
by C<--list-provided>.

Depending on whether you module has a single or multiple files that
use such functions or variables, you want either C<static> or global
variants.

ppport.h  view on Meta::CPAN


=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

ppport.h  view on Meta::CPAN


If you want to create patched copies of your files instead, use:

    perl ppport.h --copy=.new

To display portability information for the C<newSVpvn> function,
use:

    perl ppport.h --api-info=newSVpvn

Since the argument to C<--api-info> can be a regular expression,
you can use

    perl ppport.h --api-info=/_nomg$/

to display portability information for all C<_nomg> functions or

    perl ppport.h --api-info=/./

to display information for all known API elements.

ppport.h  view on Meta::CPAN

hv_name_set||5.009003|
hv_notallowed|||
hv_placeholders_get||5.009003|
hv_placeholders_p||5.009003|
hv_placeholders_set||5.009003|
hv_riter_p||5.009003|
hv_riter_set||5.009003|
hv_scalar||5.009001|
hv_store_ent||5.004000|
hv_store_flags||5.008000|
hv_stores|5.009004||p
hv_store|||
hv_undef|||
ibcmp_locale||5.004000|
ibcmp_utf8||5.007003|
ibcmp|||
incline|||
incpush_if_exists|||
incpush_use_sep|||
incpush|||
ingroup|||

ppport.h  view on Meta::CPAN

mg_magical|||
mg_set|||
mg_size||5.005000|
mini_mktime||5.007002|
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|

ppport.h  view on Meta::CPAN

pad_check_dup|||
pad_compname_type|||
pad_findlex|||
pad_findmy|||
pad_fixup_inner_anons|||
pad_free|||
pad_leavemy|||
pad_new|||
pad_peg|||n
pad_push|||
pad_reset|||
pad_setsv|||
pad_sv||5.011000|
pad_swipe|||
pad_tidy|||
pad_undef|||
parse_body|||
parse_unicode_opts|||
parser_dup|||
parser_free|||
path_is_absolute|||n

ppport.h  view on Meta::CPAN

regtail|||
regtry|||
reguni|||
regwhite|||n
reg|||
repeatcpy|||
report_evil_fh|||
report_uninit|||
require_pv||5.006000|
require_tie_mod|||
restore_magic|||
rninstr|||
rsignal_restore|||
rsignal_save|||
rsignal_state||5.004000|
rsignal||5.004000|
run_body|||
run_user_filter|||
runops_debug||5.005000|
runops_standard||5.005000|
rvpv_dup|||
rxres_free|||
rxres_restore|||
rxres_save|||
safesyscalloc||5.006000|n
safesysfree||5.006000|n
safesysmalloc||5.006000|n
safesysrealloc||5.006000|n
same_dirent|||
save_I16||5.004000|
save_I32|||
save_I8||5.006000|
save_adelete||5.011000|
save_aelem||5.004050|

ppport.h  view on Meta::CPAN

strnNE|||
study_chunk|||
sub_crush_depth|||
sublex_done|||
sublex_push|||
sublex_start|||
sv_2bool|||
sv_2cv|||
sv_2io|||
sv_2iuv_common|||
sv_2iuv_non_preserve|||
sv_2iv_flags||5.009001|
sv_2iv|||
sv_2mortal|||
sv_2num|||
sv_2nv|||
sv_2pv_flags|5.007002||p
sv_2pv_nolen|5.006000||p
sv_2pvbyte_nolen|5.006000||p
sv_2pvbyte|5.006000||p
sv_2pvutf8_nolen||5.006000|

ppport.h  view on Meta::CPAN

sv_pvn||5.005000|
sv_pvutf8n_force||5.006000|
sv_pvutf8n||5.006000|
sv_pvutf8||5.006000|
sv_pv||5.006000|
sv_recode_to_utf8||5.007003|
sv_reftype|||
sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.004050||p
sv_setpvf_mg_nocontext|||pvn
sv_setpvf_mg|5.006000|5.004000|pv
sv_setpvf_nocontext|||vn
sv_setpvf||5.004000|v

ppport.h  view on Meta::CPAN

  | "[^"\\]*(?:\\.[^"\\]*)*"
  | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx;
  grep { exists $API{$_} } $code =~ /(\w+)/mg;
}

while (<DATA>) {
  if ($hint) {
    my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings;
    if (m{^\s*\*\s(.*?)\s*$}) {
      for (@{$hint->[1]}) {
        $h->{$_} ||= '';  # suppress warning with older perls
        $h->{$_} .= "$1\n";
      }
    }
    else { undef $hint }
  }

  $hint = [$1, [split /,?\s+/, $2]]
      if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$};

  if ($define) {

ppport.h  view on Meta::CPAN


  for (qw(uses needs uses_todo needed_global needed_static)) {
    for $func (keys %{$file{$_}}) {
      push @{$global{$_}{$func}}, $filename;
    }
  }

  $files{$filename} = \%file;
}

# Globally resolve NEED_'s
my $need;
for $need (keys %{$global{needs}}) {
  if (@{$global{needs}{$need}} > 1) {
    my @targets = @{$global{needs}{$need}};
    my @t = grep $files{$_}{needed_global}{$need}, @targets;
    @targets = @t if @t;
    @t = grep /\.xs$/i, @targets;
    @targets = @t if @t;
    my $target = shift @targets;
    $files{$target}{needs}{$need} = 'global';

ppport.h  view on Meta::CPAN

/* Older perls (<=5.003) lack AvFILLp */
#ifndef AvFILLp
#  define AvFILLp                        AvFILL
#endif
#ifndef ERRSV
#  define ERRSV                          get_sv("@",FALSE)
#endif

/* Hint: gv_stashpvn
 * This function's backport doesn't support the length parameter, but
 * rather ignores it. Portability can only be ensured if the length
 * parameter is used for speed reasons, but the length can always be
 * correctly computed from the string argument.
 */
#ifndef gv_stashpvn
#  define gv_stashpvn(str,len,create)    gv_stashpv(str,create)
#endif

/* Replace: 1 */
#ifndef get_cv
#  define get_cv                         perl_get_cv

ppport.h  view on Meta::CPAN


#ifndef isXDIGIT
#  define isXDIGIT(c)                    isxdigit(c)
#endif

#else
# if (PERL_BCDVERSION < 0x5010000)
/* Hint: isPRINT
 * The implementation in older perl versions includes all of the
 * isSPACE() characters, which is wrong. The version provided by
 * Devel::PPPort always overrides a present buggy version.
 */
#  undef isPRINT
# endif
#ifndef isALNUMC
#  define isALNUMC(c)                    (isALPHA(c) || isDIGIT(c))
#endif

#ifndef isASCII
#  define isASCII(c)                     ((c) <= 127)
#endif

ppport.h  view on Meta::CPAN

#elif defined(NEED_PL_signals_GLOBAL)
U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT;
#else
extern U32 DPPP_(my_PL_signals);
#endif
#define PL_signals DPPP_(my_PL_signals)

#endif

/* Hint: PL_ppaddr
 * Calling an op via PL_ppaddr requires passing a context argument
 * for threaded builds. Since the context argument is different for
 * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will
 * automatically be defined as the correct argument.
 */

#if (PERL_BCDVERSION <= 0x5005005)
/* Replace: 1 */
#  define PL_ppaddr                 ppaddr
#  define PL_no_modify              no_modify
/* Replace: 0 */

ppport.h  view on Meta::CPAN

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

ppport.h  view on Meta::CPAN

  warn("%s", SvPV_nolen(sv));
}

#define warner  Perl_warner

#define Perl_warner_nocontext  Perl_warner

#endif
#endif

/* concatenating with "" ensures that only literal strings are accepted as argument
 * note that STR_WITH_LEN() can't be used as argument to macros or functions that
 * under some configurations might be macros
 */
#ifndef STR_WITH_LEN
#  define STR_WITH_LEN(s)                (s ""), (sizeof(s)-1)
#endif
#ifndef newSVpvs
#  define newSVpvs(str)                  newSVpvn(str "", sizeof(str) - 1)
#endif

ppport.h  view on Meta::CPAN

#endif

#ifndef sv_setpvs
#  define sv_setpvs(sv, str)             sv_setpvn(sv, str "", sizeof(str) - 1)
#endif

#ifndef hv_fetchs
#  define hv_fetchs(hv, key, lval)       hv_fetch(hv, key "", sizeof(key) - 1, lval)
#endif

#ifndef hv_stores
#  define hv_stores(hv, key, val)        hv_store(hv, key "", sizeof(key) - 1, val, 0)
#endif
#ifndef SvGETMAGIC
#  define SvGETMAGIC(x)                  STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
#endif
#ifndef PERL_MAGIC_sv
#  define PERL_MAGIC_sv                  '\0'
#endif

#ifndef PERL_MAGIC_overload
#  define PERL_MAGIC_overload            'A'

ppport.h  view on Meta::CPAN

#endif

/*
 * The grok_* routines have been modified to use warn() instead of
 * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit,
 * which is why the stack variable has been renamed to 'xdigit'.
 */

#ifndef grok_bin
#if defined(NEED_grok_bin)
static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
static
#else
extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
#endif

#ifdef grok_bin
#  undef grok_bin
#endif
#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d)
#define Perl_grok_bin DPPP_(my_grok_bin)

#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
UV
DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
{
    const char *s = start;
    STRLEN len = *len_p;
    UV value = 0;
    NV value_nv = 0;

    const UV max_div_2 = UV_MAX / 2;
    bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
    bool overflowed = FALSE;

    if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
        /* strip off leading b or 0b.
           for compatibility silently suffer "b" and "0b" as valid binary
           numbers. */
        if (len >= 1) {
            if (s[0] == 'b') {
                s++;
                len--;

ppport.h  view on Meta::CPAN

                    value = (value << 1) | (bit - '0');
                    continue;
                }
                /* Bah. We're just overflowed.  */
                warn("Integer overflow in binary number");
                overflowed = TRUE;
                value_nv = (NV) value;
            }
            value_nv *= 2.0;
	    /* If an NV has not enough bits in its mantissa to
	     * represent a UV this summing of small low-order numbers
	     * is a waste of time (because the NV cannot preserve
	     * the low-order bits anyway): we could just remember when
	     * did we overflow and in the end just multiply value_nv by the
	     * right amount. */
            value_nv += (NV)(bit - '0');
            continue;
        }
        if (bit == '_' && len && allow_underscores && (bit = s[1])
            && (bit == '0' || bit == '1'))
	    {
		--len;
		++s;
                goto redo;
	    }
        if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
            warn("Illegal binary digit '%c' ignored", *s);
        break;
    }

ppport.h  view on Meta::CPAN

#endif
	) {
	warn("Binary number > 0b11111111111111111111111111111111 non-portable");
    }
    *len_p = s - start;
    if (!overflowed) {
        *flags = 0;
        return value;
    }
    *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
    if (result)
        *result = value_nv;
    return UV_MAX;
}
#endif
#endif

#ifndef grok_hex
#if defined(NEED_grok_hex)
static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
static
#else
extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
#endif

#ifdef grok_hex
#  undef grok_hex
#endif
#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d)
#define Perl_grok_hex DPPP_(my_grok_hex)

#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
UV
DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
{
    const char *s = start;
    STRLEN len = *len_p;
    UV value = 0;
    NV value_nv = 0;

    const UV max_div_16 = UV_MAX / 16;
    bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
    bool overflowed = FALSE;
    const char *xdigit;

    if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
        /* strip off leading x or 0x.
           for compatibility silently suffer "x" and "0x" as valid hex numbers.
        */
        if (len >= 1) {
            if (s[0] == 'x') {
                s++;

ppport.h  view on Meta::CPAN

                if (value <= max_div_16) {
                    value = (value << 4) | ((xdigit - PL_hexdigit) & 15);
                    continue;
                }
                warn("Integer overflow in hexadecimal number");
                overflowed = TRUE;
                value_nv = (NV) value;
            }
            value_nv *= 16.0;
	    /* If an NV has not enough bits in its mantissa to
	     * represent a UV this summing of small low-order numbers
	     * is a waste of time (because the NV cannot preserve
	     * the low-order bits anyway): we could just remember when
	     * did we overflow and in the end just multiply value_nv by the
	     * right amount of 16-tuples. */
            value_nv += (NV)((xdigit - PL_hexdigit) & 15);
            continue;
        }
        if (*s == '_' && len && allow_underscores && s[1]
		&& (xdigit = strchr((char *) PL_hexdigit, s[1])))
	    {
		--len;
		++s;
                goto redo;
	    }
        if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
            warn("Illegal hexadecimal digit '%c' ignored", *s);
        break;
    }

ppport.h  view on Meta::CPAN

#endif
	) {
	warn("Hexadecimal number > 0xffffffff non-portable");
    }
    *len_p = s - start;
    if (!overflowed) {
        *flags = 0;
        return value;
    }
    *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
    if (result)
        *result = value_nv;
    return UV_MAX;
}
#endif
#endif

#ifndef grok_oct
#if defined(NEED_grok_oct)
static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
static
#else
extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
#endif

#ifdef grok_oct
#  undef grok_oct
#endif
#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d)
#define Perl_grok_oct DPPP_(my_grok_oct)

#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
UV
DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
{
    const char *s = start;
    STRLEN len = *len_p;
    UV value = 0;
    NV value_nv = 0;

    const UV max_div_8 = UV_MAX / 8;
    bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
    bool overflowed = FALSE;

    for (; len-- && *s; s++) {
         /* gcc 2.95 optimiser not smart enough to figure that this subtraction
            out front allows slicker code.  */
        int digit = *s - '0';
        if (digit >= 0 && digit <= 7) {
            /* Write it in this wonky order with a goto to attempt to get the
               compiler to make the common case integer-only loop pretty tight.
            */

ppport.h  view on Meta::CPAN

                    value = (value << 3) | digit;
                    continue;
                }
                /* Bah. We're just overflowed.  */
                warn("Integer overflow in octal number");
                overflowed = TRUE;
                value_nv = (NV) value;
            }
            value_nv *= 8.0;
	    /* If an NV has not enough bits in its mantissa to
	     * represent a UV this summing of small low-order numbers
	     * is a waste of time (because the NV cannot preserve
	     * the low-order bits anyway): we could just remember when
	     * did we overflow and in the end just multiply value_nv by the
	     * right amount of 8-tuples. */
            value_nv += (NV)digit;
            continue;
        }
        if (digit == ('_' - '0') && len && allow_underscores
            && (digit = s[1] - '0') && (digit >= 0 && digit <= 7))
	    {
		--len;
		++s;
                goto redo;
	    }
        /* Allow \octal to work the DWIM way (that is, stop scanning
         * as soon as non-octal characters are seen, complain only iff
         * someone seems to want to use the digits eight and nine). */
        if (digit == 8 || digit == 9) {

ppport.h  view on Meta::CPAN

#endif
	) {
	warn("Octal number > 037777777777 non-portable");
    }
    *len_p = s - start;
    if (!overflowed) {
        *flags = 0;
        return value;
    }
    *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
    if (result)
        *result = value_nv;
    return UV_MAX;
}
#endif
#endif

#if !defined(my_snprintf)
#if defined(NEED_my_snprintf)
static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...);
static
#else

t/00-ALPM.t  view on Meta::CPAN


	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;
}else{
	$siglvl = { 'pkg' => 'never', 'db' => 'required' };
	eval { $alpm->set_defsiglvl($siglvl); };

t/03-Package.t  view on Meta::CPAN

my @methnames = qw{ requiredby name version desc
                    url builddate installdate packager
                    arch arch size isize reason
                    licenses groups depends optdepends
                    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;

t/preptests.pl  view on Meta::CPAN

	chdir '..' or die "chdir: $!";

	if(@?){
		printf STDERR "$PROG: package.pl script failed: code %d\n", $? >> 8;
		exit 1;
	}

	my %repos;
	for (@lines){
		chomp;
		my($r, @rest) = split /\t/;
		push @{$repos{$r}}, join "\t", @rest;
	}

	return \%repos;
}

sub remkdir
{
	my($dir) = @_;
	die "WTF?" if($dir eq '/');
	remove_tree($dir);

types.c  view on Meta::CPAN

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.



( run in 1.275 second using v1.01-cache-2.11-cpan-49f99fa48dc )