From 8735a5c54cf26dd5b5b686850f800a4aed49ff78 Mon Sep 17 00:00:00 2001 From: Parabola Date: Fri, 8 Jun 2012 19:37:29 +0000 Subject: Fri Jun 8 19:37:17 UTC 2012 --- ...GS-and-LDFLAGS-to-their-Config.pm-counter.patch | 83 ------ testing/perl/ChangeLog | 66 ----- testing/perl/PKGBUILD | 116 -------- testing/perl/digest_eval_hole.diff | 61 ----- testing/perl/fix-h2ph-and-tests.patch | 104 ------- testing/perl/perl.install | 10 - testing/perl/perlbin.csh | 15 -- testing/perl/perlbin.sh | 18 -- testing/perl/provides.pl | 299 --------------------- 9 files changed, 772 deletions(-) delete mode 100644 testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch delete mode 100644 testing/perl/ChangeLog delete mode 100644 testing/perl/PKGBUILD delete mode 100644 testing/perl/digest_eval_hole.diff delete mode 100644 testing/perl/fix-h2ph-and-tests.patch delete mode 100644 testing/perl/perl.install delete mode 100644 testing/perl/perlbin.csh delete mode 100755 testing/perl/perlbin.sh delete mode 100644 testing/perl/provides.pl (limited to 'testing/perl') diff --git a/testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch b/testing/perl/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch deleted file mode 100644 index 1404460df..000000000 --- a/testing/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/testing/perl/ChangeLog b/testing/perl/ChangeLog deleted file mode 100644 index 9add39e20..000000000 --- a/testing/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/testing/perl/PKGBUILD b/testing/perl/PKGBUILD deleted file mode 100644 index 316c1b0f5..000000000 --- a/testing/perl/PKGBUILD +++ /dev/null @@ -1,116 +0,0 @@ -# $Id: PKGBUILD 159947 2012-05-27 08:08:09Z bluewind $ -# Maintainer: Angel Velasquez -# Contributor: kevin -# Contributor: judd -# Contributor: francois -pkgname=perl -pkgver=5.16.0 -pkgrel=2 -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') -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 - -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 -Dinstallprefix=${pkgdir}/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 -# 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 install - - ### Perl Settings ### - # Change man page extensions for site and vendor module builds. - # Use archlinux email address instead of my own. - 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 - - ### 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) - 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 - find $pkgdir -name .packlist -delete -} diff --git a/testing/perl/digest_eval_hole.diff b/testing/perl/digest_eval_hole.diff deleted file mode 100644 index 47904137b..000000000 --- a/testing/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/testing/perl/fix-h2ph-and-tests.patch b/testing/perl/fix-h2ph-and-tests.patch deleted file mode 100644 index a2d176ec6..000000000 --- a/testing/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 '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"; -} -- cgit v1.2.3-54-g00ecf