Merge branch 'clarify-fix-improve-support-for-local-packages'

WARNING: This is an attempt at making it easier for users to enable
support for local packages. This branch is really believed to make
the whole situation easier and clearer on the long run, but it might
introduce some regressions, or at least behavorial changes depending
on existing configurations.

In particular, users might have a hierarchy under LOCALDEBS that's
different from the one getting documented in eb6d140f48, possibly with
a top-level local/ (see also bfebeded70 and 7ce8d0c28f).

It's advised to move files around to match the documented layout, and
to report any regressions that would be spotted: many tests where run,
trying to torture this patch series as much as possible, imagining
borderline cases, but in the end, that's not a feature that's getting
fully battle-tested since it's obviously not used for official builds.
This commit is contained in:
Cyril Brulebois 2023-01-27 05:27:02 +01:00
commit ccaa1a9c69
4 changed files with 40 additions and 10 deletions

21
CONF.sh
View File

@ -157,8 +157,25 @@ export FORCE_FIRMWARE=1
# export LOCAL=1
# If your local packages are not under $MIRROR, but somewhere else,
# you can uncomment this line and edit to to point to a directory
# containing dists/$CODENAME/local/binary-$ARCH
# you can uncomment this line and edit it to point to a directory
# containing:
# - dists/$CODENAME/local/binary-$ARCH/*.deb
# - dists/$CODENAME/local/debian-installer/binary-$ARCH/*.udeb
#
# Some metadata must exist for those packages to be considered:
# - dists/$CODENAME/local/binary-$ARCH/Packages.(gz|xz)
# - dists/$CODENAME/local/debian-installer/binary-$ARCH/Packages.(gz|xz)
#
# and apt will likely want a top-level Release file as well, and
# possibly uncompressed Packages files as well in each directory:
# - dists/$CODENAME/Release
# - dists/$CODENAME/local/binary-$ARCH/Packages
# - dists/$CODENAME/local/debian-installer/binary-$ARCH/Packages
#
# At least that's what was observed while updating easy-build.sh (which
# has an UPDATE_LOCAL=1 setting, controlling whether to run Packages-gen)
# for year 2023, good luck! -- kibi
#
# export LOCALDEBS=/home/joey/debian/va/debian
# Where to find the security patches. This directory should be the

View File

@ -33,7 +33,10 @@ else
fi
[ -d $repo ] || mkdir -p $repo
echo Creating Packages file for $repo...
apt-ftparchive packages $repo > $repo/Packages
# Important: generate both uncompressed Packages (see below) and compressed
# Packages.gz (so that the usual Packages.gz/Packages.xz search finds it)!
apt-ftparchive packages $repo | pigz -9nm > $repo/Packages.gz
zcat $repo/Packages.gz > $repo/Packages
# Fun fact, at least when building bookworm images on bullseye:
# - a missing Release file is fine, but maybe downloads follow;

View File

@ -860,6 +860,17 @@ 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";
@ -985,9 +996,13 @@ sub Packages_dir {
$pdir = "$dir/dists/$codename-backports/$component";
}
if ($section and $section eq "debian-installer") {
$pdir = "$dir/dists/$codename/$component/debian-installer";
# Don't attempt to put d-i components into backports, as d-i
# won't look for them there.
#
# Also, merge local udebs into main, as d-i uses a single
# Packages file anyway:
my $dstcomponent = $component ne 'local' ? $component : 'main';
$pdir = "$dir/dists/$codename/$dstcomponent/debian-installer";
}
return $pdir;
}

View File

@ -134,12 +134,6 @@ if [ "$BACKPORTS"x != ""x ] ; then
fi
fi
# Commodity link for tools which want local in dists/local/local ...
if [ -n "$LOCAL" ]
then
ln -sf $CODENAME $CDDIR/dists/local
fi
if [ ! -d $CDDIR/.disk ] ; then
mkdir $CDDIR/.disk
fi
@ -182,6 +176,7 @@ if [ $DISKNUM = 1 ] ; then
echo " Adding .disk/base_components"
echo "main" > $CDDIR/.disk/base_components
if [ -n "$LOCAL" ] ; then
# This might be reverted by finish_disc in the end:
echo "local" >> $CDDIR/.disk/base_components
fi