Ok, my first test and patch sucked, unless you're a fan of tarbombs. Here's a new patch (fix is
included); it should be better.
On Sun May 15 21:36:48 2011, hoelzro wrote:
Show quoted text> Attached fix patch. It's kind of awful; don't judge me.
>
> On Sun May 15 21:29:30 2011, RJBS wrote:
> > * Rob Hoelz via RT <bug-Dist-Zilla@rt.cpan.org> [2011-05-15T21:25:50]
> > > And here's what it looks like when Test::DZil builds it:
> > >
> > > $ tar tzf Fake-0.01.tar.gz
> > > home/rob/programming/projects/Dist-Zilla-Plugin-
> > LocalBrew/tmp/source/random_stuff/Fake-0.01/dist.ini
> > > # and so on...
> >
> > Nice. Thanks. I do not look forward to fixing this, but I'll give it
> > a look
> > soon. :)
> >
>
>
diff -Naur Dist-Zilla-4.200006/lib/Dist/Zilla/Dist/Builder.pm Dist-Zilla-4.200006-post/lib/Dist/Zilla/Dist/Builder.pm
--- Dist-Zilla-4.200006/lib/Dist/Zilla/Dist/Builder.pm 2011-04-28 20:14:36.000000000 -0500
+++ Dist-Zilla-4.200006-post/lib/Dist/Zilla/Dist/Builder.pm 2011-05-15 21:03:04.000000000 -0500
@@ -323,7 +323,7 @@
my $archive = Archive::Tar->new;
- my $basename = file(join(q{},
+ my $basename = dir(join(q{},
$self->name,
'-',
$self->version,
@@ -332,11 +332,10 @@
$_->before_archive for $self->plugins_with(-BeforeArchive)->flatten;
- my %seen_dir;
for my $distfile (sort { length($a->name) <=> length($b->name) } $self->files->flatten) {
- my $in = file($distfile->name)->dir;
- $archive->add_files( $built_in->subdir($in) ) unless $seen_dir{ $in }++;
- $archive->add_files( $built_in->file( $distfile->name ) );
+ require File::Slurp;
+ my $contents = File::Slurp::read_file($built_in->file($distfile->name));
+ $archive->add_data($basename->file($distfile->name), $contents);
}
# Fix up the CHMOD on the archived files, to inhibit 'withoutworldwritables'
diff -Naur Dist-Zilla-4.200006/t/tester-tarball-contents.t Dist-Zilla-4.200006-post/t/tester-tarball-contents.t
--- Dist-Zilla-4.200006/t/tester-tarball-contents.t 1969-12-31 18:00:00.000000000 -0600
+++ Dist-Zilla-4.200006-post/t/tester-tarball-contents.t 2011-05-15 21:00:59.000000000 -0500
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+
+use Archive::Tar;
+use File::Spec;
+use Test::More 0.88;
+use Test::DZil;
+
+plan tests => 1;
+
+my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ { add_files => {
+ 'source/dist.ini' => simple_ini({
+ name => 'DZT',
+ }, 'GatherDir', 'MakeMaker', 'FakeRelease')
+ },
+ },
+);
+
+$tzil->release;
+
+my $basename = join('',
+ $tzil->name, '-', $tzil->version,
+ ($tzil->is_trial ? '-TRIAL' : ()));
+my $tarball = $basename . '.tar.gz';
+
+$tarball = $tzil->built_in->parent->subdir('source')->file($tarball);
+$tarball = Archive::Tar->new($tarball);
+ok($tarball->contains_file(File::Spec->catfile($basename, 'Makefile.PL')));