r25904 - in /trunk/libpar-dist-perl: Changes META.yml debian/changelog lib/PAR/Dist.pm t/03merge_meta.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Fri Oct 10 12:47:44 UTC 2008


Author: gregoa
Date: Fri Oct 10 12:47:41 2008
New Revision: 25904

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=25904
Log:
New upstream release.

Modified:
    trunk/libpar-dist-perl/Changes
    trunk/libpar-dist-perl/META.yml
    trunk/libpar-dist-perl/debian/changelog
    trunk/libpar-dist-perl/lib/PAR/Dist.pm
    trunk/libpar-dist-perl/t/03merge_meta.t

Modified: trunk/libpar-dist-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpar-dist-perl/Changes?rev=25904&op=diff
==============================================================================
--- trunk/libpar-dist-perl/Changes (original)
+++ trunk/libpar-dist-perl/Changes Fri Oct 10 12:47:41 2008
@@ -1,3 +1,10 @@
+By: smueller on 2008/10/08
+    * Fix the "Skip 03merge_meta tests if no A::Zip nor zip/unzip found." logic.
+    * Add more debug output to debug mode (system calls).
+    * Add internal _check_tools() sub which checks the availability of various
+      required tools (yaml, zip).
+    * This is 0.37.
+____________________________________________________________________________
 By: smueller on 2008/09/30
     * Skip 03merge_meta tests if no YAML *DUMPER* could be found.
     * Better debug output for the YAML-search.

Modified: trunk/libpar-dist-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpar-dist-perl/META.yml?rev=25904&op=diff
==============================================================================
--- trunk/libpar-dist-perl/META.yml (original)
+++ trunk/libpar-dist-perl/META.yml Fri Oct 10 12:47:41 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                PAR-Dist
-version:             0.36
+version:             0.37
 abstract:            Create and manipulate PAR distributions
 license:             ~
 author:              

Modified: trunk/libpar-dist-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpar-dist-perl/debian/changelog?rev=25904&op=diff
==============================================================================
--- trunk/libpar-dist-perl/debian/changelog (original)
+++ trunk/libpar-dist-perl/debian/changelog Fri Oct 10 12:47:41 2008
@@ -1,3 +1,9 @@
+libpar-dist-perl (0.37-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Fri, 10 Oct 2008 14:46:03 +0200
+
 libpar-dist-perl (0.36-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libpar-dist-perl/lib/PAR/Dist.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpar-dist-perl/lib/PAR/Dist.pm?rev=25904&op=diff
==============================================================================
--- trunk/libpar-dist-perl/lib/PAR/Dist.pm (original)
+++ trunk/libpar-dist-perl/lib/PAR/Dist.pm Fri Oct 10 12:47:41 2008
@@ -2,7 +2,7 @@
 require Exporter;
 use vars qw/$VERSION @ISA @EXPORT @EXPORT_OK $DEBUG/;
 
-$VERSION    = '0.36';
+$VERSION    = '0.37';
 @ISA	    = 'Exporter';
 @EXPORT	    = qw/
   blib_to_par
@@ -33,7 +33,7 @@
 
 =head1 VERSION
 
-This document describes version 0.36 of PAR::Dist, released September 30, 2008.
+This document describes version 0.37 of PAR::Dist, released October  8, 2008.
 
 =head1 SYNOPSIS
 
@@ -289,18 +289,18 @@
 
 sub _build_blib {
     if (-e 'Build') {
-        system($^X, "Build");
+        _system_wrapper($^X, "Build");
     }
     elsif (-e 'Makefile') {
-        system($Config::Config{make});
+        _system_wrapper($Config::Config{make});
     }
     elsif (-e 'Build.PL') {
-        system($^X, "Build.PL");
-        system($^X, "Build");
+        _system_wrapper($^X, "Build.PL");
+        _system_wrapper($^X, "Build");
     }
     elsif (-e 'Makefile.PL') {
-        system($^X, "Makefile.PL");
-        system($Config::Config{make});
+        _system_wrapper($^X, "Makefile.PL");
+        _system_wrapper($Config::Config{make});
     }
 }
 
@@ -729,40 +729,6 @@
   return 1;
 }
 
-# Tries to load any YAML reader writer I know of
-# returns nothing on failure or hash reference containing
-# a subset of Load, Dump, LoadFile, DumpFile
-# entries with sub references on success.
-sub _get_yaml_functions {
-  # reasoning for the ranking here:
-  # - syck is fast and reasonably complete
-  # - YAML.pm is slow and aging
-  # - Tiny is only a very small subset
-  # - XS is very new and I'm not sure it's ready for prime-time yet
-  # - Parse... is only a reader and only deals with the same subset as ::Tiny
-  my @modules = qw(YAML::Syck YAML YAML::Tiny YAML::XS Parse::CPAN::Meta);
-
-  my %yaml_functions;
-  foreach my $module (@modules) {
-    eval "require $module;";
-    if (!$@) {
-      warn "PAR::Dist testers/debug info: Using '$module' as YAML implementation" if $DEBUG;
-      foreach my $sub (qw(Load Dump LoadFile DumpFile)) {
-        no strict 'refs';
-        my $subref = \&{"${module}::$sub"};
-        if (defined $subref and ref($subref) eq 'CODE') {
-          $yaml_functions{$sub} = $subref;
-        }
-      }
-      last;
-    }
-  } # end foreach module candidates
-  if (not keys %yaml_functions) {
-    warn "Cannot find a working YAML reader/writer implementation. Tried to load all of '@modules'";
-    return();
-  }
-  return(\%yaml_functions);
-}
 
 =head2 remove_man
 
@@ -903,7 +869,7 @@
     # Then fall back to the system
     else {
         undef $!;
-        if (system(unzip => $dist, '-d', $path)) {
+        if (_system_wrapper(unzip => $dist, '-d', $path)) {
             die "Failed to unzip '$dist' to path '$path': Could neither load "
                 . "Archive::Zip nor (successfully) run the system 'unzip' (unzip said: $!)";
         }
@@ -923,7 +889,7 @@
     }
     else {
         undef $!;
-        if (system(qw(zip -r), $dist, File::Spec->curdir)) {
+        if (_system_wrapper(qw(zip -r), $dist, File::Spec->curdir)) {
             die "Failed to zip '" .File::Spec->curdir(). "' to '$dist': Could neither load "
                 . "Archive::Zip nor (successfully) run the system 'zip' (zip said: $!)";
         }
@@ -1270,6 +1236,91 @@
     return $found ? 1 : 0;
 }
 
+sub _system_wrapper {
+  if ($DEBUG) {
+    Carp::cluck("Running system call '@_' from:");
+  }
+  return system(@_);
+}
+
+# stolen from Module::Install::Can
+# very much internal and subject to change or removal
+sub _MI_can_run {
+  require ExtUtils::MakeMaker;
+  my ($cmd) = @_;
+
+  my $_cmd = $cmd;
+  return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
+
+  for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+    my $abs = File::Spec->catfile($dir, $cmd);
+    return $abs if (-x $abs or $abs = MM->maybe_command($abs));
+  }
+
+  return;
+}
+
+
+# Tries to load any YAML reader writer I know of
+# returns nothing on failure or hash reference containing
+# a subset of Load, Dump, LoadFile, DumpFile
+# entries with sub references on success.
+sub _get_yaml_functions {
+  # reasoning for the ranking here:
+  # - syck is fast and reasonably complete
+  # - YAML.pm is slow and aging
+  # - Tiny is only a very small subset
+  # - XS is very new and I'm not sure it's ready for prime-time yet
+  # - Parse... is only a reader and only deals with the same subset as ::Tiny
+  my @modules = qw(YAML::Syck YAML YAML::Tiny YAML::XS Parse::CPAN::Meta);
+
+  my %yaml_functions;
+  foreach my $module (@modules) {
+    eval "require $module;";
+    if (!$@) {
+      warn "PAR::Dist testers/debug info: Using '$module' as YAML implementation" if $DEBUG;
+      foreach my $sub (qw(Load Dump LoadFile DumpFile)) {
+        no strict 'refs';
+        my $subref = \&{"${module}::$sub"};
+        if (defined $subref and ref($subref) eq 'CODE') {
+          $yaml_functions{$sub} = $subref;
+        }
+      }
+      $yaml_functions{yaml_provider} = $module;
+      last;
+    }
+  } # end foreach module candidates
+  if (not keys %yaml_functions) {
+    warn "Cannot find a working YAML reader/writer implementation. Tried to load all of '@modules'";
+  }
+  return(\%yaml_functions);
+}
+
+sub _check_tools {
+  my $tools = _get_yaml_functions();
+  if ($DEBUG) {
+    foreach (qw/Load Dump LoadFile DumpFile/) {
+      warn "No YAML support for $_ found.\n" if not defined $tools->{$_};
+    }
+  }
+
+  $tools->{zip} = undef;
+  if (eval {require Archive::Zip; 1;}) {
+    warn "Using Archive::Zip as ZIP tool.\n" if $DEBUG;
+    $tools->{zip} = 'Archive::Zip';
+  }
+  elsif (_MI_can_run("zip") and _MI_can_run("unzip")) {
+    warn "Using zip/unzip as ZIP tool.\n" if $DEBUG;
+    $tools->{zip} = 'zip';
+  }
+  else {
+    warn "Found neither Archive::Zip nor ZIP/UNZIP as valid ZIP tools.\n" if $DEBUG;
+    $tools->{zip} = undef;
+  }
+
+  return $tools;
+}
+
 1;
 
 =head1 SEE ALSO
@@ -1280,7 +1331,7 @@
 
 Audrey Tang E<lt>cpan at audreyt.orgE<gt> 2003-2007
 
-Steffen Mueller E<lt>smueller at cpan.orgE<gt> 2005-2007
+Steffen Mueller E<lt>smueller at cpan.orgE<gt> 2005-2008
 
 PAR has a mailing list, E<lt>par at perl.orgE<gt>, that you can write to;
 send an empty mail to E<lt>par-subscribe at perl.orgE<gt> to join the list
@@ -1290,7 +1341,7 @@
 
 =head1 COPYRIGHT
 
-Copyright 2003-2007 by Audrey Tang E<lt>autrijus at autrijus.orgE<gt>.
+Copyright 2003-2008 by Audrey Tang E<lt>autrijus at autrijus.orgE<gt>.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Modified: trunk/libpar-dist-perl/t/03merge_meta.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpar-dist-perl/t/03merge_meta.t?rev=25904&op=diff
==============================================================================
--- trunk/libpar-dist-perl/t/03merge_meta.t (original)
+++ trunk/libpar-dist-perl/t/03merge_meta.t Fri Oct 10 12:47:41 2008
@@ -3,6 +3,7 @@
 use strict;
 use Test;
 use vars '$loaded';
+
 
 BEGIN { $loaded = eval { require PAR::Dist; 1 } };
 BEGIN {
@@ -10,16 +11,14 @@
   if ($loaded) {  
     # skip these tests without YAML loader or without (A::Zip or zipo/unzip)
     $PAR::Dist::DEBUG = 1;
-    my ($y_func) = PAR::Dist::_get_yaml_functions();
+    my $tools = PAR::Dist::_check_tools();
     $PAR::Dist::DEBUG = 0;
-    if (not $y_func or not exists $y_func->{DumpFile}) {
+    if (not defined $tools->{DumpFile}) {
       plan tests => 1;
       skip("Skip because no YAML loader/dumper could be found");
       exit();
     }
-    elsif (not eval {use Archive::Zip; 1;}
-           and (not system("zip") or not system("unzip")))
-    {
+    elsif (not defined $tools->{zip}) {
       plan tests => 1;
       skip("Skip because neither Archive::Zip nor zip/unzip could be found");
       exit();




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