diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-09-11 21:36:37 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-09-11 21:44:12 -0700 |
commit | 7885abe57c40314ad4d37b5cd8424792a839e4ff (patch) | |
tree | f2593f5544231e20650ee7e99065b772d2ef0e44 /bin | |
parent | 85aa862e1ec6d3c1e92dfa63212a50f6a072632a (diff) | |
download | dotfiles-7885abe57c40314ad4d37b5cd8424792a839e4ff.tar.gz |
reprepro-rebuilder: fall back to a pseudo-crossbuild with qemu
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reprepro-rebuilder | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/bin/reprepro-rebuilder b/bin/reprepro-rebuilder index e3bf2279..6376677b 100755 --- a/bin/reprepro-rebuilder +++ b/bin/reprepro-rebuilder @@ -185,12 +185,22 @@ sub build { @arch_needed = array_minus @arch_needed, @all_needed; my $build_debs = sub { - my ($desc, @args) = shift->@*; - push @args, "--no-run-lintian", "-d", $dist; + my %opts = shift->%*; + my @args = ("--no-run-lintian", "-d", $dist); + push @args, $opts{all} ? "--arch-all" : "--no-arch-all"; for (@_) { - my $basename = basename $_; - { no autodie; system "sbuild", @args, $basename } - push @{ $? == 0 ? \@succeeded : \@failed }, "$basename:$desc"; + no autodie; + my $bn = basename $_; + if ($opts{cross}) { + system "sbuild", @args, "--host=$opts{cross}", $bn; + + # Many packages aren't crossbuildable. Fall back to qemu. + $? == 0 + or system "sbuild", @args, "--arch=$opts{cross}", $bn; + } else { + system "sbuild", @args, $bn; + } + push @{ $? == 0 ? \@succeeded : \@failed }, "$bn:$opts{desc}"; } }; @@ -200,12 +210,10 @@ sub build { for uniq @all_needed, @arch_needed, map @$_, values %cross_needed; local $CWD = $temp; - $build_debs->([$arch, "--no-arch-all"], @arch_needed); - $build_debs->(["$arch+all", "--arch-all"], @all_needed); - $build_debs->( - [$_, "--no-arch-all", "--host=$_"], - $cross_needed{$_}->@* - ) for keys %cross_needed; + $build_debs->({ desc => $arch }, @arch_needed); + $build_debs->({ desc => "$arch+all", all => 1 }, @all_needed); + $build_debs->({ desc => $_, cross => $_ }, $cross_needed{$_}->@*) + for keys %cross_needed; { no autodie; |