From efc634a7183527416ded491285bc566e16db1e97 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Tue, 20 Nov 2012 05:34:06 +0000 Subject: archive.pl now creates a wrapping folder in both .tar.gz and .zip archives git-svn-id: http://pugixml.googlecode.com/svn/trunk@935 99668b35-9821-0410-8761-19e4c4f06640 --- tests/archive.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/archive.pl b/tests/archive.pl index 4ede302..0de0945 100644 --- a/tests/archive.pl +++ b/tests/archive.pl @@ -6,21 +6,23 @@ use Archive::Zip; my $target = shift @ARGV; my @sources = @ARGV; -my $zip = $target =~ /\.zip$/; +my $basedir = ($target =~ /^(.*)(\.zip|\.tar.gz|\.tgz)$/) ? "$1/" : ''; +my $zip = $target =~ /\.zip$/; my $arch = $zip ? Archive::Zip->new : Archive::Tar->new; for $source (sort {$a cmp $b} @sources) { my $contents = &readfile_contents($source); my $meta = &readfile_meta($source); + my $file = $basedir . $source; if ($zip) { - my $path = $source; + my $path = $file; $arch->addDirectory($path) if $path =~ s/\/[^\/]+$/\// && !defined($arch->memberNamed($path)); - my $member = $arch->addString($contents, $source); + my $member = $arch->addString($contents, $file); $member->desiredCompressionMethod(COMPRESSION_DEFLATED); $member->desiredCompressionLevel(9); @@ -32,7 +34,7 @@ for $source (sort {$a cmp $b} @sources) # tgz releases are for Unix people, Unix people like Unix newlines $contents =~ s/\r//g if (-T $source); - $arch->add_data($source, $contents, $meta); + $arch->add_data($file, $contents, $meta); } } -- cgit v1.2.3