From 7075769a59457e0bff3932df53b0e43526bf4dc9 Mon Sep 17 00:00:00 2001 From: Automation Pipeline Date: Sat, 7 Oct 2023 09:26:55 -0400 Subject: [PATCH] not doing what i want --- build.pl | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100755 build.pl diff --git a/build.pl b/build.pl new file mode 100755 index 0000000..2221436 --- /dev/null +++ b/build.pl @@ -0,0 +1,98 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use v5.30; + +use IO::Async; +use IO::Async::Function; +use IO::Async::Loop::Epoll; +use Getopt::Long; +use Future; +use Capture::Tiny qw(tee_merged); +use Path::Tiny; + + +my @bases = qw/bullseye-backports bookworm-backports/; +my @options = ("main", "main-threaded", "main-longdouble", "main-quadmath", "main-debugging", "main-longdouble-threaded", "main-quadmath-threaded", "main-debugging-threaded", "main-debugging-longdouble-threaded", "main-debugging-quadmath-threaded", "main-debugging-longdouble", "main-debugging-quadmath"); +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 $verbose = 1; + +GetOptions('verbose' => \$verbose, + 'quiet' => sub {$verbose = 0}, + 'workers=i' => \$max_workers, + ); + + +my $loop = IO::Async::Loop::Epoll->new(); + +my $builder = IO::Async::Function->new( + code => sub { + my ( $version, $options, $os_base ) = @_; + + my $expanded_version = $version =~ s/(?5)\.(?\d+)\.(?\d+)/sprintf "%d.%03d.%03d", $+{major}, $+{minor}, $+{patch}/er; + + my $tags = ["$version-$options-$os_base", "$expanded_version-$options-$os_base"]; + + 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; + }, + + max_workers => $max_workers, + min_workers => 1, + model => "fork", +); + +$loop->add($builder); +$builder->start(); + +my %calls; + +for my $version (@versions) { + for my $option (@options) { + for my $base (@bases) { + my $rend = "$version-$option-$base"; + my $future = $builder->call(args => [$version, $option, $base])->on_ready(sub { + delete $calls{$rend}; + }); + $calls{$rend} = $future; + } + } +} + +my $full_future = Future->wait_all( values %calls ); + +while (1) { + print "Is ready? ", $full_future->is_ready()?"yes":"no", "\n"; + + my @pending = $full_future->pending_futures; + + print "Pending: ", 0+@pending, "\n"; + print join(", ", keys %calls), "\n"; + + print "workers: ", $builder->workers, ", ", $builder->workers_idle, ", ", $builder->workers_busy, "\n"; + + $loop->delay_future(after => 1)->get(); + + if (@pending < 1) { + break; + } +} + +my @result = $full_future->get(); + +use Data::Dumper; +print Dumper(\@result);