[arch-commits] Commit in perl/trunk (PKGBUILD provides.pl)

2014-06-09 Thread Florian Pritz
Date: Monday, June 9, 2014 @ 16:54:24
  Author: bluewind
Revision: 214752

upgpkg: perl 5.20.0-3

fix missing provides entry (perl-pathtools)

Modified:
  perl/trunk/PKGBUILD
  perl/trunk/provides.pl

-+
 PKGBUILD|4 ++--
 provides.pl |   19 +++
 2 files changed, 17 insertions(+), 6 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2014-06-09 14:36:42 UTC (rev 214751)
+++ PKGBUILD2014-06-09 14:54:24 UTC (rev 214752)
@@ -7,7 +7,7 @@
 
 pkgname=perl
 pkgver=5.20.0
-pkgrel=2
+pkgrel=3
 pkgdesc="A highly capable, feature-rich programming language"
 arch=(i686 x86_64)
 license=('GPL' 'PerlArtistic')
@@ -22,7 +22,7 @@
 md5sums=('20cbecd4e9e880ee7a50a136c8b1484e'
  '5ed2542fdb9a60682f215bd33701e61a'
  '1f0cbbee783e8a6d32f01be5118e0d5e'
- '999c3eea6464860704abbb055a0f0896')
+ '03bec2035cc9b9f91eed5b46126b6623')
 
 # workaround to let the integrity check find the correct provides array
 if [[ ${0##*/} = "parse_pkgbuilds.sh" ]]; then

Modified: provides.pl
===
--- provides.pl 2014-06-09 14:36:42 UTC (rev 214751)
+++ provides.pl 2014-06-09 14:54:24 UTC (rev 214752)
@@ -44,10 +44,17 @@
 
 package Dists;
 
+my %RENAME = (
+'PathTools' => 'Cwd', # perl 5.20 moved dist/Cwd/ to dist/PathTools/
+);
+
 sub maindistfile
 {
 my ($dist, $dir) = @_;
 
+# Override unguessable main module names.
+$dist = $RENAME{$dist} if exists $RENAME{$dist};
+
 # libpath is the modern style, installing modules under lib/
 # with dirs matching the name components.
 my $libpath = join q{/}, 'lib', split /-/, "${dist}.pm";
@@ -63,7 +70,10 @@
 # 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; }
+@paths = map { "$dir/$_" } @paths;
+for my $path (@paths) {
+return $path if -f $path;
+}
 return undef;
 }
 
@@ -271,9 +281,10 @@
 
 package main;
 
-my %CPANNAME = ('List-Util' => 'Scalar-List-Utils',
-'Text-Tabs' => 'Text-Tabs+Wrap',
-'Cwd'   => 'PathTools');
+my %CPANNAME = (
+'List-Util' => 'Scalar-List-Utils',
+'Text-Tabs' => 'Text-Tabs+Wrap',
+);
 
 my $perldir = shift or die "Usage: $0 [path to perl source directory]\n";
 die "$perldir is not a valid directory." unless -d $perldir;



[arch-commits] Commit in perl/trunk (PKGBUILD provides.pl)

2012-05-24 Thread Florian Pritz
Date: Thursday, May 24, 2012 @ 07:33:49
  Author: bluewind
Revision: 159436

upgpkg: perl 5.16.0-1

upstream update

Modified:
  perl/trunk/PKGBUILD
  perl/trunk/provides.pl

-+
 PKGBUILD|   17 +
 provides.pl |   31 ++-
 2 files changed, 27 insertions(+), 21 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2012-05-24 09:52:25 UTC (rev 159435)
+++ PKGBUILD2012-05-24 11:33:49 UTC (rev 159436)
@@ -4,8 +4,8 @@
 # Contributor: judd 
 # Contributor: francois  
 pkgname=perl
-pkgver=5.14.2
-pkgrel=7
+pkgver=5.16.0
+pkgrel=1
 pkgdesc="A highly capable, feature-rich programming language"
 arch=(i686 x86_64)
 license=('GPL' 'PerlArtistic')
@@ -16,17 +16,13 @@
 source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2 
 perlbin.sh
 perlbin.csh
-provides.pl
-digest_eval_hole.diff
-0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch)
+provides.pl)
 install=perl.install
 options=('makeflags' '!purge')
-md5sums=('04a4c5d3c1f9f19d77daff8e8cd19a26'
+md5sums=('15a2f95fb27231e10998240f13acf961'
  '5ed2542fdb9a60682f215bd33701e61a'
  '1f0cbbee783e8a6d32f01be5118e0d5e'
- '31fc0b5bb4935414394c5cfbec2cb8e5'
- '490852b3d77c3b3866d0d75f5fbf5c5d'
- 'c25d86206d649046538c3daab7874564')
+ '999c3eea6464860704abbb055a0f0896')
 
 # workaround to let the integrity check find the correct provides array
 if [[ ${0##*/} = "parse_pkgbuilds.sh" ]]; then
@@ -44,8 +40,6 @@
 arch_opts=""
   fi
 
-  patch -Np1 -i $srcdir/digest_eval_hole.diff
-
   ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
 -Dprefix=/usr -Dinstallprefix=${pkgdir}/usr -Dvendorprefix=/usr \
 -Dprivlib=/usr/share/perl5/core_perl \
@@ -60,7 +54,6 @@
 -Dinc_version_list=none \
 -Dman1ext=1perl -Dman3ext=3perl ${arch_opts} \
 -Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
-  patch -Np1 -i 
$srcdir/0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch
   make
 }
 

Modified: provides.pl
===
--- provides.pl 2012-05-24 09:52:25 UTC (rev 159435)
+++ provides.pl 2012-05-24 11:33:49 UTC (rev 159436)
@@ -1,9 +1,16 @@
 # provides.pl
 ##
 # Script for printing out a provides list of every CPAN distribution
-# that is bundled with perl.
+# 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.
 #
-# Justin Davis 
+# 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;
@@ -13,21 +20,26 @@
 sub evalver
 {
 my ($path, $mod) = @_;
-$mod ||= "";
 
 open my $fh, '<', $path or die "open $path: $!";
 
-while (<$fh>) {
-next unless /\s*(?:\$${mod}::|\$)VERSION\s*=\s*(.+)/;
-my $ver = eval $1;
+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 $@;
-warn qq{$path:$. bad version string "$ver"\n};
+die qq{$path:$. bad version string in "$ln"\n};
 }
 
 close $fh;
 return undef;
 }
 
+
 #-
 
 package Dists;
@@ -143,7 +155,7 @@
 sub cpan_provider
 {
 my ($module) = @_;
-my $url = "http://cpanmetadb.appspot.com/v1.0/package/$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'};
@@ -169,6 +181,7 @@
 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);
@@ -194,7 +207,7 @@
 $mod =~ s{\A$libdir}{};
 $mod =~ s{/}{::}g;
 
-my $ver = Common::evalver($path) || q{};
+my $ver = Common::evalver($path, $mod) || q{};
 push @mods, [ $mod, $ver ];
 }
 



[arch-commits] Commit in perl/trunk (PKGBUILD provides.pl)

2011-09-02 Thread Florian Pritz
Date: Friday, September 2, 2011 @ 04:17:26
  Author: bluewind
Revision: 136840

provides.pl upstream update

Modified:
  perl/trunk/PKGBUILD
  perl/trunk/provides.pl

-+
 PKGBUILD|4 ++--
 provides.pl |   22 ++
 2 files changed, 20 insertions(+), 6 deletions(-)

Modified: PKGBUILD
===
--- PKGBUILD2011-09-02 08:13:37 UTC (rev 136839)
+++ PKGBUILD2011-09-02 08:17:26 UTC (rev 136840)
@@ -5,7 +5,7 @@
 # Contributor: francois  
 pkgname=perl
 pkgver=5.14.1
-pkgrel=4
+pkgrel=5
 pkgdesc="A highly capable, feature-rich programming language"
 arch=(i686 x86_64)
 license=('GPL' 'PerlArtistic')
@@ -23,7 +23,7 @@
 md5sums=('97cd306a2c22929cc141a09568f43bb0'
  '5ed2542fdb9a60682f215bd33701e61a'
  '1f0cbbee783e8a6d32f01be5118e0d5e'
- '6124591798c83c386975f7ef35514f0e'
+ '31fc0b5bb4935414394c5cfbec2cb8e5'
  'c25d86206d649046538c3daab7874564')
 
 build() {

Modified: provides.pl
===
--- provides.pl 2011-09-02 08:13:37 UTC (rev 136839)
+++ provides.pl 2011-09-02 08:17:26 UTC (rev 136840)
@@ -258,15 +258,29 @@
 
 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 = sort { $a->[0] cmp $b->[0] }
-(Dists::find($perldir), Modules::find($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};
+}
 
-for my $dist (@dists) {
-my ($name, $ver) = @$dist;
+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";
 }



[arch-commits] Commit in perl/trunk (PKGBUILD provides.pl)

2011-08-19 Thread Florian Pritz
Date: Friday, August 19, 2011 @ 04:48:25
  Author: bluewind
Revision: 135839

use script to generate provides array

Added:
  perl/trunk/provides.pl
Modified:
  perl/trunk/PKGBUILD

-+
 PKGBUILD|8 +
 provides.pl |  272 ++
 2 files changed, 279 insertions(+), 1 deletion(-)

Modified: PKGBUILD
===
--- PKGBUILD2011-08-19 08:37:20 UTC (rev 135838)
+++ PKGBUILD2011-08-19 08:48:25 UTC (rev 135839)
@@ -5,7 +5,7 @@
 # Contributor: francois  
 pkgname=perl
 pkgver=5.14.1
-pkgrel=3
+pkgrel=4
 pkgdesc="A highly capable, feature-rich programming language"
 arch=(i686 x86_64)
 license=('GPL' 'PerlArtistic')
@@ -16,12 +16,14 @@
 source=(http://www.cpan.org/src/5.0/perl-${pkgver}.tar.bz2 
 perlbin.sh
 perlbin.csh
+provides.pl
 0001-Append-CFLAGS-and-LDFLAGS-to-their-Config.pm-counter.patch)
 install=perl.install
 options=('!makeflags' '!purge')
 md5sums=('97cd306a2c22929cc141a09568f43bb0'
  '5ed2542fdb9a60682f215bd33701e61a'
  '1f0cbbee783e8a6d32f01be5118e0d5e'
+ '6124591798c83c386975f7ef35514f0e'
  'c25d86206d649046538c3daab7874564')
 
 build() {
@@ -52,6 +54,10 @@
   make
 }
 package() {
+  # hack to work around makepkg running the subshell in check_sanity()
+  new_provides=($(cd "$srcdir/perl-$pkgver"; ./perl -Ilib 
"$srcdir/provides.pl" .))
+  provides=(${new_provides[@]})
+
   cd ${srcdir}/${pkgname}-${pkgver}
   make install
 

Added: provides.pl
===
--- provides.pl (rev 0)
+++ provides.pl 2011-08-19 08:48:25 UTC (rev 135839)
@@ -0,0 +1,272 @@
+# provides.pl
+##
+# Script for printing out a provides list of every CPAN distribution
+# that is bundled with perl.
+#
+# Justin Davis 
+
+use warnings 'FATAL' => 'all';
+use strict;
+
+package Common;
+
+sub evalver
+{
+my ($path, $mod) = @_;
+$mod ||= "";
+
+open my $fh, '<', $path or die "open $path: $!";
+
+while (<$fh>) {
+next unless /\s*(?:\$${mod}::|\$)VERSION\s*=\s*(.+)/;
+my $ver = eval $1;
+return $ver unless $@;
+warn qq{$path:$. bad version string "$ver"\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}";
+}
+
+#---