Exit with 1 if prerequisites are missing

This commit is contained in:
Alessandro Ranellucci 2013-06-24 16:51:01 +02:00
parent 344072d03c
commit 7852c07ba3

View File

@ -32,12 +32,12 @@ my %recommends = qw(
# removed: # removed:
# Wx 0.9901 # Wx 0.9901
my $skip_tests = 0; my $missing_prereqs = 0;
if ($ENV{SLIC3R_NO_AUTO}) { if ($ENV{SLIC3R_NO_AUTO}) {
foreach my $module (sort keys %prereqs) { foreach my $module (sort keys %prereqs) {
my $version = $prereqs{$module}; my $version = $prereqs{$module};
next if eval "use $module $version; 1"; next if eval "use $module $version; 1";
$skip_tests = 1 if exists $prereqs{$module}; $missing_prereqs = 1 if exists $prereqs{$module};
print "Missing prerequisite $module $version\n"; print "Missing prerequisite $module $version\n";
} }
foreach my $module (sort keys %recommends) { foreach my $module (sort keys %recommends) {
@ -84,12 +84,14 @@ EOF
foreach my $module (sort keys %modules) { foreach my $module (sort keys %modules) {
my $version = $modules{$module}; my $version = $modules{$module};
my $res = system $cpanm, "$module~$version"; my $res = system $cpanm, "$module~$version";
$skip_tests = 1 if $res != 0 && exists $prereqs{$module}; $missing_prereqs = 1 if $res != 0 && exists $prereqs{$module};
} }
} }
if (eval "use App::Prove; 1" && !$skip_tests) { if (eval "use App::Prove; 1" && !$missing_prereqs) {
App::Prove->new->run; App::Prove->new->run;
} }
exit 1 if $missing_prereqs;
__END__ __END__