From d5d2d3cfb18d8687a6c38e10bbc231f18ce58b24 Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Tue, 29 May 2018 22:07:57 +0000 Subject: perl: update to 5.26.2 --- ...GS-and-LDFLAGS-to-their-Config.pm-counter.patch | 83 ------ abs/core/perl/CVE-2016-2381_duplicate_env.diff | 104 +++++++ abs/core/perl/ChangeLog | 66 ----- abs/core/perl/PKGBUILD | 243 ++++++++++++----- abs/core/perl/detect-old-perl-modules.hook | 10 + abs/core/perl/detect-old-perl-modules.sh | 36 +++ abs/core/perl/digest_eval_hole.diff | 61 ----- abs/core/perl/fix-h2ph-and-tests.patch | 104 ------- abs/core/perl/generate-rebuild-list.sh | 11 + abs/core/perl/patchprov | 259 ++++++++++++++++++ .../perl/perl-binary-module-dependency-1.template | 5 + abs/core/perl/perl.install | 10 - abs/core/perl/perlbin.csh | 2 +- abs/core/perl/perlbin.fish | 10 + abs/core/perl/perlbin.sh | 2 +- abs/core/perl/provides.pl | 299 --------------------- abs/core/perl/upgpkg | 4 + 17 files changed, 624 insertions(+), 685 deletions(-) delete mode 100644 abs/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch create mode 100644 abs/core/perl/CVE-2016-2381_duplicate_env.diff delete mode 100644 abs/core/perl/ChangeLog create mode 100644 abs/core/perl/detect-old-perl-modules.hook create mode 100644 abs/core/perl/detect-old-perl-modules.sh delete mode 100644 abs/core/perl/digest_eval_hole.diff delete mode 100644 abs/core/perl/fix-h2ph-and-tests.patch create mode 100755 abs/core/perl/generate-rebuild-list.sh create mode 100755 abs/core/perl/patchprov create mode 100644 abs/core/perl/perl-binary-module-dependency-1.template delete mode 100644 abs/core/perl/perl.install create mode 100644 abs/core/perl/perlbin.fish delete mode 100644 abs/core/perl/provides.pl create mode 100644 abs/core/perl/upgpkg diff --git a/abs/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch b/abs/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch deleted file mode 100644 index 1404460..0000000 --- a/abs/core/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch +++ /dev/null @@ -1,83 +0,0 @@ -From bb249b0b26c2e79a6f55355ef94889070f07fd21 Mon Sep 17 00:00:00 2001 -From: Niko Tyni -Date: Thu, 28 Apr 2011 09:18:54 +0300 -Subject: [PATCH] Append CFLAGS and LDFLAGS to their Config.pm counterparts in - EU::CBuilder - -Since ExtUtils::CBuilder 0.27_04 (bleadperl commit 06e8058f27e4), -CFLAGS and LDFLAGS from the environment have overridden the Config.pm -ccflags and ldflags settings. This can cause binary incompatibilities -between the core Perl and extensions built with EU::CBuilder. - -Append to the Config.pm values rather than overriding them. ---- - .../lib/ExtUtils/CBuilder/Base.pm | 6 +++- - dist/ExtUtils-CBuilder/t/04-base.t | 25 +++++++++++++++++++- - 2 files changed, 28 insertions(+), 3 deletions(-) - -diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm -index b572312..2255c51 100644 ---- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm -+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm -@@ -40,11 +40,13 @@ sub new { - $self->{config}{$k} = $v unless exists $self->{config}{$k}; - } - $self->{config}{cc} = $ENV{CC} if defined $ENV{CC}; -- $self->{config}{ccflags} = $ENV{CFLAGS} if defined $ENV{CFLAGS}; -+ $self->{config}{ccflags} = join(" ", $self->{config}{ccflags}, $ENV{CFLAGS}) -+ if defined $ENV{CFLAGS}; - $self->{config}{cxx} = $ENV{CXX} if defined $ENV{CXX}; - $self->{config}{cxxflags} = $ENV{CXXFLAGS} if defined $ENV{CXXFLAGS}; - $self->{config}{ld} = $ENV{LD} if defined $ENV{LD}; -- $self->{config}{ldflags} = $ENV{LDFLAGS} if defined $ENV{LDFLAGS}; -+ $self->{config}{ldflags} = join(" ", $self->{config}{ldflags}, $ENV{LDFLAGS}) -+ if defined $ENV{LDFLAGS}; - - unless ( exists $self->{config}{cxx} ) { - my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/); -diff --git a/dist/ExtUtils-CBuilder/t/04-base.t b/dist/ExtUtils-CBuilder/t/04-base.t -index c3bf6b5..1bb15aa 100644 ---- a/dist/ExtUtils-CBuilder/t/04-base.t -+++ b/dist/ExtUtils-CBuilder/t/04-base.t -@@ -1,7 +1,7 @@ - #! perl -w - - use strict; --use Test::More tests => 50; -+use Test::More tests => 64; - use Config; - use Cwd; - use File::Path qw( mkpath ); -@@ -326,6 +326,29 @@ is_deeply( $mksymlists_args, - "_prepare_mksymlists_args(): got expected arguments for Mksymlists", - ); - -+my %testvars = ( -+ CFLAGS => 'ccflags', -+ LDFLAGS => 'ldflags', -+); -+ -+while (my ($VAR, $var) = each %testvars) { -+ local $ENV{$VAR}; -+ $base = ExtUtils::CBuilder::Base->new( quiet => 1 ); -+ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" ); -+ isa_ok( $base, 'ExtUtils::CBuilder::Base' ); -+ like($base->{config}{$var}, qr/\Q$Config{$var}/, -+ "honours $var from Config.pm"); -+ -+ $ENV{$VAR} = "-foo -bar"; -+ $base = ExtUtils::CBuilder::Base->new( quiet => 1 ); -+ ok( $base, "ExtUtils::CBuilder::Base->new() returned true value" ); -+ isa_ok( $base, 'ExtUtils::CBuilder::Base' ); -+ like($base->{config}{$var}, qr/\Q$ENV{$VAR}/, -+ "honours $VAR from the environment"); -+ like($base->{config}{$var}, qr/\Q$Config{$var}/, -+ "doesn't override $var from Config.pm with $VAR from the environment"); -+} -+ - ##### - - for ($source_file, $object_file, $lib_file) { --- -1.7.4.4 - diff --git a/abs/core/perl/CVE-2016-2381_duplicate_env.diff b/abs/core/perl/CVE-2016-2381_duplicate_env.diff new file mode 100644 index 0000000..80adf62 --- /dev/null +++ b/abs/core/perl/CVE-2016-2381_duplicate_env.diff @@ -0,0 +1,104 @@ +From 83e7ebed7afa79a2f50eca6b6330eae7c3a02d36 Mon Sep 17 00:00:00 2001 +From: Tony Cook +Date: Wed, 27 Jan 2016 11:52:15 +1100 +Subject: remove duplicate environment variables from environ + +If we see duplicate environment variables while iterating over +environ[]: + +a) make sure we use the same value in %ENV that getenv() returns. + +Previously on a duplicate, %ENV would have the last entry for the name +from environ[], but a typical getenv() would return the first entry. + +Rather than assuming all getenv() implementations return the first entry +explicitly call getenv() to ensure they agree. + +b) remove duplicate entries from environ + +Previously if there was a duplicate definition for a name in environ[] +setting that name in %ENV could result in an unsafe value being passed +to a child process, so ensure environ[] has no duplicates. + +Patch-Name: fixes/CVE-2016-2381_duplicate_env.diff +--- + perl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 49 insertions(+), 2 deletions(-) + +diff --git a/perl.c b/perl.c +index 80a76c2..ed25429 100644 +--- a/perl.c ++++ b/perl.c +@@ -4303,23 +4303,70 @@ S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env) + } + if (env) { + char *s, *old_var; ++ STRLEN nlen; + SV *sv; ++ HV *dups = newHV(); ++ + for (; *env; env++) { + old_var = *env; + + if (!(s = strchr(old_var,'=')) || s == old_var) + continue; ++ nlen = s - old_var; + + #if defined(MSDOS) && !defined(DJGPP) + *s = '\0'; + (void)strupr(old_var); + *s = '='; + #endif +- sv = newSVpv(s+1, 0); +- (void)hv_store(hv, old_var, s - old_var, sv, 0); ++ if (hv_exists(hv, old_var, nlen)) { ++ const char *name = savepvn(old_var, nlen); ++ ++ /* make sure we use the same value as getenv(), otherwise code that ++ uses getenv() (like setlocale()) might see a different value to %ENV ++ */ ++ sv = newSVpv(PerlEnv_getenv(name), 0); ++ ++ /* keep a count of the dups of this name so we can de-dup environ later */ ++ if (hv_exists(dups, name, nlen)) ++ ++SvIVX(*hv_fetch(dups, name, nlen, 0)); ++ else ++ (void)hv_store(dups, name, nlen, newSViv(1), 0); ++ ++ Safefree(name); ++ } ++ else { ++ sv = newSVpv(s+1, 0); ++ } ++ (void)hv_store(hv, old_var, nlen, sv, 0); + if (env_is_not_environ) + mg_set(sv); + } ++ if (HvKEYS(dups)) { ++ /* environ has some duplicate definitions, remove them */ ++ HE *entry; ++ hv_iterinit(dups); ++ while ((entry = hv_iternext_flags(dups, 0))) { ++ STRLEN nlen; ++ const char *name = HePV(entry, nlen); ++ IV count = SvIV(HeVAL(entry)); ++ IV i; ++ SV **valp = hv_fetch(hv, name, nlen, 0); ++ ++ assert(valp); ++ ++ /* try to remove any duplicate names, depending on the ++ * implementation used in my_setenv() the iteration might ++ * not be necessary, but let's be safe. ++ */ ++ for (i = 0; i < count; ++i) ++ my_setenv(name, 0); ++ ++ /* and set it back to the value we set $ENV{name} to */ ++ my_setenv(name, SvPV_nolen(*valp)); ++ } ++ } ++ SvREFCNT_dec_NN(dups); + } + #endif /* USE_ENVIRON_ARRAY */ + #endif /* !PERL_MICRO */ diff --git a/abs/core/perl/ChangeLog b/abs/core/perl/ChangeLog deleted file mode 100644 index 9add39e..0000000 --- a/abs/core/perl/ChangeLog +++ /dev/null @@ -1,66 +0,0 @@ -2011-06-22 Angel Velasquez - * Added a patch for ExtUtils doesnt overwrite CFLAGS and LDFLAGS - * Fixed #FS22197, FS#22441, FS#24767 - * Rebuilt perl 5.14.1-2 against db 5.2.28 - -2011-06-16 Angel Velasquez - * Fixed #FS24660 - * Rebuilt against db 5.2.28 - -2011-05-16 Angel Velasquez - * perl 5.14.0 - * Removed patch for h2ph warning from 5.12.3 - * Removed provides array, you can use corelist -v 5.14.0 to know the - modules included with the perl core, through Module::CoreList (thx j3nnn1 - for the tip) - -2010-11-07 kevin - - * perl 5.12.2-1 - - Using /usr/bin/*_perl for script directories - -2010-11-06 kevin - - - Removed otherlibdirs directive from Configure - - Removed /usr/*/perl5/site_perl/5.10.1 from INC - - Finally removed legacy dirs /usr/lib/perl5/current and - /usr/lib/perl5/site_perl/current from @INC - -2010-05-23 kevin - - * perl 5.12.1-2 - - Francois updated the provides array. - -2010-05-23 kevin - - * perl 5.12.1-1 - -2010-05-16 kevin - - * perl 5.12.0-2 - -2010-05-12 kevin - - - FS#19411. Removed the for loop in perlbin.sh which didn't work on zsh. - This makes the loop variables unnecessary so the script no longer - pollutes the user's environment. - - FS#19427. Added /usr/*/perl5/site_perl/5.10.1 to otherlibdirs to support - user built modules. - -2010-05-09 kevin - - * perl 5.12.0-1 - - Modified perlbin.sh to only add existing dirs to PATH. Fixes FS#17402, - path points to non-existant directories - -2010-05-07 kevin - - - Added this changelog. - - Added -Dinc_version_list=none to fix FS#19136, double entry in @INC. - This removes the duplicates and versioned directory entries. - - Change scriptdirs to /usr/lib/perl5/{core,vendor,site}_perl/bin to fix - Fix FS#13808, binaries don't follow FHS. - - Stopped using versioned directories in sitelib and sitearch. - - -# vim: set ft=changelog ts=4 sw=4 et: diff --git a/abs/core/perl/PKGBUILD b/abs/core/perl/PKGBUILD index 58b94e7..8f56681 100644 --- a/abs/core/perl/PKGBUILD +++ b/abs/core/perl/PKGBUILD @@ -1,33 +1,159 @@ -# $Id: PKGBUILD 160587 2012-06-02 10:54:59Z bluewind $ -# Maintainer: Angel Velasquez +# $Id$ +# Maintainer: Florian Pritz +# Contributor: Angel Velasquez # Contributor: kevin # Contributor: judd -# Contributor: francois +# Contributor: francois + pkgname=perl -pkgver=5.16.0 -pkgrel=2 +pkgver=5.26.2 +_baseversion="${pkgver%.*}" +pkgrel=1 pkgdesc="A highly capable, feature-rich programming language" -arch=(i686 x86_64) +arch=(x86_64) license=('GPL' 'PerlArtistic') url="http://www.perl.org" groups=('base') -depends=('gdbm' 'db' 'coreutils' 'glibc' 'sh') -changelog=ChangeLog -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=('15a2f95fb27231e10998240f13acf961' - '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 +depends=('gdbm' 'db' 'glibc') +# NOTE: This array is automatically generated by `./patchprov`. +# If you want to add entries, do so in the next array. +provides=('perl-archive-tar=2.24' + 'perl-attribute-handlers=0.99' + 'perl-autodie=2.29' + 'perl-autoloader=5.74' + 'perl-autouse=1.11' + 'perl-b-debug=1.24' + 'perl-base=2.26' + 'perl-bignum=0.47' + 'perl-carp=1.42' + 'perl-compress-raw-bzip2=2.074' + 'perl-compress-raw-zlib=2.074' + 'perl-config-perl-v=0.28' + 'perl-constant=1.33' + 'perl-cpan-meta-requirements=2.140' + 'perl-cpan-meta-yaml=0.018' + 'perl-cpan-meta=2.150010' + 'perl-cpan=2.18' + 'perl-data-dumper=2.167' + 'perl-db_file=1.840' + 'perl-devel-ppport=3.35' + 'perl-devel-selfstubber=1.06' + 'perl-digest-md5=2.55' + 'perl-digest-sha=5.96' + 'perl-digest=1.17_01' + 'perl-dumpvalue=1.18' + 'perl-encode=2.88' + 'perl-encoding-warnings=0.13' + 'perl-env=1.04' + 'perl-experimental=0.016' + 'perl-exporter=5.72' + 'perl-extutils-cbuilder=0.280225' + 'perl-extutils-constant=0.23' + 'perl-extutils-install=2.04' + 'perl-extutils-makemaker=7.24' + 'perl-extutils-manifest=1.70' + 'perl-extutils-parsexs=3.34' + 'perl-file-fetch=0.52' + 'perl-file-path=2.12_01' + 'perl-file-temp=0.2304' + 'perl-filter-simple=0.93' + 'perl-filter-util-call=1.55' + 'perl-getopt-long=2.49' + 'perl-http-tiny=0.070' + 'perl-i18n-collate=1.02' + 'perl-i18n-langtags=0.42' + 'perl-if=0.0606' + 'perl-io-compress=2.074' + 'perl-io-socket-ip=0.38' + 'perl-io-zlib=1.10' + 'perl-io=1.38' + 'perl-ipc-cmd=0.96' + 'perl-ipc-sysv=2.07' + 'perl-json-pp=2.27400_02' + 'perl-lib=0.64' + 'perl-libnet=3.10' + 'perl-locale-codes=3.42' + 'perl-locale-maketext-simple=0.21_01' + 'perl-locale-maketext=1.28' + 'perl-math-bigint-fastcalc=0.5005' + 'perl-math-bigint=1.999806' + 'perl-math-bigrat=0.2611' + 'perl-math-complex=1.5901' + 'perl-memoize=1.03_01' + 'perl-mime-base64=3.15' + 'perl-module-corelist=5.20180414_26' + 'perl-module-load-conditional=0.68' + 'perl-module-load=0.32' + 'perl-module-loaded=0.08' + 'perl-module-metadata=1.000033' + 'perl-net-ping=2.55' + 'perl-params-check=0.38' + 'perl-parent=0.236' + 'perl-pathtools=3.67' + 'perl-perl-ostype=1.010' + 'perl-perlfaq=5.021011' + 'perl-perlio-via-quotedprint=0.08' + 'perl-pod-checker=1.73' + 'perl-pod-escapes=1.07' + 'perl-pod-parser=1.63' + 'perl-pod-perldoc=3.28' + 'perl-pod-simple=3.35' + 'perl-pod-usage=1.69' + 'perl-podlators=5.006' + 'perl-safe=2.40' + 'perl-scalar-list-utils=1.46_02' + 'perl-search-dict=1.07' + 'perl-selfloader=1.23' + 'perl-socket=2.020_03' + 'perl-storable=2.62' + 'perl-sys-syslog=0.35' + 'perl-term-ansicolor=4.06' + 'perl-term-cap=1.17' + 'perl-term-complete=1.403' + 'perl-term-readline=1.17' + 'perl-test-harness=3.38' + 'perl-test-simple=1.302073' + 'perl-test=1.30' + 'perl-text-abbrev=1.02' + 'perl-text-balanced=2.03' + 'perl-text-parsewords=3.30' + 'perl-text-tabs=2013.0523' + 'perl-thread-queue=3.12' + 'perl-thread-semaphore=2.13' + 'perl-threads-shared=1.56' + 'perl-threads=2.15' + 'perl-tie-file=1.02' + 'perl-tie-refhash=1.39' + 'perl-time-hires=1.9741' + 'perl-time-local=1.25' + 'perl-time-piece=1.31' + 'perl-unicode-collate=1.19' + 'perl-unicode-normalize=1.25' + 'perl-version=0.9917' + 'perl-xsloader=0.27') +# Add your own provides here +provides=(${provides[@]}) +source=(https://www.cpan.org/src/5.0/perl-${pkgver}.tar.xz + perlbin.sh + perlbin.csh + perlbin.fish + perl-binary-module-dependency-1.template + detect-old-perl-modules.sh + detect-old-perl-modules.hook) +options=('makeflags' '!purge' 'emptydirs') +sha512sums=('fd54c90da250144c81b94587c01c49fa367f84c54406f1d360ddab4a41589a7b19efc1707f95c95d6357fae66fc3f6f00bf69dd7741db114c7034a14f52be65f' + '46724344828e7f86e016f9c8d588bf52b2e764e65e0acc1a38899a530c99bc6e4fd8b46fa0d4bbd685aa2074dd5bcbf9029ac3bb3f2d0ee9adfc4f6c0745f373' + 'fc1344a02c741d61af6f6b5967f29cc6f43c2059761522b150261924dd7e1989da5254c03ffa0627accd9af01bc152edd24e84a6b59579acb9ee1900b6ce9383' + '026f8e1e81cacceaf78ec58830fb6109c5e6e9f48df835e661ca6b7b3a7d600ae002b489532adb3f292f355f6889273cc59e015f6dc32df1910883e2ab6a1bb7' + 'f865c8e4df46bbdd911e28b80b85338a01f911d36e6f2a6bd3688d5aacd96ef2082ce44f3060c7d5356705c7a42e3397cf9509a2b28b686991360aac70dc24b4' + 'bd48af7a6209f2ad51aa1747a7238ecb11607a53f61460d873202bf14b55c3b7dd6f66f4a9f2cac8a24240313789a9a44dbc81b73587de46a6b1866bdfca5e26' + '6b5b2ba606d443da22c6c1a754829abd36f3fdfef1089bcf06c8f9db0217f2c2f02ebc14958ffa7afe618c9a80bd1025e76704f67466c0c3db7d40ef2c0e56b3') +# https://www.cpan.org/src/5.0/perl-$pkgver.tar.xz.sha256.txt + +prepare() { + cd ${srcdir}/${pkgname}-${pkgver} + +} build() { cd ${srcdir}/${pkgname}-${pkgver} @@ -35,19 +161,19 @@ build() { if [ "${CARCH}" = "x86_64" ]; then # for x86_64 arch_opts="-Dcccdlflags='-fPIC'" - else + else # for i686 arch_opts="" fi ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \ - -Dprefix=/usr -Dinstallprefix=${pkgdir}/usr -Dvendorprefix=/usr \ + -Dprefix=/usr -Dvendorprefix=/usr \ -Dprivlib=/usr/share/perl5/core_perl \ - -Darchlib=/usr/lib/perl5/core_perl \ + -Darchlib=/usr/lib/perl5/$_baseversion/core_perl \ -Dsitelib=/usr/share/perl5/site_perl \ - -Dsitearch=/usr/lib/perl5/site_perl \ + -Dsitearch=/usr/lib/perl5/$_baseversion/site_perl \ -Dvendorlib=/usr/share/perl5/vendor_perl \ - -Dvendorarch=/usr/lib/perl5/vendor_perl \ + -Dvendorarch=/usr/lib/perl5/$_baseversion/vendor_perl \ -Dscriptdir=/usr/bin/core_perl \ -Dsitescript=/usr/bin/site_perl \ -Dvendorscript=/usr/bin/vendor_perl \ @@ -64,20 +190,22 @@ check() { } 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 install + make DESTDIR="$pkgdir" install + + for template in "$srcdir/"*.template; do + install -Dm644 "$template" "$pkgdir/usr/share/makepkg-template/${template##*/}" + done + ln -s perl-binary-module-dependency-1.template "$pkgdir/usr/share/makepkg-template/"perl-binary-module-dependency.template ### Perl Settings ### # Change man page extensions for site and vendor module builds. - # Use archlinux email address instead of my own. + # 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/'.*'/'kevin@archlinux.org'/" \ - -e "/^perladmin=/ s/'.*'/'kevin@archlinux.org'/" \ - -i ${pkgdir}/usr/lib/perl5/core_perl/Config_heavy.pl + -e "/^cf_email=/ s/'.*'/''/" \ + -e "/^perladmin=/ s/'.*'/''/" \ + -i ${pkgdir}/usr/lib/perl5/$_baseversion/core_perl/Config_heavy.pl ### CPAN Settings ### # Set CPAN default config to use the site directories. @@ -85,32 +213,27 @@ package() { -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 \ + install -D -m644 ${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 \ + # Profile script to set paths to perl scripts on csh. (FS#22441) + install -D -m644 ${srcdir}/perlbin.csh \ ${pkgdir}/etc/profile.d/perlbin.csh + # Profile script to set paths to perl scripts on fish. (FS#51191) + install -D -m 755 "$srcdir/perlbin.fish" \ + "$pkgdir/usr/share/fish/vendor_conf.d/perlbin.fish" - (cd ${pkgdir}/usr/bin; mv perl${pkgver} perl) - (cd ${pkgdir}/usr/bin/core_perl; ln -sf c2ph pstruct; ln -sf s2p psed) - grep -Rl "${pkgdir}" ${pkgdir}/usr | \ - xargs sed -i "s^${pkgdir}^^g" - - # 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 + # Add the dirs so new installs will already have them in PATH once they + # install their first perl programm + install -d -m755 "$pkgdir/usr/bin/vendor_perl" + install -d -m755 "$pkgdir/usr/bin/site_perl" + + #(cd ${pkgdir}/usr/bin; mv perl${pkgver} perl) + rm "$pkgdir/usr/bin/perl$pkgver" + + install -D -m755 -t "$pkgdir/usr/share/libalpm/scripts" "$srcdir/detect-old-perl-modules.sh" + install -D -m644 -t "$pkgdir/usr/share/libalpm/hooks" "$srcdir/detect-old-perl-modules.hook" + + find $pkgdir -name perllocal.pod -delete find $pkgdir -name .packlist -delete } diff --git a/abs/core/perl/detect-old-perl-modules.hook b/abs/core/perl/detect-old-perl-modules.hook new file mode 100644 index 0000000..5ff80d1 --- /dev/null +++ b/abs/core/perl/detect-old-perl-modules.hook @@ -0,0 +1,10 @@ +[Trigger] +Operation = Install +Operation = Upgrade +Type = File +Target = usr/lib/perl5/*/ + +[Action] +Description = Warn about old perl modules +When = PostTransaction +Exec = /usr/share/libalpm/scripts/detect-old-perl-modules.sh diff --git a/abs/core/perl/detect-old-perl-modules.sh b/abs/core/perl/detect-old-perl-modules.sh new file mode 100644 index 0000000..cdc8df3 --- /dev/null +++ b/abs/core/perl/detect-old-perl-modules.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +basedir=/usr/lib/perl5 +perlver=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);') + +dir_empty() { + local dir=$1 + [[ $(find $dir -maxdepth 0 -empty -exec echo empty \;) = "empty" ]] && return 0 || return 1 +} + +print_unowned_files() { + local dir=$1 + LC_ALL=C find "$dir" -type f -exec pacman -Qqo {} + |& sed -n 's/^error: No package owns \(.*\)$/\1/p' +} + +for dir in "$basedir/"*; do + if [[ "${dir##*/}" != "$perlver" ]]; then + if [[ -d "$dir" ]] && ! dir_empty "$dir"; then + pkgcount=$(pacman -Qqo "$dir" | wc -l) + if ((pkgcount > 0)); then + printf "WARNING: '%s' contains data from at least %d packages which will NOT be used by the installed perl interpreter.\n" "$dir" "$pkgcount" + printf " -> Run the following command to get a list of affected packages: pacman -Qqo '%s'\n" "$dir" + fi + + unowned_count=$(print_unowned_files "$dir" | wc -l) + if ((unowned_count > 0)); then + printf "WARNING: %d file(s) in %s are not tracked by pacman and need to be rebuilt.\n" "$unowned_count" "$dir" + printf " -> These were most likely installed directly by cpan or a similar tool.\n" + printf " Run the following command to get a list of these files:\n" + printf " LC_ALL=C find \"%s\" -type f -exec pacman -Qqo {} + |& sed -n 's/^error: No package owns \(.*\)$/\\\1/p'\n" "$dir" + fi + fi + fi +done + + diff --git a/abs/core/perl/digest_eval_hole.diff b/abs/core/perl/digest_eval_hole.diff deleted file mode 100644 index 4790413..0000000 --- a/abs/core/perl/digest_eval_hole.diff +++ /dev/null @@ -1,61 +0,0 @@ -From 4b6a7324284e7435a361c58f7ddb32fc0c635bd0 Mon Sep 17 00:00:00 2001 -From: "Michael G. Schwern" -Date: Mon, 3 Oct 2011 19:05:29 +0100 -Subject: Close the eval "require $module" security hole in - Digest->new($algorithm) - -Also the filter was incomplete. - -Bug-Debian: http://bugs.debian.org/644108 - -Patch-Name: fixes/digest_eval_hole.diff ---- - cpan/Digest/Digest.pm | 6 ++++-- - cpan/Digest/t/security.t | 14 ++++++++++++++ - 2 files changed, 18 insertions(+), 2 deletions(-) - create mode 100644 cpan/Digest/t/security.t - -diff --git a/cpan/Digest/Digest.pm b/cpan/Digest/Digest.pm -index 384dfc8..d714434 100644 ---- a/cpan/Digest/Digest.pm -+++ b/cpan/Digest/Digest.pm -@@ -24,7 +24,7 @@ sub new - shift; # class ignored - my $algorithm = shift; - my $impl = $MMAP{$algorithm} || do { -- $algorithm =~ s/\W+//; -+ $algorithm =~ s/\W+//g; - "Digest::$algorithm"; - }; - $impl = [$impl] unless ref($impl); -@@ -35,7 +35,9 @@ sub new - ($class, @args) = @$class if ref($class); - no strict 'refs'; - unless (exists ${"$class\::"}{"VERSION"}) { -- eval "require $class"; -+ my $pm_file = $class . ".pm"; -+ $pm_file =~ s{::}{/}g; -+ eval { require $pm_file }; - if ($@) { - $err ||= $@; - next; -diff --git a/cpan/Digest/t/security.t b/cpan/Digest/t/security.t -new file mode 100644 -index 0000000..5cba122 ---- /dev/null -+++ b/cpan/Digest/t/security.t -@@ -0,0 +1,14 @@ -+#!/usr/bin/env perl -+ -+# Digest->new() had an exploitable eval -+ -+use strict; -+use warnings; -+ -+use Test::More tests => 1; -+ -+use Digest; -+ -+$LOL::PWNED = 0; -+eval { Digest->new(q[MD;5;$LOL::PWNED = 42]) }; -+is $LOL::PWNED, 0; diff --git a/abs/core/perl/fix-h2ph-and-tests.patch b/abs/core/perl/fix-h2ph-and-tests.patch deleted file mode 100644 index a2d176e..0000000 --- a/abs/core/perl/fix-h2ph-and-tests.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 8d66b3f930dc6d88b524d103e304308ae73a46e7 Mon Sep 17 00:00:00 2001 -From: Robin Barker -Date: Thu, 22 Apr 2010 11:51:20 +0100 -Subject: [PATCH 1/1] Fix h2ph and test - ---- - lib/h2ph.t | 12 ++++++++++-- - utils/h2ph.PL | 28 +++++++++++++++++++++++----- - 2 files changed, 33 insertions(+), 7 deletions(-) - -diff --git a/lib/h2ph.t b/lib/h2ph.t -index 27dd7b9..8d62d46 100644 ---- a/lib/h2ph.t -+++ b/lib/h2ph.t -@@ -18,7 +18,7 @@ if (!(-e $extracted_program)) { - exit 0; - } - --plan(4); -+plan(5); - - # quickly compare two text files - sub txt_compare { -@@ -41,8 +41,16 @@ $result = runperl( progfile => 'lib/h2ph.pht', - stderr => 1 ); - like( $result, qr/syntax OK$/, "output compiles"); - -+$result = runperl( progfile => '_h2ph_pre.ph', -+ switches => ['-c'], -+ stderr => 1 ); -+like( $result, qr/syntax OK$/, "preamble compiles"); -+ - $result = runperl( switches => ["-w"], -- prog => '$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);'); -+ stderr => 1, -+ prog => <<'PROG' ); -+$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht); -+PROG - is( $result, '', "output free of warnings" ); - - # cleanup -diff --git a/utils/h2ph.PL b/utils/h2ph.PL -index 8f56db4..1255807 100644 ---- a/utils/h2ph.PL -+++ b/utils/h2ph.PL -@@ -401,7 +401,10 @@ if ($opt_e && (scalar(keys %bad_file) > 0)) { - exit $Exit; - - sub expr { -- $new = '"(assembly code)"' and return if /\b__asm__\b/; # freak out. -+ if (/\b__asm__\b/) { # freak out -+ $new = '"(assembly code)"'; -+ return -+ } - my $joined_args; - if(keys(%curargs)) { - $joined_args = join('|', keys(%curargs)); -@@ -770,7 +773,7 @@ sub inc_dirs - sub build_preamble_if_necessary - { - # Increment $VERSION every time this function is modified: -- my $VERSION = 2; -+ my $VERSION = 3; - my $preamble = "$Dest_dir/_h2ph_pre.ph"; - - # Can we skip building the preamble file? -@@ -798,7 +801,16 @@ sub build_preamble_if_necessary - # parenthesized value: d=(v) - $define{$_} = $1; - } -- if ($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) { -+ if (/^(\w+)\((\w)\)$/) { -+ my($macro, $arg) = ($1, $2); -+ my $def = $define{$_}; -+ $def =~ s/$arg/\$\{$arg\}/g; -+ print PREAMBLE < +## + +use warnings; +use strict; + +sub err +{ + print STDERR "patchprov: error: @_\n"; + exit 1; +} + +## Extract the dist. name from its containing directory. +sub path_dist +{ + my($path) = @_; + $path =~ s{^.*/}{}; + return $path; +} + +## Create a path like $path/lib/Foo/Bar.pm for Foo::Bar. +sub lib_modpath +{ + my($path, $modname) = @_; + $modname =~ s{::}{/}g; + return "$path/lib/$modname.pm"; +} + +## Create a path to a file in the containing directory, named after +## the last segment of the module name, with suffix attached. +sub dumb_modpath +{ + my($path, $modname, $suffix) = @_; + $modname =~ s{^.*::}{}; + return "$path/$modname$suffix"; +} + +## Find a source file contained in the directory that we can scrape the +## perl versions string from. +my %distmods = ( + 'PathTools' => 'Cwd', + 'Scalar-List-Utils' => 'List::Util', + 'IO-Compress' => 'IO::Compress::Gzip', +); +sub dist_srcpath +{ + my($path) = @_; + my $distname = path_dist($path); + my $modname; + if(exists $distmods{$distname}){ + $modname = $distmods{$distname}; + }else{ + $modname = $distname; + $modname =~ s/-/::/g; + } + my @srcpaths = ( + lib_modpath($path, $modname), + dumb_modpath($path, $modname, '.pm'), + dumb_modpath($path, $modname, '_pm.PL'), + "$path/VERSION", # for podlators + ); + for my $src (@srcpaths){ + return $src if(-f $src); + } + return undef; +} + +## Scrape the version string for the module file or Makefile.PL. +sub scrape_verln +{ + my($srcpath) = @_; + open my $fh, '<', $srcpath or die "open: $!"; + while(my $ln = <$fh>){ + if($ln =~ s/^.*VERSION *=>? *//){ + close $fh; + return $ln; + } + } + close $fh; + err("failed to find VERSION in $srcpath"); +} + +## Scrape the version string from the module source file. +sub scrape_modver +{ + my($srcpath) = @_; + return scrape_verln($srcpath); +} + +## Scrape the version string from the Makefile.PL. (for libnet) +sub scrape_mkplver +{ + my($srcpath) = @_; + my $verln = scrape_verln($srcpath); + $verln =~ s/,/;/; + return $verln; +} + +## Scrape the version string from a file inside the dist dir. +sub distpath_ver +{ + my($distpath) = @_; + my $srcpath = dist_srcpath($distpath); + my $mkplpath = "$distpath/Makefile.PL"; + if(defined $srcpath){ + return scrape_modver($srcpath); + }elsif(-f $mkplpath){ + return scrape_mkplver($mkplpath); + }else{ + err("failed to scrape version from $distpath"); + } +} + +## Search the base path for the dist dirs and extract their respective +## version strings. +sub find_distvers +{ + my($basepath) = @_; + opendir my $dh, $basepath or die "opendir: $!"; + my @dirs = grep { -d $_ } map { "$basepath/$_" } grep { !/^[.]/ } readdir $dh; + closedir $dh; + + my @distvers; + for my $dpath (@dirs){ + push @distvers, [ path_dist($dpath), distpath_ver($dpath) ]; + } + return @distvers; +} + +## Maps an aref of dist name/perl version strings (perl expressions) to +## a package name and version string suitable for a PKGBUILD. +sub pkgspec +{ + my($dist, $ver) = @$_; + $dist =~ tr/A-Z/a-z/; + $ver = eval $ver; + return "perl-$dist=$ver"; +} + +## Searches the perl source dir provided for a list of packages which +## correspond to the core distributions bundled within in. +sub perlcorepkgs +{ + my($perlpath) = @_; + my @dirs = ("$perlpath/cpan", "$perlpath/dist"); + my @provs; + for my $d (@dirs){ + if(!-d $d){ + err("$d is not a valid directory"); + } + push @provs, map pkgspec, find_distvers($d); + } + return @provs; +} + +## Formats the provided lines into a neatly formatted bash array. The first arg +## is the name of the bash variable to assign it to. +sub basharray +{ + my $vname = shift; + + ## Sort entries and surround with quotes. + my @lns = sort map { qq{'$_'} } @_; + $lns[0] = "$vname=($lns[0]"; + + ## Indent lines for OCD geeks. + if(@lns > 1){ + my $ind = length($vname) + 2; + splice @lns, 1, @lns-1, + map { (' ' x $ind) . $_ } @lns[1 .. $#lns]; + } + + $lns[$#lns] .= ')'; + return map { "$_\n" } @lns; +} + +## Patch the PKGBUILD at the given path with a new provides array, overwriting +## the old one. +sub patchpb +{ + my $pbpath = shift; + open my $fh, '<', $pbpath or die "open: $!"; + my @lines = <$fh>; + close $fh; + + my($i, $j); + for($i = 0; $i < @lines; $i++){ + last if($lines[$i] =~ /^provides=/); + } + if($i == @lines){ + err("failed to find provides array in PKGBUILD"); + } + for($j = $i; $j < @lines; $j++){ + last if($lines[$j] =~ /[)]/); + } + if($j == @lines){ + err("failed to find end of provides array"); + } + + splice @lines, $i, $j-$i+1, + basharray('provides', grep { !/win32|next/ } @_); + + ## Avoid corrupting the existing PKGBUILD in case of a crash, etc. + if(-f "$pbpath.$$"){ + err("pbpath.$$ temporary file already exists, please remove it."); + } + open $fh, '>', "$pbpath.$$" or die "open: $!"; + print $fh @lines; + close $fh or die "close: $!"; + rename "$pbpath.$$", "$pbpath" or die "rename: $!"; + + return; +} + +## Program entrypoint. +sub main +{ + if(@_ < 2){ + print STDERR "usage: $0 [perl source path] [PKGBUILD path]\n"; + exit 2; + } + my($perlpath, $pbpath) = @_; + if(!-f $pbpath){ + err("$pbpath is not a valid file."); + }elsif(!-d $perlpath){ + err("$perlpath is not a valid directory."); + }else{ + patchpb($pbpath, perlcorepkgs($perlpath)); + } + exit 0; +} + +main(@ARGV); + +# EOF diff --git a/abs/core/perl/perl-binary-module-dependency-1.template b/abs/core/perl/perl-binary-module-dependency-1.template new file mode 100644 index 0000000..822ee91 --- /dev/null +++ b/abs/core/perl/perl-binary-module-dependency-1.template @@ -0,0 +1,5 @@ +if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then + _perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);') + _perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);') + depends+=("perl>=$_perlver_min" "perl<$_perlver_max") +fi diff --git a/abs/core/perl/perl.install b/abs/core/perl/perl.install deleted file mode 100644 index a355c5b..0000000 --- a/abs/core/perl/perl.install +++ /dev/null @@ -1,10 +0,0 @@ -# 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 -} - diff --git a/abs/core/perl/perlbin.csh b/abs/core/perl/perlbin.csh index 535f0b1..fccecbd 100644 --- a/abs/core/perl/perlbin.csh +++ b/abs/core/perl/perlbin.csh @@ -1,5 +1,5 @@ # Set path to perl scriptdirs if they exist -# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts +# 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 diff --git a/abs/core/perl/perlbin.fish b/abs/core/perl/perlbin.fish new file mode 100644 index 0000000..1f52ebb --- /dev/null +++ b/abs/core/perl/perlbin.fish @@ -0,0 +1,10 @@ +# Set path to perl scriptdirs if they exist +# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts + +if status --is-login + for perldir in /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl + if test -d $perldir + set PATH $PATH $perldir + end + end +end diff --git a/abs/core/perl/perlbin.sh b/abs/core/perl/perlbin.sh index 20f8304..7e38f20 100755 --- a/abs/core/perl/perlbin.sh +++ b/abs/core/perl/perlbin.sh @@ -1,5 +1,5 @@ # Set path to perl scriptdirs if they exist -# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts +# 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 diff --git a/abs/core/perl/provides.pl b/abs/core/perl/provides.pl deleted file mode 100644 index d2cdc76..0000000 --- a/abs/core/perl/provides.pl +++ /dev/null @@ -1,299 +0,0 @@ -# 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 - -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; - -@pkgs = sort { $a->[0] cmp $b->[0] } @pkgs; - -for my $pkg (@pkgs) { - my ($name, $ver) = @$pkg; - print "$name=$ver\n"; -} diff --git a/abs/core/perl/upgpkg b/abs/core/perl/upgpkg new file mode 100644 index 0000000..6a38607 --- /dev/null +++ b/abs/core/perl/upgpkg @@ -0,0 +1,4 @@ +upgpkg_build() { + makepkg -o + ./patchprov src/perl-$pkgver PKGBUILD +} -- cgit v0.12