Author: dagolden
Date: Thu Nov 12 16:38:08 2009
New Revision: 13497

Modified:
   Module-Build/trunk/Build.PL
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Base.pm

Log:
Don't use Archive::Tar prefix field if not needed

Modified: Module-Build/trunk/Build.PL
==============================================================================
--- Module-Build/trunk/Build.PL (original)
+++ Module-Build/trunk/Build.PL Thu Nov 12 16:38:08 2009
@@ -46,7 +46,7 @@
     'Test::Harness'         => 0,
   },
   recommends => {
-    'Archive::Tar'       => 1.08,
+    'Archive::Tar'       => 1.09,
     'ExtUtils::CBuilder' => 0.260301, # numerous bug fixes
     'ExtUtils::Install'  => 0.30,
     'ExtUtils::Manifest' => 1.54, # public maniskip()

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Thu Nov 12 16:38:08 2009
@@ -28,6 +28,9 @@
    problems if a user has a broken Pod::Man/Pod::Simple.  (RT#50081)
    [David Golden]
 
+ - When tarball paths are less than 100 characters, disables 'prefix'
+   mode of Archive::Tar for maximum compatibility (RT#50571) [David Golden]
+   
  - Won't die if installed Pod::Readme is broken [David Golden]
  
  Other:

Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Thu Nov 12 16:38:08 2009
@@ -4402,16 +4402,21 @@
     $self->do_system($self->split_like_shell($self->{args}{tar}), $tar_flags, 
"$file.tar", $dir);
     $self->do_system($self->split_like_shell($self->{args}{gzip}), 
"$file.tar") if $self->{args}{gzip};
   } else {
-    eval { require Archive::Tar && Archive::Tar->VERSION(1.08); 1 }
-      or die "You must install Archive::Tar to make a distribution tarball\n".
+    eval { require Archive::Tar && Archive::Tar->VERSION(1.09); 1 }
+      or die "You must install Archive::Tar 1.09+ to make a distribution 
tarball\n".
              "or specify a binary tar program with the '--tar' option.\n".
              "See the documentation for the 'dist' action.\n";
 
+    my $files = $self->rscan_dir($dir);
+
     # Archive::Tar versions >= 1.09 use the following to enable a compatibility
     # hack so that the resulting archive is compatible with older clients.
-    $Archive::Tar::DO_NOT_USE_PREFIX = 0;
+    # If no file path is 100 chars or longer, we disable the prefix field
+    # for maximum compatibility.  If there are any long file paths then we 
+    # need the prefix field after all.
+    $Archive::Tar::DO_NOT_USE_PREFIX = 
+      (grep { length($_) >= 100 } @$files) ? 0 : 1;
 
-    my $files = $self->rscan_dir($dir);
     my $tar   = Archive::Tar->new;
     $tar->add_files(@$files);
     for my $f ($tar->get_files) {

Reply via email to