mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-09-09 14:36:43 +00:00
c808e06da3
Review follow-up for the Ubuntu sbuild matrix:
- Add a fail-fast exclusive flock over the whole run (<output-root>/.sbuild-all.lock,
file-scoped handle) so two overlapping runs can't corrupt the shared staging/apt
tree -- this is the root of the observed 'remove_tree .../staging/<cn>/<arch>:
Directory not empty' (an NFS silly-rename from a concurrent run).
- wipe_tree(): remove_tree that captures {error} and dies loud, so an ENOTEMPTY no
longer carps-and-continues leaving stale debs; used for all staging/pool/dists wipes.
- Wire the tested, hash-based cross_copy_genesis_deb into build_genesis (was a naive
glob+copy, so the unit-tested stale-dropping copier was dead code); remove the
genuinely-unused deb_snap_version/rewrite_changelog_top helpers + their subtests
(compiled deps intentionally ship their tracked changelog version).
- Dedupe assemble_apt on binary Package+Architecture (keep highest via
dpkg --compare-versions) so a double-produced genesis can't land two versions in
the pool, independent of the --skip-genesis contract.
- Derive Release Architectures from the arches actually staged (non-empty
binary-<arch>/Packages), not a hard-coded 'amd64 ppc64el'.
- goconserver: guard 'go mod init' when a go.mod exists (+ TODO to commit go.sum for
the pinned SHA). Accept-and-ignore the unused per-package --log-dir/--build-number/
--skip-install flags (documented). Remove orphaned make_deb.sh dispatchers
(build-debs-all, build.sh, ipmitool/build.sh) + update the READMEs.
perl -c clean; prove t/sbuild-all.t: 71/71.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
63 lines
3.4 KiB
Perl
Executable File
63 lines
3.4 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
# syslinux/sbuild.pl -- per-package Ubuntu/Debian builder for syslinux-xcat; the apt/sbuild analogue
|
|
# of syslinux/mockbuild.pl. Builds the package inside the matching <codename>-<arch>-sbuild chroot from
|
|
# its MAINTAINED debian/ packaging and collects the .deb(s) into --result-dir. Invoked by sbuild-all.pl
|
|
# per (codename,arch); also runnable standalone. Out-of-tree: the build runs on a COPY of the package
|
|
# tree (the checkout is never mutated). The common chroot orchestration lives in
|
|
# BuildUtils::build_deb_in_chroot; only syslinux's source prep + patches + dpkg-buildpackage is below.
|
|
use strict;
|
|
use warnings;
|
|
use Cwd qw(abs_path);
|
|
use File::Basename qw(basename);
|
|
use Getopt::Long qw(GetOptions);
|
|
use FindBin qw($RealBin);
|
|
use lib "$RealBin/..";
|
|
use BuildUtils qw(chroot_name build_deb_in_chroot);
|
|
|
|
my $pkg_dir = abs_path($RealBin);
|
|
my $pkg = basename($pkg_dir);
|
|
my ($codename, $arch, $chroot, $result_dir, $log_dir) = ('', '', '', '', '');
|
|
my ($build_timestamp, $build_number, $skip_install) = (undef, undef, 0);
|
|
# --log-dir / --build-number / --skip-install are accepted for CLI-compat with sbuild-all.pl (which
|
|
# passes them uniformly to every per-package builder) but are intentionally UNUSED here: sbuild-all
|
|
# does its own per-package logging and there is no deb install-smoke. They are parsed and ignored.
|
|
GetOptions(
|
|
'codename=s' => \$codename, 'arch=s' => \$arch, 'chroot=s' => \$chroot,
|
|
'result-dir=s' => \$result_dir, 'log-dir=s' => \$log_dir,
|
|
'build-timestamp=i' => \$build_timestamp, 'build-number=i' => \$build_number,
|
|
'skip-install!' => \$skip_install,
|
|
) or die "bad options\n";
|
|
$arch ||= `dpkg --print-architecture 2>/dev/null`; chomp $arch; $arch ||= 'amd64';
|
|
die "FATAL: --codename required\n" unless $codename;
|
|
$chroot ||= chroot_name($codename, $arch);
|
|
$result_dir ||= "$pkg_dir/../build-output/sbuild/$codename/$arch";
|
|
$build_timestamp = time() unless defined $build_timestamp;
|
|
|
|
# ---- package-specific build (absorbed from the former make_deb.sh); CWD = the copied package dir ----
|
|
# syslinux 3.86 is old and needs source patches to build with modern gcc/glibc (it produces the x86
|
|
# boot components, so it is only built on amd64 -- see debs-manifest.conf).
|
|
my $build = <<'BUILD';
|
|
set -e
|
|
tar xvfj syslinux-3.86.tar.bz2
|
|
cd syslinux-3.86
|
|
cp -rL ../debian .
|
|
# GCC >= 10 defaults to -fno-common; syslinux 3.86 relies on common symbols. GCC 15 promotes several
|
|
# warnings to errors.
|
|
sed -i '/^GCCWARN := -W -Wall/s/$/ -fcommon -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=int-conversion/' MCONFIG
|
|
sed -i "s|^GCCWARN := .*|& -fdebug-prefix-map=$(pwd)=.|" MCONFIG
|
|
# glibc >= 2.28 moved major()/minor() to sys/sysmacros.h; extlinux/main.c:843 calls them unconditionally.
|
|
sed -i '/#include <sys\/types.h>/a #include <sys/sysmacros.h>' extlinux/main.c
|
|
# com32/cmenu/Makefile uses python2 menugen.py for test .menu files -- not needed for the build.
|
|
rm -f com32/cmenu/*.menu
|
|
# vpd.c:67 passes &vpd->base_address (char(*)[6]) not char*; %X wrong for a char* arg.
|
|
sed -i 's/snprintf(&vpd->base_address, 5, "%X", q)/snprintf(vpd->base_address, sizeof(vpd->base_address), "%s", q)/' com32/gpllib/vpd/vpd.c
|
|
export NO_WERROR=1
|
|
dpkg-buildpackage -uc -us
|
|
BUILD
|
|
|
|
build_deb_in_chroot(
|
|
pkg => $pkg, chroot => $chroot, pkg_dir => $pkg_dir, result_dir => $result_dir,
|
|
build_timestamp => $build_timestamp, build => $build,
|
|
extra_tools => [qw(nasm)],
|
|
);
|