From 016dda977576e4723b1028d09cd41cc8b74e9f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 6 Sep 2026 23:44:21 -0300 Subject: [PATCH] feat(mockbuild-perl-packages): list the packages a run would build --list-packages prints the set a run selects, after --epel-gap and --packages, and exits before the root and mock checks. The riscv64 manifest cell has no other repository behind it, so a test can now hold the cell to this list without a build host. --- mockbuild-perl-packages.pl | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mockbuild-perl-packages.pl b/mockbuild-perl-packages.pl index 8d8ee4b..6aa8d61 100755 --- a/mockbuild-perl-packages.pl +++ b/mockbuild-perl-packages.pl @@ -26,6 +26,7 @@ my $build_timestamp; # Net-Telnet), which build from a committed .src.rpm and so are NOT covered by mockbuild-all's # in-tree spec bump. Spec-mode packages get bumped in-tree upstream, so we leave those alone. my $release_suffix = ''; +my $list_packages = 0; GetOptions( 'work-dir=s' => \$work_dir, @@ -41,11 +42,20 @@ GetOptions( 'jobs=i' => \$jobs, 'build-timestamp=i' => \$build_timestamp, 'release-suffix=s' => \$release_suffix, + 'list-packages!' => \$list_packages, ) or die usage(); -die "Run as root (current uid=$>)\n" if $> != 0; +# --list-packages prints the set a run would build and exits before any host requirement, so a +# test can hold the manifest to it without root, mock or a chroot. The host detection below +# traces its commands on STDOUT; keep that off the list by sending it to STDERR until the list. +my $list_out; +if ($list_packages) { + open($list_out, '>&', \*STDOUT) or die "dup STDOUT: $!\n"; + open(STDOUT, '>&', \*STDERR) or die "redirect STDOUT: $!\n"; +} +die "Run as root (current uid=$>)\n" if $> != 0 && !$list_packages; -for my $bin (qw(mock rpmbuild rpm dnf perl bash grep)) { +for my $bin ($list_packages ? () : qw(mock rpmbuild rpm dnf perl bash grep)) { run("command -v " . sh_quote($bin) . " >/dev/null 2>&1"); } @@ -296,6 +306,11 @@ for my $pkg (@packages) { die "Unknown package in --packages: $pkg\n" if !exists $meta{$pkg}; } +if ($list_packages) { + print {$list_out} "$_\n" for @packages; + exit 0; +} + if ($jobs <= 0) { $jobs = scalar(@packages); }