generate_firmware_task: pick and choose components

We have a few fully-free firmware packages in main, and a few downloaders
(e.g. b43-installer and b43legacy-installer) in contrib; the latter might
not be really interesting without an alternative connectivity during the
installation process.

Regarding non-free vs. non-free-firmware, we started moving packages[1] from
the former to the latter so that we could build official installation images
based on main and non-free-firmware only.

 1. https://lists.debian.org/debian-boot/2023/01/msg00150.html

At the moment, NON_FREE_COMPONENTS still lists both, but the plan is to move
to non-free-firmware only once all the packages we want are available there.

The relevant variables regarding components include:
 - CONTRIB
 - NONFREE
 - EXTRANONFREE
 - FORCE_FIRMWARE

This commit implements:
 - using main all the time;
 - using contrib if CONTRIB=1;
 - using NONFREE_COMPONENTS if NONFREE=1 or EXTRANONFREE=1 or FORCE_FIRMWARE=1.

At the moment it seems the only existing caller is the top-level Makefile,
only when FORCE_FIRMWARE is set. But it seems to make sense to match what
tools/apt-selection does, to avoid any surprises.
This commit is contained in:
Cyril Brulebois 2023-01-26 23:22:40 +01:00
parent 4a31c04b81
commit 14d2664459
1 changed files with 44 additions and 11 deletions

View File

@ -10,6 +10,7 @@
# 3. For those that do, output the package name into the firmware task # 3. For those that do, output the package name into the firmware task
# #
# Copyright Steve McIntyre <93sam@debian.org> 2011 # Copyright Steve McIntyre <93sam@debian.org> 2011
# Copyright Cyril Brulebois <kibi@debian.org> 2023
# #
# GPL 2 # GPL 2
# #
@ -22,6 +23,34 @@ my $pkgfiles = "";
my $bp_pkgfiles = ""; my $bp_pkgfiles = "";
my ($pkg, $filename, $arch); my ($pkg, $filename, $arch);
my %seen; my %seen;
my @components;
# Either the caller tells us explicitly which components to use, or we make this
# determination on our own, based on various environment variables:
sub read_env {
my $env_var = shift;
my $default = shift;
if (exists($ENV{$env_var})) {
return $ENV{$env_var};
}
# else
return $default;
}
# Either the caller tells us explicitly which components to use, or we make this
# determination on our own, based on various environment variables, just like
# tools/apt-selection does:
@components = split /\ /, read_env('FIRMWARE_COMPONENTS', '');
if (!@components) {
@components = qw(main);
if (read_env('CONTRIB', 0) == 1) {
push @components, qw(contrib);
}
if (read_env('NONFREE', 0) == 1 or read_env('EXTRANONFREE', 0) == 1 or read_env('FORCE_FIRMWARE', 0) == 1) {
push @components, (split / /, read_env('NONFREE_COMPONENTS', ''));
}
}
$codename = $ENV{'CODENAME'}; $codename = $ENV{'CODENAME'};
$mirror = $ENV{'MIRROR'}; $mirror = $ENV{'MIRROR'};
@ -36,22 +65,26 @@ if (!defined($codename) || !defined($mirror) ||
} }
foreach $arch (split(' ', $archlist)) { foreach $arch (split(' ', $archlist)) {
if (defined($backports)) { for my $component (@components) {
$bp_pkgfiles = "$pkgfiles $mirror/dists/$codename-backports/*/binary-$arch/Packages.gz"; if (defined($backports)) {
$bp_pkgfiles = "$pkgfiles $mirror/dists/$codename-backports/*/binary-$arch/Packages.xz"; $bp_pkgfiles = "$pkgfiles $mirror/dists/$codename-backports/$component/binary-$arch/Packages.gz";
$bp_pkgfiles = "$pkgfiles $mirror/dists/$codename-backports/$component/binary-$arch/Packages.xz";
}
$pkgfiles = "$pkgfiles $mirror/dists/$codename/$component/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $mirror/dists/$codename/$component/binary-$arch/Packages.xz";
} }
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $mirror/dists/$codename/*/binary-$arch/Packages.xz";
} }
if (defined($localdebs)) { if (defined($localdebs)) {
foreach $arch (split(' ', $archlist)) { for my $component (@components) {
if (defined($backports)) { foreach $arch (split(' ', $archlist)) {
$bp_pkgfiles = "$pkgfiles $localdebs/dists/$codename-backports/*/binary-$arch/Packages.gz"; if (defined($backports)) {
$bp_pkgfiles = "$pkgfiles $localdebs/dists/$codename-backports/*/binary-$arch/Packages.xz"; $bp_pkgfiles = "$pkgfiles $localdebs/dists/$codename-backports/$component/binary-$arch/Packages.gz";
$bp_pkgfiles = "$pkgfiles $localdebs/dists/$codename-backports/$component/binary-$arch/Packages.xz";
}
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/$component/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/$component/binary-$arch/Packages.xz";
} }
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/*/binary-$arch/Packages.gz";
$pkgfiles = "$pkgfiles $localdebs/dists/$codename/*/binary-$arch/Packages.xz";
} }
} }