/
all_versions
executable file
·62 lines (52 loc) · 1.43 KB
/
all_versions
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
# Copyright 2004-2009, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net
use strict;
use warnings;
use Getopt::Long;
my $Options =
{
dry_run => 0,
ignore_failure => 0,
version => [],
};
sub get_options
{
die "Bad option" unless
GetOptions($Options, # Store the options in the Options hash.
qw(
dry_run!
ignore_failure!
version=s
));
$Options->{version} =
[ map { ($_, "$_-thr") }
qw( 5.6.1 5.6.2
5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9
5.10.0 5.10.1 5.11.0 ) ]
unless @{$Options->{version}};
$Options->{version} =
[ grep eval { !system "perl$_ -v" }, @{$Options->{version}} ];
}
sub sys
{
my ($command) = @_;
print "$command\n";
return if $Options->{dry_run};
my $ret = system $command;
die "command failed: $?" if $ret && !$Options->{ignore_failure};
}
get_options;
my $command = "@ARGV" or die "Usage: $0 [-v version] command\n";
for my $v (@{$Options->{version}})
{
my $perl = "perl$v";
sys "rm -rf t cover_db";
sys "$perl Makefile.PL";
sys "make clean";
sys "$perl Makefile.PL";
sys "make";
sys $command;
}