More boilerplate ready, now to build all the docker commands
This commit is contained in:
parent
e49cd5e723
commit
6119261c10
1 changed files with 47 additions and 33 deletions
80
build.pl
80
build.pl
|
@ -19,12 +19,24 @@ my @options = ("main", "main-threaded", "main-longdouble", "main-quadmath", "mai
|
||||||
my @versions = ("5.20.3", "5.22.4", "5.24.4", "5.26.3", "5.28.3", "5.30.3", "5.32.1", "5.34.0", "5.34.1", "5.36.0");
|
my @versions = ("5.20.3", "5.22.4", "5.24.4", "5.26.3", "5.28.3", "5.30.3", "5.32.1", "5.34.0", "5.34.1", "5.36.0");
|
||||||
my $max_workers = 8;
|
my $max_workers = 8;
|
||||||
my $verbose = 1;
|
my $verbose = 1;
|
||||||
|
my $suffix = "";
|
||||||
|
my $push_repo = "";
|
||||||
|
my $arch = 'amd64';
|
||||||
|
|
||||||
GetOptions('verbose' => \$verbose,
|
GetOptions('verbose' => \$verbose,
|
||||||
'quiet' => sub {$verbose = 0},
|
'quiet' => sub {$verbose = 0},
|
||||||
'workers=i' => \$max_workers,
|
'workers=i' => \$max_workers,
|
||||||
|
'suffix=s' => \$suffix,
|
||||||
|
'push_repo=s' => \$push_repo,
|
||||||
|
'arch=s' => \$arch,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my $arch_suffix="-$arch";
|
||||||
|
|
||||||
|
if ($suffix) {
|
||||||
|
$suffix = "-$suffix";
|
||||||
|
}
|
||||||
|
|
||||||
my $loop = IO::Async::Loop::Epoll->new();
|
my $loop = IO::Async::Loop::Epoll->new();
|
||||||
|
|
||||||
sub get_ts {
|
sub get_ts {
|
||||||
|
@ -34,27 +46,24 @@ sub get_ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub process_lines {
|
sub process_lines {
|
||||||
my ($disp_prefix, $lines) = @_;
|
my ($disp_prefix, $type, $log_fh, $lines) = @_;
|
||||||
my $output = "";
|
|
||||||
|
|
||||||
while ($$lines =~ /\n/m) {
|
while ($$lines =~ /\n/m) {
|
||||||
my $ts = get_ts();
|
my $ts = get_ts();
|
||||||
$$lines =~ s/^(.*?)\n//m;
|
$$lines =~ s/^(.*?)\n//m;
|
||||||
my $raw_line = $1;
|
my $raw_line = $1;
|
||||||
|
|
||||||
my $log_line = $ts.": ".$raw_line;
|
my $log_line = "$ts $type: $raw_line\n";
|
||||||
my $disp_line = $disp_prefix." - ".$ts.": ".$raw_line;
|
my $disp_line = "$disp_prefix - $ts $type: $raw_line\n";
|
||||||
print "out: ", $disp_line, "\n";
|
print $disp_line;
|
||||||
$output .= $log_line;
|
$log_fh->print($log_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub run_cmd {
|
sub run_cmd {
|
||||||
my ($cmd,$disp_prefix,$log_file,$input) = @_;
|
my ($cmd,$disp_prefix,$log_fh,$input) = @_;
|
||||||
|
|
||||||
my ($output, $error, $raw_out, $raw_err);
|
my ($raw_out, $raw_err);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -62,15 +71,13 @@ sub run_cmd {
|
||||||
|
|
||||||
my $handle = IPC::Run::start $cmd, \$input, \$raw_out, \$raw_err; # no timeout here, that's part of the ::Function
|
my $handle = IPC::Run::start $cmd, \$input, \$raw_out, \$raw_err; # no timeout here, that's part of the ::Function
|
||||||
|
|
||||||
print "started, $handle\n";
|
|
||||||
print "pumpable? ", $handle->pumpable?"yes":"no", "\n";
|
|
||||||
|
|
||||||
while ($handle->pumpable) {
|
while ($handle->pumpable) {
|
||||||
$handle->pump();
|
$handle->pump();
|
||||||
|
|
||||||
print "pumping $disp_prefix\n";
|
process_lines($disp_prefix, "[OUT]", $log_fh, \$raw_out);
|
||||||
$output .= process_lines($disp_prefix, \$raw_out);
|
process_lines($disp_prefix, "[ERR]", $log_fh, \$raw_err);
|
||||||
$error .= process_lines($disp_prefix."[ERR]", \$raw_err);
|
|
||||||
|
$handle->reap_nb();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Nothing we do here is a fatal error.
|
# Nothing we do here is a fatal error.
|
||||||
|
@ -78,13 +85,14 @@ sub run_cmd {
|
||||||
|
|
||||||
my $return = $?;
|
my $return = $?;
|
||||||
|
|
||||||
print "Finished $disp_prefix\n";
|
print "Finished $disp_prefix => $return\n";
|
||||||
|
|
||||||
return ($output, $error, $return);
|
return ($return);
|
||||||
} catch {
|
} catch {
|
||||||
my $e = $@;
|
my $e = $@;
|
||||||
|
|
||||||
print "$disp_prefix: $e\n";
|
print "$disp_prefix: $e\n";
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,27 +102,33 @@ my $builder = IO::Async::Function->new(
|
||||||
|
|
||||||
my $expanded_version = $version =~ s/(?<major>5)\.(?<minor>\d+)\.(?<patch>\d+)/sprintf "%d.%03d.%03d", $+{major}, $+{minor}, $+{patch}/er;
|
my $expanded_version = $version =~ s/(?<major>5)\.(?<minor>\d+)\.(?<patch>\d+)/sprintf "%d.%03d.%03d", $+{major}, $+{minor}, $+{patch}/er;
|
||||||
|
|
||||||
my $tags = ["$version-$options-$os_base", "$expanded_version-$options-$os_base"];
|
my $tags = ["$push_repo$version-$options-$os_base$suffix$arch_suffix", "$push_repo$expanded_version-$options-$os_base$suffix$arch_suffix"];
|
||||||
|
|
||||||
my ($output, $error, $retval) = run_cmd(["ls"], $tags->[0], "", "");
|
my ($total_output, $total_error, $retval);
|
||||||
# my ($output, $return) = tee_merged sub {
|
|
||||||
# my $workdir = path("output/perls")->child("$expanded_version-$options-$os_base");
|
|
||||||
#
|
|
||||||
# if ($workdir->exists()) {
|
|
||||||
#
|
|
||||||
# chdir($workdir);
|
|
||||||
# #print "$workdir\n";
|
|
||||||
# #system("ls");
|
|
||||||
# } else {
|
|
||||||
# print "Failed to find $workdir\n";
|
|
||||||
# }
|
|
||||||
# };
|
|
||||||
|
|
||||||
return $output;
|
my $startdir = path("output/perls");
|
||||||
|
my $log_dir = path("output/logs");
|
||||||
|
$log_dir->mkdir();
|
||||||
|
my $log_file = $log_dir->child("$expanded_version-$options-$os_base$suffix$arch_suffix-build.log");
|
||||||
|
my $log_fh = $log_file->openw_utf8();
|
||||||
|
my $workdir = $startdir->child("$expanded_version-$options-$os_base/");
|
||||||
|
|
||||||
|
if ($workdir->exists()) {
|
||||||
|
chdir($workdir);
|
||||||
|
my ($output, $error, $retval) = run_cmd(["ls"], $tags->[0], $log_fh, "");
|
||||||
|
} else {
|
||||||
|
print "Failed to find $workdir\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$log_fh->close();
|
||||||
|
|
||||||
|
# Should probably return a success or failure
|
||||||
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
max_workers => $max_workers,
|
max_workers => $max_workers,
|
||||||
min_workers => 1,
|
min_workers => 1,
|
||||||
|
max_worker_calls => 1, # always restart, we want to throw away side effects like chdir
|
||||||
model => "fork",
|
model => "fork",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue