summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-11-20 05:34:06 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-11-20 05:34:06 +0000
commitefc634a7183527416ded491285bc566e16db1e97 (patch)
tree55ea4172b7251dbb7c84f73690b55ceab9114023
parent3af13f1cb8b90c9444a5f81b4c27500ee8035003 (diff)
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
-rw-r--r--tests/archive.pl10
1 files 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);
}
}