[arch-commits] Commit in perl/repos (12 files)

Florian Pritz bluewind at nymeria.archlinux.org
Sun May 19 16:08:56 UTC 2013


    Date: Sunday, May 19, 2013 @ 18:08:56
  Author: bluewind
Revision: 185854

archrelease: copy trunk to staging-i686, staging-x86_64

Added:
  perl/repos/staging-i686/
  perl/repos/staging-i686/PKGBUILD
    (from rev 185853, perl/trunk/PKGBUILD)
  perl/repos/staging-i686/perl.install
    (from rev 185853, perl/trunk/perl.install)
  perl/repos/staging-i686/perlbin.csh
    (from rev 185853, perl/trunk/perlbin.csh)
  perl/repos/staging-i686/perlbin.sh
    (from rev 185853, perl/trunk/perlbin.sh)
  perl/repos/staging-i686/provides.pl
    (from rev 185853, perl/trunk/provides.pl)
  perl/repos/staging-x86_64/
  perl/repos/staging-x86_64/PKGBUILD
    (from rev 185853, perl/trunk/PKGBUILD)
  perl/repos/staging-x86_64/perl.install
    (from rev 185853, perl/trunk/perl.install)
  perl/repos/staging-x86_64/perlbin.csh
    (from rev 185853, perl/trunk/perlbin.csh)
  perl/repos/staging-x86_64/perlbin.sh
    (from rev 185853, perl/trunk/perlbin.sh)
  perl/repos/staging-x86_64/provides.pl
    (from rev 185853, perl/trunk/provides.pl)

-----------------------------+
 staging-i686/PKGBUILD       |  120 ++++++++++++++++
 staging-i686/perl.install   |   10 +
 staging-i686/perlbin.csh    |   15 ++
 staging-i686/perlbin.sh     |   18 ++
 staging-i686/provides.pl    |  299 ++++++++++++++++++++++++++++++++++++++++++
 staging-x86_64/PKGBUILD     |  120 ++++++++++++++++
 staging-x86_64/perl.install |   10 +
 staging-x86_64/perlbin.csh  |   15 ++
 staging-x86_64/perlbin.sh   |   18 ++
 staging-x86_64/provides.pl  |  299 ++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 924 insertions(+)

Copied: perl/repos/staging-i686/PKGBUILD (from rev 185853, perl/trunk/PKGBUILD)
===================================================================
--- staging-i686/PKGBUILD	                        (rev 0)
+++ staging-i686/PKGBUILD	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,120 @@
+# $Id$
+# Maintainer: Florian Pritz <bluewind at xinu.at>
+# Contributor: Angel Velasquez <angvp at archlinux.org>
+# Contributor: kevin <kevin.archlinux.org>
+# Contributor: judd <jvinet.zeroflux.org>
+# Contributor: francois <francois.archlinux.org>
+
+pkgname=perl
+pkgver=5.18.0
+pkgrel=1
+pkgdesc="A highly capable, feature-rich programming language"
+arch=(i686 x86_64)
+license=('GPL' 'PerlArtistic')
+url="http://www.perl.org"
+groups=('base')
+depends=('gdbm' 'db' 'coreutils' 'glibc' 'sh')
+source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2
+        perlbin.sh
+        perlbin.csh
+        provides.pl)
+install=perl.install
+options=('makeflags' '!purge')
+md5sums=('a832e928adfd36d162d2a5d3b631265c'
+         '5ed2542fdb9a60682f215bd33701e61a'
+         '1f0cbbee783e8a6d32f01be5118e0d5e'
+         '999c3eea6464860704abbb055a0f0896')
+
+# workaround to let the integrity check find the correct provides array
+if [[ ${0##*/} = "parse_pkgbuilds.sh" ]]; then
+	true && provides=($(bsdtar -q -O -xf "/srv/ftp/pool/packages/$pkgname-$pkgver-$pkgrel-$CARCH.pkg.tar.xz" .PKGINFO | sed -rn 's#^provides = (.*)#\1#p'))
+fi
+
+prepare() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+}
+
+build() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+
+  if [ "${CARCH}" = "x86_64" ]; then
+    # for x86_64
+    arch_opts="-Dcccdlflags='-fPIC'"
+  else
+    # for i686
+    arch_opts=""
+  fi
+
+  ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
+    -Dprefix=/usr -Dvendorprefix=/usr \
+    -Dprivlib=/usr/share/perl5/core_perl \
+    -Darchlib=/usr/lib/perl5/core_perl \
+    -Dsitelib=/usr/share/perl5/site_perl \
+    -Dsitearch=/usr/lib/perl5/site_perl \
+    -Dvendorlib=/usr/share/perl5/vendor_perl \
+    -Dvendorarch=/usr/lib/perl5/vendor_perl \
+    -Dscriptdir=/usr/bin/core_perl \
+    -Dsitescript=/usr/bin/site_perl \
+    -Dvendorscript=/usr/bin/vendor_perl \
+    -Dinc_version_list=none \
+    -Dman1ext=1perl -Dman3ext=3perl ${arch_opts} \
+    -Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
+  make
+}
+
+check() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+  TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness || true
+#  make test
+}
+
+package() {
+  # hack to work around makepkg running the subshell in check_sanity()
+  new_provides=($(cd "$srcdir/perl-$pkgver"; LD_PRELOAD=./libperl.so ./perl -Ilib "$srcdir/provides.pl" .))
+  provides=(${new_provides[@]})
+
+  cd ${srcdir}/${pkgname}-${pkgver}
+  make DESTDIR="$pkgdir" install
+
+  ### Perl Settings ###
+  # Change man page extensions for site and vendor module builds.
+  # Set no mail address since bug reports should go to the bug tracker
+  # and not someone's email.
+  sed -e '/^man1ext=/ s/1perl/1p/' -e '/^man3ext=/ s/3perl/3pm/' \
+      -e "/^cf_email=/ s/'.*'/''/" \
+      -e "/^perladmin=/ s/'.*'/''/" \
+      -i ${pkgdir}/usr/lib/perl5/core_perl/Config_heavy.pl
+
+  ### CPAN Settings ###
+  # Set CPAN default config to use the site directories.
+  sed -e '/(makepl_arg =>/   s/""/"INSTALLDIRS=site"/' \
+      -e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
+      -i ${pkgdir}/usr/share/perl5/core_perl/CPAN/FirstTime.pm
+
+  ### CPANPLUS Settings ###
+  # Set CPANPLUS default config to use the site directories.
+  sed -e "/{'makemakerflags'}/ s/'';/'INSTALLDIRS=site';/" \
+      -e "/{'buildflags'}/     s/'';/'installdirs=site';/" \
+      -i ${pkgdir}/usr/share/perl5/core_perl/CPANPLUS/Config.pm
+
+  # Profile script to set paths to perl scripts.
+  install -D -m755 ${srcdir}/perlbin.sh \
+                   ${pkgdir}/etc/profile.d/perlbin.sh
+  # Profile script to set paths to perl scripts on csh. (FS#22441)
+  install -D -m755 ${srcdir}/perlbin.csh \
+                  ${pkgdir}/etc/profile.d/perlbin.csh
+
+  (cd ${pkgdir}/usr/bin; mv perl${pkgver} perl)
+  (cd ${pkgdir}/usr/bin/core_perl;  ln -sf c2ph pstruct; ln -sf s2p psed)
+
+  # Remove all pod files *except* those under /usr/share/perl5/core_perl/pod/
+  # (FS#16488)
+  rm -f $pkgdir/usr/share/perl5/core_perl/*.pod
+  for d in $pkgdir/usr/share/perl5/core_perl/*; do
+    if [ -d $d -a $(basename $d) != "pod" ]; then
+      find $d -name *.pod -delete
+    fi
+  done
+  find $pkgdir/usr/lib -name *.pod -delete
+  find $pkgdir -name .packlist -delete
+}

Copied: perl/repos/staging-i686/perl.install (from rev 185853, perl/trunk/perl.install)
===================================================================
--- staging-i686/perl.install	                        (rev 0)
+++ staging-i686/perl.install	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,10 @@
+# arg 1:  the new package version
+post_install() {
+  for ver in 5.8.{0,1,2,3,4,5,6,7,8}; do
+    [ -h usr/lib/perl5/$ver ] && rm usr/lib/perl5/$ver
+    [ -h usr/lib/perl5/site_perl/$ver ] && rm usr/lib/perl5/site_perl/$ver
+    [ -h usr/bin/perl$ver ] && rm usr/bin/perl$ver
+  done
+  return 0
+}
+

Copied: perl/repos/staging-i686/perlbin.csh (from rev 185853, perl/trunk/perlbin.csh)
===================================================================
--- staging-i686/perlbin.csh	                        (rev 0)
+++ staging-i686/perlbin.csh	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,15 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && setenv PATH ${PATH}:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && setenv PATH ${PATH}:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && setenv PATH ${PATH}:/usr/bin/core_perl
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2

Copied: perl/repos/staging-i686/perlbin.sh (from rev 185853, perl/trunk/perlbin.sh)
===================================================================
--- staging-i686/perlbin.sh	                        (rev 0)
+++ staging-i686/perlbin.sh	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,18 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && PATH=$PATH:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && PATH=$PATH:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && PATH=$PATH:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && PATH=$PATH:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && PATH=$PATH:/usr/bin/core_perl
+
+export PATH
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2
+

Copied: perl/repos/staging-i686/provides.pl (from rev 185853, perl/trunk/provides.pl)
===================================================================
--- staging-i686/provides.pl	                        (rev 0)
+++ staging-i686/provides.pl	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,299 @@
+# provides.pl
+##
+# Script for printing out a provides list of every CPAN distribution
+# that is bundled with perl. You can run it before building perl
+# or you can run it after building perl. Required modules are in core
+# for perl 5.13 and above.  It might be nice if this didn't require
+# HTTP::Tiny and maybe just used wget or curl.
+#
+# This script uses HTTP::Tiny to query Tatsuhiko Miyagawa's webapp at
+# cpanmetadb.plackperl.org to cross-reference module files to their
+# providing CPAN distribution. Thank you Miyagawa!
+#
+# - Justin "juster" Davis <jrcd83 at gmail.com>
+
+use warnings 'FATAL' => 'all';
+use strict;
+
+package Common;
+
+sub evalver
+{
+    my ($path, $mod) = @_;
+
+    open my $fh, '<', $path or die "open $path: $!";
+
+    my $m = ($mod
+        ? qr/(?:\$${mod}::VERSION|\$VERSION)/
+        : qr/\$VERSION/);
+
+    while (my $ln = <$fh>) {
+        next unless $ln =~ /\s*$m\s*=\s*.+/;
+        chomp $ln;
+        my $ver = do { no strict; eval $ln };
+        return $ver unless $@;
+        die qq{$path:$. bad version string in "$ln"\n};
+    }
+
+    close $fh;
+    return undef;
+}
+
+
+#-----------------------------------------------------------------------------
+
+package Dists;
+
+sub maindistfile
+{
+    my ($dist, $dir) = @_;
+
+    # libpath is the modern style, installing modules under lib/
+    # with dirs matching the name components.
+    my $libpath = join q{/}, 'lib', split /-/, "${dist}.pm";
+
+    # dumbpath is an old style where there's no subdirs and just
+    # a .pm file.
+    my $dumbpath = $dist;
+    $dumbpath =~ s/\A.+-//;
+    $dumbpath .= ".pm";
+
+    my @paths = ($libpath, $dumbpath);
+    # Some modules (with simple names like XSLoader, lib, etc) are
+    # generated by Makefile.PL. Search through their generating code.
+    push @paths, "${dist}_pm.PL" if $dist =~ tr/-/-/ == 0;
+
+    for my $path (map { "$dir/$_" } @paths) { return $path if -f $path; }
+    return undef;
+}
+
+sub module_ver
+{
+    my ($dist, $dir) = @_;
+
+    my $path = maindistfile($dist, $dir) or return undef;
+
+    my $mod = $dist;
+    $mod =~ s/-/::/g;
+    my $ver = Common::evalver($path, $mod);
+    unless ($ver) {
+        warn "failed to find version in module file for $dist\n";
+        return undef;
+    }
+
+    return $ver;
+}
+
+sub changelog_ver
+{
+    my ($dist, $dir) = @_;
+
+    my $path;
+    for my $tmp (glob "$dir/{Changes,ChangeLog}") {
+        if (-f $tmp) { $path = $tmp; last; }
+    }
+    return undef unless $path;
+
+    open my $fh, '<', $path or die "open: $!";
+    while (<$fh>) {
+        return $1 if /\A\s*(?:$dist[ \t]*)?([0-9._]+)/;
+        return $1 if /\A\s*version\s+([0-9._]+)/i;
+    }
+    close $fh;
+
+    return undef;
+}
+
+# for some reason podlators has a VERSION file with perl code in it
+sub verfile_ver
+{
+    my ($dist, $dir) = @_;
+
+    my $path = "$dir/VERSION";
+    return undef unless -f $path; # no warning, only podlaters has it
+
+    return Common::evalver($path);
+}
+
+# scans a directory full of nicely separated dist. directories.
+sub scan_distroot
+{
+    my ($distroot) = @_;
+    opendir my $cpand, "$distroot" or die "failed to open $distroot";
+    my @dists = grep { !/^\./ && -d "$distroot/$_" } readdir $cpand;
+    closedir $cpand;
+
+    my @found;
+    for my $dist (@dists) {
+        my $distdir = "$distroot/$dist";
+        my $ver = (module_ver($dist, $distdir)
+                   || changelog_ver($dist, $distdir)
+                   || verfile_ver($dist, $distdir));
+
+        if ($ver) { push @found, [ $dist, $ver ]; }
+        else { warn "failed to find version for $dist\n"; }
+    }
+    return @found;
+}
+
+sub find
+{
+    my ($srcdir) = @_;
+    return map { scan_distroot($_) } glob "$srcdir/{cpan,dist}";
+}
+
+#-----------------------------------------------------------------------------
+
+package Modules;
+
+use HTTP::Tiny qw();
+use File::Find qw();
+use File::stat;
+
+*findfile = *File::Find::find;
+
+sub cpan_provider
+{
+    my ($module) = @_;
+    my $url = "http://cpanmetadb.plackperl.org/v1.0/package/$module";
+    my $http = HTTP::Tiny->new;
+    my $resp = $http->get($url);
+    return undef unless $resp->{'success'};
+
+    my ($cpanpath) = $resp->{'content'} =~ /^distfile: (.*)$/m
+        or return undef;
+
+    my $dist = $cpanpath;
+    $dist =~ s{\A.+/}{};    # remove author directory
+    $dist =~ s{-[^-]+\z}{}; # remove version and extension
+    return ($dist eq 'perl' ? undef : $dist);
+}
+
+sub find
+{
+    my ($srcdir) = @_;
+    my $libdir = "$srcdir/lib/";
+    die "failed to find $libdir directory" unless -d $libdir;
+
+    # Find only the module files that have not changed since perl
+    # was extracted. We don't want the files perl just recently
+    # installed into lib/. We processed those already.
+    my @modfiles;
+    my $finder = sub {
+        return unless /[.]pm\z/;
+        return if m{\Q$libdir\E[^/]+/t/}; # ignore testing modules
+        push @modfiles, $_;
+    };
+    findfile({ 'no_chdir' => 1, 'wanted' => $finder }, $libdir);
+
+    # First we have to find what the oldest ctime actually is.
+    my $oldest = time;
+    @modfiles = map {
+        my $modfile = $_;
+        my $ctime = (stat $modfile)->ctime;
+        $oldest = $ctime if $ctime < $oldest;
+        [ $modfile, $ctime ]; # save ctime for later
+    } @modfiles;
+
+    # Then we filter out any file that was created more than a
+    # few seconds after that. Process the rest.
+    my @mods;
+    for my $modfile (@modfiles) {
+        my ($mod, $ctime) = @$modfile;
+        next if $ctime - $oldest > 5; # ignore newer files
+
+        my $path = $mod;
+        $mod =~ s{[.]pm\z}{};
+        $mod =~ s{\A$libdir}{};
+        $mod =~ s{/}{::}g;
+
+        my $ver = Common::evalver($path, $mod) || q{};
+        push @mods, [ $mod, $ver ];
+    }
+
+    # Convert modules names to the dist names who provide them.
+    my %seen;
+    my @dists;
+    for my $modref (@mods) {
+        my ($mod, $ver) = @$modref;
+        my $dist = cpan_provider($mod) or next; # filter out core modules
+        next if $seen{$dist}++;                 # avoid duplicate dists
+        push @dists, [ $dist, $ver ];
+    }
+    return @dists;
+}
+
+#-----------------------------------------------------------------------------
+
+package Dist2Pkg;
+
+sub name
+{
+    my ($name) = @_;
+    my $orig = $name;
+
+    # Package names should be lowercase and consist of alphanumeric
+    # characters only (and hyphens!)...
+    $name =~ tr/A-Z/a-z/;
+    $name =~ tr/_+/-/; # _ and +'s converted to - (ie Tabbed-Text+Wrap)
+    $name =~ tr/-a-z0-9+//cd; # Delete all other chars.
+    $name =~ tr/-/-/s;
+
+    # Delete leading or trailing hyphens...
+    $name =~ s/\A-|-\z//g;
+
+    die qq{Dist. name '$orig' completely violates packaging standards}
+        unless $name;
+
+    return "perl-$name";
+}
+
+sub version
+{
+    my ($version) = @_;
+
+    # Package versions should be numbers and decimal points only...
+    $version =~ tr/-/./;
+    $version =~ tr/_0-9.-//cd;
+
+    # Remove developer versions because pacman has no special logic
+    # to compare them to regular versions like perl does.
+    $version =~ s/_[^_]+\z//;
+
+    $version =~ tr/_//d;  # delete other underscores
+    $version =~ tr/././s; # only one period at a time
+    $version =~ s/\A[.]|[.]\z//g; # shouldn't start or stop with a period
+
+    return $version;
+}
+
+#-----------------------------------------------------------------------------
+
+package main;
+
+my %CPANNAME = ('List-Util' => 'Scalar-List-Utils',
+                'Text-Tabs' => 'Text-Tabs+Wrap',
+                'Cwd'       => 'PathTools');
+
+my $perldir = shift or die "Usage: $0 [path to perl source directory]\n";
+die "$perldir is not a valid directory." unless -d $perldir;
+
+my @dists = (Dists::find($perldir), Modules::find($perldir));
+for my $dist (@dists) {
+    my $name = $dist->[0];
+    $dist->[0] = $CPANNAME{$name} if exists $CPANNAME{$name};
+}
+
+my @pkgs = map {
+    my ($name, $ver) = @$_;
+    $name = Dist2Pkg::name($name);
+    $ver  = Dist2Pkg::version($ver);
+    [ $name, $ver ];
+} @dists;
+
+ at pkgs = sort { $a->[0] cmp $b->[0] } @pkgs;
+
+for my $pkg (@pkgs) {
+    my ($name, $ver) = @$pkg;
+    print "$name=$ver\n";
+}

Copied: perl/repos/staging-x86_64/PKGBUILD (from rev 185853, perl/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,120 @@
+# $Id$
+# Maintainer: Florian Pritz <bluewind at xinu.at>
+# Contributor: Angel Velasquez <angvp at archlinux.org>
+# Contributor: kevin <kevin.archlinux.org>
+# Contributor: judd <jvinet.zeroflux.org>
+# Contributor: francois <francois.archlinux.org>
+
+pkgname=perl
+pkgver=5.18.0
+pkgrel=1
+pkgdesc="A highly capable, feature-rich programming language"
+arch=(i686 x86_64)
+license=('GPL' 'PerlArtistic')
+url="http://www.perl.org"
+groups=('base')
+depends=('gdbm' 'db' 'coreutils' 'glibc' 'sh')
+source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2
+        perlbin.sh
+        perlbin.csh
+        provides.pl)
+install=perl.install
+options=('makeflags' '!purge')
+md5sums=('a832e928adfd36d162d2a5d3b631265c'
+         '5ed2542fdb9a60682f215bd33701e61a'
+         '1f0cbbee783e8a6d32f01be5118e0d5e'
+         '999c3eea6464860704abbb055a0f0896')
+
+# workaround to let the integrity check find the correct provides array
+if [[ ${0##*/} = "parse_pkgbuilds.sh" ]]; then
+	true && provides=($(bsdtar -q -O -xf "/srv/ftp/pool/packages/$pkgname-$pkgver-$pkgrel-$CARCH.pkg.tar.xz" .PKGINFO | sed -rn 's#^provides = (.*)#\1#p'))
+fi
+
+prepare() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+}
+
+build() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+
+  if [ "${CARCH}" = "x86_64" ]; then
+    # for x86_64
+    arch_opts="-Dcccdlflags='-fPIC'"
+  else
+    # for i686
+    arch_opts=""
+  fi
+
+  ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
+    -Dprefix=/usr -Dvendorprefix=/usr \
+    -Dprivlib=/usr/share/perl5/core_perl \
+    -Darchlib=/usr/lib/perl5/core_perl \
+    -Dsitelib=/usr/share/perl5/site_perl \
+    -Dsitearch=/usr/lib/perl5/site_perl \
+    -Dvendorlib=/usr/share/perl5/vendor_perl \
+    -Dvendorarch=/usr/lib/perl5/vendor_perl \
+    -Dscriptdir=/usr/bin/core_perl \
+    -Dsitescript=/usr/bin/site_perl \
+    -Dvendorscript=/usr/bin/vendor_perl \
+    -Dinc_version_list=none \
+    -Dman1ext=1perl -Dman3ext=3perl ${arch_opts} \
+    -Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
+  make
+}
+
+check() {
+  cd ${srcdir}/${pkgname}-${pkgver}
+  TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness || true
+#  make test
+}
+
+package() {
+  # hack to work around makepkg running the subshell in check_sanity()
+  new_provides=($(cd "$srcdir/perl-$pkgver"; LD_PRELOAD=./libperl.so ./perl -Ilib "$srcdir/provides.pl" .))
+  provides=(${new_provides[@]})
+
+  cd ${srcdir}/${pkgname}-${pkgver}
+  make DESTDIR="$pkgdir" install
+
+  ### Perl Settings ###
+  # Change man page extensions for site and vendor module builds.
+  # Set no mail address since bug reports should go to the bug tracker
+  # and not someone's email.
+  sed -e '/^man1ext=/ s/1perl/1p/' -e '/^man3ext=/ s/3perl/3pm/' \
+      -e "/^cf_email=/ s/'.*'/''/" \
+      -e "/^perladmin=/ s/'.*'/''/" \
+      -i ${pkgdir}/usr/lib/perl5/core_perl/Config_heavy.pl
+
+  ### CPAN Settings ###
+  # Set CPAN default config to use the site directories.
+  sed -e '/(makepl_arg =>/   s/""/"INSTALLDIRS=site"/' \
+      -e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
+      -i ${pkgdir}/usr/share/perl5/core_perl/CPAN/FirstTime.pm
+
+  ### CPANPLUS Settings ###
+  # Set CPANPLUS default config to use the site directories.
+  sed -e "/{'makemakerflags'}/ s/'';/'INSTALLDIRS=site';/" \
+      -e "/{'buildflags'}/     s/'';/'installdirs=site';/" \
+      -i ${pkgdir}/usr/share/perl5/core_perl/CPANPLUS/Config.pm
+
+  # Profile script to set paths to perl scripts.
+  install -D -m755 ${srcdir}/perlbin.sh \
+                   ${pkgdir}/etc/profile.d/perlbin.sh
+  # Profile script to set paths to perl scripts on csh. (FS#22441)
+  install -D -m755 ${srcdir}/perlbin.csh \
+                  ${pkgdir}/etc/profile.d/perlbin.csh
+
+  (cd ${pkgdir}/usr/bin; mv perl${pkgver} perl)
+  (cd ${pkgdir}/usr/bin/core_perl;  ln -sf c2ph pstruct; ln -sf s2p psed)
+
+  # Remove all pod files *except* those under /usr/share/perl5/core_perl/pod/
+  # (FS#16488)
+  rm -f $pkgdir/usr/share/perl5/core_perl/*.pod
+  for d in $pkgdir/usr/share/perl5/core_perl/*; do
+    if [ -d $d -a $(basename $d) != "pod" ]; then
+      find $d -name *.pod -delete
+    fi
+  done
+  find $pkgdir/usr/lib -name *.pod -delete
+  find $pkgdir -name .packlist -delete
+}

Copied: perl/repos/staging-x86_64/perl.install (from rev 185853, perl/trunk/perl.install)
===================================================================
--- staging-x86_64/perl.install	                        (rev 0)
+++ staging-x86_64/perl.install	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,10 @@
+# arg 1:  the new package version
+post_install() {
+  for ver in 5.8.{0,1,2,3,4,5,6,7,8}; do
+    [ -h usr/lib/perl5/$ver ] && rm usr/lib/perl5/$ver
+    [ -h usr/lib/perl5/site_perl/$ver ] && rm usr/lib/perl5/site_perl/$ver
+    [ -h usr/bin/perl$ver ] && rm usr/bin/perl$ver
+  done
+  return 0
+}
+

Copied: perl/repos/staging-x86_64/perlbin.csh (from rev 185853, perl/trunk/perlbin.csh)
===================================================================
--- staging-x86_64/perlbin.csh	                        (rev 0)
+++ staging-x86_64/perlbin.csh	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,15 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && setenv PATH ${PATH}:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && setenv PATH ${PATH}:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && setenv PATH ${PATH}:/usr/bin/core_perl
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2

Copied: perl/repos/staging-x86_64/perlbin.sh (from rev 185853, perl/trunk/perlbin.sh)
===================================================================
--- staging-x86_64/perlbin.sh	                        (rev 0)
+++ staging-x86_64/perlbin.sh	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,18 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && PATH=$PATH:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && PATH=$PATH:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && PATH=$PATH:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && PATH=$PATH:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && PATH=$PATH:/usr/bin/core_perl
+
+export PATH
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2
+

Copied: perl/repos/staging-x86_64/provides.pl (from rev 185853, perl/trunk/provides.pl)
===================================================================
--- staging-x86_64/provides.pl	                        (rev 0)
+++ staging-x86_64/provides.pl	2013-05-19 16:08:56 UTC (rev 185854)
@@ -0,0 +1,299 @@
+# provides.pl
+##
+# Script for printing out a provides list of every CPAN distribution
+# that is bundled with perl. You can run it before building perl
+# or you can run it after building perl. Required modules are in core
+# for perl 5.13 and above.  It might be nice if this didn't require
+# HTTP::Tiny and maybe just used wget or curl.
+#
+# This script uses HTTP::Tiny to query Tatsuhiko Miyagawa's webapp at
+# cpanmetadb.plackperl.org to cross-reference module files to their
+# providing CPAN distribution. Thank you Miyagawa!
+#
+# - Justin "juster" Davis <jrcd83 at gmail.com>
+
+use warnings 'FATAL' => 'all';
+use strict;
+
+package Common;
+
+sub evalver
+{
+    my ($path, $mod) = @_;
+
+    open my $fh, '<', $path or die "open $path: $!";
+
+    my $m = ($mod
+        ? qr/(?:\$${mod}::VERSION|\$VERSION)/
+        : qr/\$VERSION/);
+
+    while (my $ln = <$fh>) {
+        next unless $ln =~ /\s*$m\s*=\s*.+/;
+        chomp $ln;
+        my $ver = do { no strict; eval $ln };
+        return $ver unless $@;
+        die qq{$path:$. bad version string in "$ln"\n};
+    }
+
+    close $fh;
+    return undef;
+}
+
+
+#-----------------------------------------------------------------------------
+
+package Dists;
+
+sub maindistfile
+{
+    my ($dist, $dir) = @_;
+
+    # libpath is the modern style, installing modules under lib/
+    # with dirs matching the name components.
+    my $libpath = join q{/}, 'lib', split /-/, "${dist}.pm";
+
+    # dumbpath is an old style where there's no subdirs and just
+    # a .pm file.
+    my $dumbpath = $dist;
+    $dumbpath =~ s/\A.+-//;
+    $dumbpath .= ".pm";
+
+    my @paths = ($libpath, $dumbpath);
+    # Some modules (with simple names like XSLoader, lib, etc) are
+    # generated by Makefile.PL. Search through their generating code.
+    push @paths, "${dist}_pm.PL" if $dist =~ tr/-/-/ == 0;
+
+    for my $path (map { "$dir/$_" } @paths) { return $path if -f $path; }
+    return undef;
+}
+
+sub module_ver
+{
+    my ($dist, $dir) = @_;
+
+    my $path = maindistfile($dist, $dir) or return undef;
+
+    my $mod = $dist;
+    $mod =~ s/-/::/g;
+    my $ver = Common::evalver($path, $mod);
+    unless ($ver) {
+        warn "failed to find version in module file for $dist\n";
+        return undef;
+    }
+
+    return $ver;
+}
+
+sub changelog_ver
+{
+    my ($dist, $dir) = @_;
+
+    my $path;
+    for my $tmp (glob "$dir/{Changes,ChangeLog}") {
+        if (-f $tmp) { $path = $tmp; last; }
+    }
+    return undef unless $path;
+
+    open my $fh, '<', $path or die "open: $!";
+    while (<$fh>) {
+        return $1 if /\A\s*(?:$dist[ \t]*)?([0-9._]+)/;
+        return $1 if /\A\s*version\s+([0-9._]+)/i;
+    }
+    close $fh;
+
+    return undef;
+}
+
+# for some reason podlators has a VERSION file with perl code in it
+sub verfile_ver
+{
+    my ($dist, $dir) = @_;
+
+    my $path = "$dir/VERSION";
+    return undef unless -f $path; # no warning, only podlaters has it
+
+    return Common::evalver($path);
+}
+
+# scans a directory full of nicely separated dist. directories.
+sub scan_distroot
+{
+    my ($distroot) = @_;
+    opendir my $cpand, "$distroot" or die "failed to open $distroot";
+    my @dists = grep { !/^\./ && -d "$distroot/$_" } readdir $cpand;
+    closedir $cpand;
+
+    my @found;
+    for my $dist (@dists) {
+        my $distdir = "$distroot/$dist";
+        my $ver = (module_ver($dist, $distdir)
+                   || changelog_ver($dist, $distdir)
+                   || verfile_ver($dist, $distdir));
+
+        if ($ver) { push @found, [ $dist, $ver ]; }
+        else { warn "failed to find version for $dist\n"; }
+    }
+    return @found;
+}
+
+sub find
+{
+    my ($srcdir) = @_;
+    return map { scan_distroot($_) } glob "$srcdir/{cpan,dist}";
+}
+
+#-----------------------------------------------------------------------------
+
+package Modules;
+
+use HTTP::Tiny qw();
+use File::Find qw();
+use File::stat;
+
+*findfile = *File::Find::find;
+
+sub cpan_provider
+{
+    my ($module) = @_;
+    my $url = "http://cpanmetadb.plackperl.org/v1.0/package/$module";
+    my $http = HTTP::Tiny->new;
+    my $resp = $http->get($url);
+    return undef unless $resp->{'success'};
+
+    my ($cpanpath) = $resp->{'content'} =~ /^distfile: (.*)$/m
+        or return undef;
+
+    my $dist = $cpanpath;
+    $dist =~ s{\A.+/}{};    # remove author directory
+    $dist =~ s{-[^-]+\z}{}; # remove version and extension
+    return ($dist eq 'perl' ? undef : $dist);
+}
+
+sub find
+{
+    my ($srcdir) = @_;
+    my $libdir = "$srcdir/lib/";
+    die "failed to find $libdir directory" unless -d $libdir;
+
+    # Find only the module files that have not changed since perl
+    # was extracted. We don't want the files perl just recently
+    # installed into lib/. We processed those already.
+    my @modfiles;
+    my $finder = sub {
+        return unless /[.]pm\z/;
+        return if m{\Q$libdir\E[^/]+/t/}; # ignore testing modules
+        push @modfiles, $_;
+    };
+    findfile({ 'no_chdir' => 1, 'wanted' => $finder }, $libdir);
+
+    # First we have to find what the oldest ctime actually is.
+    my $oldest = time;
+    @modfiles = map {
+        my $modfile = $_;
+        my $ctime = (stat $modfile)->ctime;
+        $oldest = $ctime if $ctime < $oldest;
+        [ $modfile, $ctime ]; # save ctime for later
+    } @modfiles;
+
+    # Then we filter out any file that was created more than a
+    # few seconds after that. Process the rest.
+    my @mods;
+    for my $modfile (@modfiles) {
+        my ($mod, $ctime) = @$modfile;
+        next if $ctime - $oldest > 5; # ignore newer files
+
+        my $path = $mod;
+        $mod =~ s{[.]pm\z}{};
+        $mod =~ s{\A$libdir}{};
+        $mod =~ s{/}{::}g;
+
+        my $ver = Common::evalver($path, $mod) || q{};
+        push @mods, [ $mod, $ver ];
+    }
+
+    # Convert modules names to the dist names who provide them.
+    my %seen;
+    my @dists;
+    for my $modref (@mods) {
+        my ($mod, $ver) = @$modref;
+        my $dist = cpan_provider($mod) or next; # filter out core modules
+        next if $seen{$dist}++;                 # avoid duplicate dists
+        push @dists, [ $dist, $ver ];
+    }
+    return @dists;
+}
+
+#-----------------------------------------------------------------------------
+
+package Dist2Pkg;
+
+sub name
+{
+    my ($name) = @_;
+    my $orig = $name;
+
+    # Package names should be lowercase and consist of alphanumeric
+    # characters only (and hyphens!)...
+    $name =~ tr/A-Z/a-z/;
+    $name =~ tr/_+/-/; # _ and +'s converted to - (ie Tabbed-Text+Wrap)
+    $name =~ tr/-a-z0-9+//cd; # Delete all other chars.
+    $name =~ tr/-/-/s;
+
+    # Delete leading or trailing hyphens...
+    $name =~ s/\A-|-\z//g;
+
+    die qq{Dist. name '$orig' completely violates packaging standards}
+        unless $name;
+
+    return "perl-$name";
+}
+
+sub version
+{
+    my ($version) = @_;
+
+    # Package versions should be numbers and decimal points only...
+    $version =~ tr/-/./;
+    $version =~ tr/_0-9.-//cd;
+
+    # Remove developer versions because pacman has no special logic
+    # to compare them to regular versions like perl does.
+    $version =~ s/_[^_]+\z//;
+
+    $version =~ tr/_//d;  # delete other underscores
+    $version =~ tr/././s; # only one period at a time
+    $version =~ s/\A[.]|[.]\z//g; # shouldn't start or stop with a period
+
+    return $version;
+}
+
+#-----------------------------------------------------------------------------
+
+package main;
+
+my %CPANNAME = ('List-Util' => 'Scalar-List-Utils',
+                'Text-Tabs' => 'Text-Tabs+Wrap',
+                'Cwd'       => 'PathTools');
+
+my $perldir = shift or die "Usage: $0 [path to perl source directory]\n";
+die "$perldir is not a valid directory." unless -d $perldir;
+
+my @dists = (Dists::find($perldir), Modules::find($perldir));
+for my $dist (@dists) {
+    my $name = $dist->[0];
+    $dist->[0] = $CPANNAME{$name} if exists $CPANNAME{$name};
+}
+
+my @pkgs = map {
+    my ($name, $ver) = @$_;
+    $name = Dist2Pkg::name($name);
+    $ver  = Dist2Pkg::version($ver);
+    [ $name, $ver ];
+} @dists;
+
+ at pkgs = sort { $a->[0] cmp $b->[0] } @pkgs;
+
+for my $pkg (@pkgs) {
+    my ($name, $ver) = @$pkg;
+    print "$name=$ver\n";
+}




More information about the arch-commits mailing list