-
Notifications
You must be signed in to change notification settings - Fork 0
/
createTarball.pl
executable file
·62 lines (54 loc) · 1.64 KB
/
createTarball.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/perl -w
use strict;
# This is really just a wrapper around
# make all test manifest dist
#
# But it does a few pre-flight checks too
use File::Path;
use File::Copy;
use Config;
my $perlpath = $Config{perlpath};
use lib 'lib';
use Parallel::Loops;
# Check that Changes and $Parallel::Loops::VERSION agree on what the latest
# version is
open I, 'Changes'
or die "Couldn't open Changes";
my $version = <I>;
close I;
chomp $version;
$version =~ /^Version (.*) on /
or die "Unexpected version line: $version";
$version = $1;
# Test that this version number is the same as that in the .pm
die sprintf ("Version mismatch: Changes: '%s', pm: '%s'",
$version, $Parallel::Loops::VERSION)
if ($version ne $Parallel::Loops::VERSION);
my $tarballFile = "Parallel-Loops-$version.tar.gz";
my $tarballDir = "tarball";
if (-e $tarballFile) {
die "$tarballFile already exists - remove it first"
}
if (-d $tarballDir) {
die "$tarballDir dir already exists - remove it first"
}
sub safeSystem {
system(@_);
die sprintf( "system call '%s' failed: %d",
join(" ", @_),
$?
)
if $?;
}
# Make sure we have an updated README
safeSystem('pod2text --utf8 lib/Parallel/Loops.pm > README');
safeSystem('pod2markdown lib/Parallel/Loops.pm > README.md');
# Just want to make sure we die if anything isn't up-to-date
safeSystem('git diff --exit-code > /dev/null');
safeSystem('git archive HEAD --prefix=tarball/ | tar x');
chdir "tarball";
safeSystem($perlpath, 'Makefile.PL');
safeSystem('make', 'all', 'test','manifest', 'dist');
move("$tarballFile", '..');
chdir "..";
rmtree("tarball");