r70212 - in /branches/upstream/libmodule-scandeps-perl/current: AUTHORS Changes MANIFEST META.yml lib/Module/ScanDeps.pm t/7-check-dynaloader.t t/9-check_path_to_inc_name.t t/data/use_lib.pl

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Wed Mar 2 01:57:40 UTC 2011


Author: jawnsy-guest
Date: Wed Mar  2 01:57:33 2011
New Revision: 70212

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70212
Log:
[svn-upgrade] new version libmodule-scandeps-perl (1.00)

Added:
    branches/upstream/libmodule-scandeps-perl/current/t/data/use_lib.pl
Modified:
    branches/upstream/libmodule-scandeps-perl/current/AUTHORS
    branches/upstream/libmodule-scandeps-perl/current/Changes
    branches/upstream/libmodule-scandeps-perl/current/MANIFEST
    branches/upstream/libmodule-scandeps-perl/current/META.yml
    branches/upstream/libmodule-scandeps-perl/current/lib/Module/ScanDeps.pm
    branches/upstream/libmodule-scandeps-perl/current/t/7-check-dynaloader.t
    branches/upstream/libmodule-scandeps-perl/current/t/9-check_path_to_inc_name.t

Modified: branches/upstream/libmodule-scandeps-perl/current/AUTHORS
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/AUTHORS?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/AUTHORS (original)
+++ branches/upstream/libmodule-scandeps-perl/current/AUTHORS Wed Mar  2 01:57:33 2011
@@ -18,6 +18,7 @@
 David Romano
 Dominique Quatravaux          (DOMQ)
 Edward S. Peschko
+Eric J. Roode                 (ROODE)
 Eric Wilhelm
 Germain Garand                (GGARAND)
 Iain Cass

Modified: branches/upstream/libmodule-scandeps-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/Changes?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/Changes (original)
+++ branches/upstream/libmodule-scandeps-perl/current/Changes Wed Mar  2 01:57:33 2011
@@ -1,3 +1,23 @@
+[Changes for 1.00 - 2011-02-19]
+* RT #65855: Special handling for POSIX requested (Roderich Schupp)
+* RT #65252: Temp files left when execute fails (Roderich Schupp)
+* add a %Preload rule for Log::Report::Dispatcher (Roderich Schupp)
+  cf. http://www.nntp.perl.org/group/perl.par/2011/01/msg4871.html
+* add %Preload rule for Date::Manip (Roderich Schupp)
+* speed up scanning *significantly* by not re-constructing regexen
+  for every line of input and reducing the no. of sub calls (Steffen Mueller)
+* add Eric Roode to AUTHORS (Steffen Mueller)
+* RT #61027: "use lib" does not work (Roderich Schupp)
+  scan_line(): When handling "use lib '/some/dir'" we add "/some/dir/ARCHNAME",
+  "/some/dir/VER" and "/some/dir/VER/ARCHNAME", but forgot 
+  to add "/some/dir" itself.
+  While we're at it, improve parsing the argument list of "use lib".
+  Simply eval the string, this should at least make all forms of
+  quoted strings work correctly. 
+* fix URI special case (clkao)
+* fix a regression reported by CPAN Testers (Roderich Schupp)
+* finally: bump version to 1.00
+
 [Changes for 0.98 - 2010-07-26]
 * Make %Preload entry for "utf8.pm" lazy (Roderich Schupp)
 * Upgrade to Module::Install 1.00 (Roderich Schupp)
@@ -595,4 +615,3 @@
 
 * written-from-scratch version of dependency finding
   algorithm. 
-

Modified: branches/upstream/libmodule-scandeps-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/MANIFEST?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/MANIFEST (original)
+++ branches/upstream/libmodule-scandeps-perl/current/MANIFEST Wed Mar  2 01:57:33 2011
@@ -79,4 +79,5 @@
 t/data/static/TestC.pm
 t/data/static/TestD.pm
 t/data/static/useVERSION.pm
+t/data/use_lib.pl
 t/Utils.pm

Modified: branches/upstream/libmodule-scandeps-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/META.yml?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/META.yml (original)
+++ branches/upstream/libmodule-scandeps-perl/current/META.yml Wed Mar  2 01:57:33 2011
@@ -27,4 +27,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://svn.openfoundry.org/par/Module-ScanDeps/trunk/
-version: 0.98
+version: 1.00

Modified: branches/upstream/libmodule-scandeps-perl/current/lib/Module/ScanDeps.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/lib/Module/ScanDeps.pm?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/lib/Module/ScanDeps.pm (original)
+++ branches/upstream/libmodule-scandeps-perl/current/lib/Module/ScanDeps.pm Wed Mar  2 01:57:33 2011
@@ -4,7 +4,7 @@
 use warnings;
 use vars qw( $VERSION @EXPORT @EXPORT_OK @ISA $CurrentPackage @IncludeLibs $ScanFileRE );
 
-$VERSION   = '0.98';
+$VERSION   = '1.00';
 @EXPORT    = qw( scan_deps scan_deps_runtime );
 @EXPORT_OK = qw( scan_line scan_chunk add_deps scan_deps_runtime path_to_inc_name );
 
@@ -266,6 +266,14 @@
     'Crypt/Random/Generator.pm' => sub {
         _glob_in_inc('Crypt/Random/Provider', 1);
     },
+    'Date/Manip.pm' => [qw( Date/Manip/DM5.pm Date/Manip/DM6.pm )],
+    'Date/Manip/Base.pm' => sub {
+        _glob_in_inc('Date/Manip/Lang', 1);
+    },
+    'Date/Manip/TZ.pm' => sub {
+        return (_glob_in_inc('Date/Manip/TZ', 1),
+                _glob_in_inc('Date/Manip/Offset', 1));
+    },
     'DateTime/Locale.pm' => 'sub',
     'DBI.pm' => sub {
         grep !/\bProxy\b/, _glob_in_inc('DBD', 1);
@@ -315,6 +323,7 @@
     },
     'Log/Log4perl.pm' => 'sub',
     'Log/Any.pm' => 'sub',
+    'Log/Report/Dispatcher.pm' => 'sub',
     'LWP/UserAgent.pm' => sub {
         return(
             qw(
@@ -367,6 +376,11 @@
         _glob_in_inc('POE/XS/Loop', 1),
         _glob_in_inc('POE/Loop', 1),
     },
+    'POSIX.pm'                      => sub {
+        map { my $sigmod = $_;
+              map "auto/POSIX/$sigmod/$_->{name}", _glob_in_inc("auto/POSIX/$sigmod");
+            } qw( SigAction SigRt )
+    },
     'PPI.pm'                        => 'sub',
     'Parse/AFP.pm'                  => 'sub',
     'Parse/Binary.pm'               => 'sub',
@@ -415,7 +429,7 @@
         grep /\.txt$/, map "unicore/$_->{name}", _glob_in_inc('unicore', 0);
     },
     'URI.pm'            => sub {
-        grep !/.\b[_A-Z]/, _glob_in_inc('URI', 1);
+        grep !/urn/, _glob_in_inc('URI', 1);
     },
     'Win32/EventLog.pm'    => [qw( Win32/IPC.pm )],
     'Win32/Exe.pm'         => 'sub',
@@ -809,14 +823,18 @@
             return ("autouse.pm", "$autouse.pm");
         }
 
-        if (my ($libs) = /\b(?:use\s+lib\s+|(?:unshift|push)\W+\@INC\W+)(.+)/)
+        if (my ($how, $libs) = /\b(use\s+lib\s+|(?:unshift|push)\s+\@INC\s+,)(.+)/)
         {
             my $archname = defined($Config{archname}) ? $Config{archname} : '';
             my $ver = defined($Config{version}) ? $Config{version} : '';
-            foreach (grep(/\w/, split(/["';() ]/, $libs))) {
-                unshift(@INC, "$_/$ver")           if -d "$_/$ver";
-                unshift(@INC, "$_/$archname")      if -d "$_/$archname";
-                unshift(@INC, "$_/$ver/$archname") if -d "$_/$ver/$archname";
+            foreach my $dir (do { no strict; no warnings; eval $libs }) {
+                next unless defined $dir;
+                my @dirs = $dir;
+                push @dirs, "$dir/$ver", "$dir/$archname", "$dir/$ver/$archname" 
+                    if $how =~ /lib/;
+                foreach (@dirs) {
+                    unshift(@INC, $_) if -d $_;
+                }
             }
             next;
         }
@@ -828,27 +846,35 @@
 }
 
 # short helper for scan_chunk
-sub _typical_module_loader_chunk {
-  local $_ = shift;
-  my $loader = shift;
-  my $prefix='';
-  if (@_ and $_[0]) {
-    $prefix=$_[0].'::';
-  }
-  my $loader_file = $loader;
-  $loader_file =~ s/::/\//;
-  $loader_file .= ".pm";
-  $loader = quotemeta($loader);
-
-  if (/^\s* use \s+ $loader(?!\:) \b \s* (.*)/sx) {
+my %LoaderRegexp; # cache
+sub _build_loader_regexp {
+    my $loaders = shift;
+    my $prefix = (@_ && $_[0]) ? $_[0].'::' : '';
+   
+    my $loader = join '|', map quotemeta($_), split /\s+/, $loaders;
+    my $regexp = qr/^\s* use \s+ ($loader)(?!\:) \b \s* (.*)/sx;
+    # WARNING: This doesn't take the prefix into account
+    $LoaderRegexp{$loaders} = $regexp;
+    return $regexp
+}
+
+# short helper for scan_chunk
+sub _extract_loader_dependency {
+    my $loader = shift;
+    my $loadee = shift;
+    my $prefix = (@_ && $_[0]) ? $_[0].'::' : '';
+
+    my $loader_file = $loader;
+    $loader_file =~ s/::/\//;
+    $loader_file .= ".pm";
+
     return [
-      $loader_file,
-      map { my $mod="$prefix$_";$mod=~s{::}{/}g; "$mod.pm" }
-      grep { length and !/^q[qw]?$/ and !/-/ } split(/[^\w:-]+/, $1)
-      #should skip any module name that contains '-', not split it in two
+        $loader_file,
+        map { my $mod="$prefix$_"; $mod =~ s{::}{/}g; "$mod.pm" }
+        grep { length and !/^q[qw]?$/ and !/-/ }
+        split /[^\w:-]+/, $loadee
+        #should skip any module name that contains '-', not split it in two
     ];
-  }
-  return();
 }
 
 sub scan_chunk {
@@ -860,13 +886,17 @@
 
         # TODO: There's many more of these "loader" type modules on CPAN!
         # scan for the typical module-loader modules
-        foreach my $loader (qw(asa base parent prefork POE encoding maybe only::matching)) {
-          my $retval = _typical_module_loader_chunk($_, $loader);
+        my $loaders = "asa base parent prefork POE encoding maybe only::matching";
+        # grab pre-calculated regexp or re-build it (and cache it)
+        my $loader_regexp = $LoaderRegexp{$loaders} || _build_loader_regexp($loaders);
+        if ($_ =~ $loader_regexp) { # $1 == loader, $2 == loadee
+          my $retval = _extract_loader_dependency($1, $2);
           return $retval if $retval;
         }
 
-        foreach my $loader (qw(Catalyst)) {
-          my $retval = _typical_module_loader_chunk($_, $loader,'Catalyst::Plugin');
+        $loader_regexp = $LoaderRegexp{"Catalyst"} || _build_loader_regexp("Catalyst", "Catalyst::Plugin");
+        if ($_ =~ $loader_regexp) { # $1 == loader, $2 == loadee
+          my $retval = _extract_loader_dependency($1, $2, "Catalyst::Plugin");
           return $retval if $retval;
         }
 
@@ -1121,13 +1151,13 @@
 
 sub set_file {
     my $self = shift;
-    foreach my $script (@_) {
-        my ($vol, $dir, $file) = File::Spec->splitpath($script);
-        $self->{main} = {
-            key  => $file,
-            file => $script,
-        };
-    }
+    my $script = shift;
+
+    my ($vol, $dir, $file) = File::Spec->splitpath($script);
+    $self->{main} = {
+        key  => $file,
+        file => $script,
+    };
 }
 
 sub set_options {
@@ -1229,11 +1259,11 @@
     $fhout->close;
     $fhin->close;
 
-    system($perl, $fname);
-
-    _extract_info("$fname.out", $inchash, $dl_shared_objects, $incarray);
-    unlink("$fname");
-    unlink("$fname.out");
+    my $rc = system($perl, $fname);
+
+    _extract_info("$fname.out", $inchash, $dl_shared_objects, $incarray) if $rc == 0;
+    unlink("$fname", "$fname.out");
+    die "SYSTEM ERROR in compiling $file: $rc" unless $rc == 0;
 }
 
 sub _execute {
@@ -1252,11 +1282,11 @@
     $fhin->close;
 
     File::Path::rmtree( ['_Inline'], 0, 1); # XXX hack
-    system($perl, (map { "-I$_" } @IncludeLibs), $fname) == 0 or die "SYSTEM ERROR in executing $file: $?";
-
-    _extract_info("$fname.out", $inchash, $dl_shared_objects, $incarray);
-    unlink("$fname");
-    unlink("$fname.out");
+    my $rc = system($perl, (map { "-I$_" } @IncludeLibs), $fname);
+
+    _extract_info("$fname.out", $inchash, $dl_shared_objects, $incarray) if $rc == 0;
+    unlink("$fname", "$fname.out");
+    die "SYSTEM ERROR in executing $file: $rc" unless $rc == 0;
 }
 
 # create a new hashref, applying fixups

Modified: branches/upstream/libmodule-scandeps-perl/current/t/7-check-dynaloader.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/t/7-check-dynaloader.t?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/t/7-check-dynaloader.t (original)
+++ branches/upstream/libmodule-scandeps-perl/current/t/7-check-dynaloader.t Wed Mar  2 01:57:33 2011
@@ -36,8 +36,18 @@
 
 ok( $entry, 'we have some key that looks like it pulled in the Cwd or Glob shared lib' );
 
-# build a path the the Cwd library based on the entry in %INC and our Module::ScanDeps path
+# Build a path the the Cwd library based on the entry in %INC and 
+# our Module::ScanDeps path: if the module Foo::Bar was found as 
+# /some/path/Foo/Bar.pm, assume its shared library is in 
+# /some/path/auto/Foo/Bar/Bar.$dlext
 $cwd_bundle_path =~ s,(Cwd|File/Glob)\.pm$,$entry,;
+
+# NOTE: This behaviour is not really guaranteed by the way DynaLoader 
+# works, but it is a reasonable assumption for any module installed 
+# by ExtUtils::MakeMaker. But it fails when the module wasn't installed, 
+# but located via blib (where the pm file is below blib/lib, but the
+# correposnding shared library is below blib/arch). CPAN Testers does this.
+$cwd_bundle_path =~ s,\bblib\b(.)\blib\b,blib$1arch,;
 
 is( $rv->{$entry}->{file}, $cwd_bundle_path, 'the full bundle path we got looks legit' );
 

Modified: branches/upstream/libmodule-scandeps-perl/current/t/9-check_path_to_inc_name.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/t/9-check_path_to_inc_name.t?rev=70212&op=diff
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/t/9-check_path_to_inc_name.t (original)
+++ branches/upstream/libmodule-scandeps-perl/current/t/9-check_path_to_inc_name.t Wed Mar  2 01:57:33 2011
@@ -4,12 +4,12 @@
 use warnings;
 use Cwd;
 
-use Test::More tests => 6;
+use Test::More tests => 7;
 
 ##############################################################
 # Tests compilation of Module::ScanDeps
 ##############################################################
-BEGIN { use_ok( 'Module::ScanDeps', qw(path_to_inc_name) ); }
+BEGIN { use_ok( 'Module::ScanDeps', qw(path_to_inc_name scan_deps) ); }
 
 my $name;
 my $basepath;
@@ -34,4 +34,8 @@
 $name = 'use_scoped_package.pl';
 is(path_to_inc_name($basepath.$name, $warn), $name, "$name correctly returned by path_to_inc_name($basepath$name)");
 
-__END__
+# 'use lib ...' 
+my $rv = scan_deps("t/data/use_lib.pl");
+ok(exists $rv->{"Some.pm"}, "'use lib ...' correctly interpreted");
+
+__END__

Added: branches/upstream/libmodule-scandeps-perl/current/t/data/use_lib.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-scandeps-perl/current/t/data/use_lib.pl?rev=70212&op=file
==============================================================================
--- branches/upstream/libmodule-scandeps-perl/current/t/data/use_lib.pl (added)
+++ branches/upstream/libmodule-scandeps-perl/current/t/data/use_lib.pl Wed Mar  2 01:57:33 2011
@@ -1,0 +1,4 @@
+#!/usr/bin/perl
+
+use lib "t/data/check_path_to_inc_name";
+use Some;




More information about the Pkg-perl-cvs-commits mailing list