add --skip=cleanup/apt/lists and --skip=cleanup/apt/cache

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-05-09 20:44:02 +02:00
parent c51fb24c7b
commit 88a031477a
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -3015,17 +3015,34 @@ sub run_cleanup() {
if (any { $_ eq 'cleanup/apt' } @{ $options->{skip} }) { if (any { $_ eq 'cleanup/apt' } @{ $options->{skip} }) {
info "skipping cleanup/apt as requested"; info "skipping cleanup/apt as requested";
} else { } else {
info "cleaning package lists and apt cache..."; if ( none { $_ eq 'cleanup/apt/lists' } @{ $options->{skip} }
run_apt_progress({ and none { $_ eq 'cleanup/apt/cache' } @{ $options->{skip} }) {
ARGV => [ info "cleaning package lists and apt cache...";
'apt-get', '--option', }
'Dir::Etc::SourceList=/dev/null', '--option', if (any { $_ eq 'cleanup/apt/lists' } @{ $options->{skip} }) {
'Dir::Etc::SourceParts=/dev/null', 'update' info "skipping cleanup/apt/lists as requested";
], } else {
CHDIR => $options->{root}, if (any { $_ eq 'cleanup/apt/cache' } @{ $options->{skip} }) {
}); info "cleaning package lists...";
run_apt_progress( }
{ ARGV => ['apt-get', 'clean'], CHDIR => $options->{root} }); run_apt_progress({
ARGV => [
'apt-get', '--option',
'Dir::Etc::SourceList=/dev/null', '--option',
'Dir::Etc::SourceParts=/dev/null', 'update'
],
CHDIR => $options->{root},
});
}
if (any { $_ eq 'cleanup/apt/cache' } @{ $options->{skip} }) {
info "skipping cleanup/apt/cache as requested";
} else {
if (any { $_ eq 'cleanup/apt/lists' } @{ $options->{skip} }) {
info "cleaning apt cache...";
}
run_apt_progress(
{ ARGV => ['apt-get', 'clean'], CHDIR => $options->{root} });
}
# apt since 1.6 creates the auxfiles directory. If apt inside the # apt since 1.6 creates the auxfiles directory. If apt inside the
# chroot is older than that, then it will not know how to clean it. # chroot is older than that, then it will not know how to clean it.
@ -6727,7 +6744,7 @@ Performs cleanup tasks like:
=over 4 =over 4
=item * Removes the package lists and apt cache. This can be disabled using B<--skip=cleanup/apt>. =item * Removes the package lists (unless B<--skip=cleanup/apt/lists>) and apt cache (unless B<--skip=cleanup/apt/cache>). Both removals can be disabled by using B<--skip=cleanup/apt>.
=item * Remove all files that were put into the chroot for setup purposes, like F</etc/apt/apt.conf.d/00mmdebstrap>, the temporary apt config and the qemu-user-static binary. This can be disabled using B<--skip=cleanup/mmdebstrap>. =item * Remove all files that were put into the chroot for setup purposes, like F</etc/apt/apt.conf.d/00mmdebstrap>, the temporary apt config and the qemu-user-static binary. This can be disabled using B<--skip=cleanup/mmdebstrap>.