make_disc_trees.pl: move local vs. base_components safeguard

We have two safeguards related to the local component now, one if it's
present, one if it's absent: group them via if-then-else.
This commit is contained in:
Cyril Brulebois 2023-01-27 07:38:40 +01:00
parent 2e61e76d86
commit 492b085305
1 changed files with 9 additions and 11 deletions

View File

@ -860,17 +860,6 @@ sub finish_disc {
my $hook;
my $error = 0;
# Fix possible inconsistency (LOCAL enabled, no packages getting included in the
# local component, breaking debootstrap which is passed --components=main,local):
if (! -d "$cddir/dists/$codename/local") {
my $base_components = "$cddir/.disk/base_components";
my @components = read_file($base_components);
if (grep { $_ eq "local\n" } @components) {
print " Removing local from base_components (no such component under $codename)\n";
write_file($base_components, grep { $_ ne "local\n" } @components);
}
}
if (defined($ENV{'DISC_FINISH_HOOK'})) {
$hook = $ENV{'DISC_FINISH_HOOK'};
print " Calling disc_finish hook: $hook\n";
@ -908,6 +897,15 @@ sub finish_disc {
# having local packages.
if (-d "./dists/$codename/local") {
find (\&add_missing_Packages, "./dists/$codename/main/");
} else {
# Otherwise ensure not to pass --components=main,local to
# debootstrap:
my $base_components = ".disk/base_components";
my @components = read_file($base_components);
if (grep { $_ eq "local\n" } @components) {
print " Removing local from base_components (no such component under $codename)\n";
write_file($base_components, grep { $_ ne "local\n" } @components);
}
}
print " Finishing off the Release file\n";