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 untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -3015,7 +3015,16 @@ 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 {
if ( none { $_ eq 'cleanup/apt/lists' } @{ $options->{skip} }
and none { $_ eq 'cleanup/apt/cache' } @{ $options->{skip} }) {
info "cleaning package lists and apt cache..."; info "cleaning package lists and apt cache...";
}
if (any { $_ eq 'cleanup/apt/lists' } @{ $options->{skip} }) {
info "skipping cleanup/apt/lists as requested";
} else {
if (any { $_ eq 'cleanup/apt/cache' } @{ $options->{skip} }) {
info "cleaning package lists...";
}
run_apt_progress({ run_apt_progress({
ARGV => [ ARGV => [
'apt-get', '--option', 'apt-get', '--option',
@ -3024,8 +3033,16 @@ sub run_cleanup() {
], ],
CHDIR => $options->{root}, 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( run_apt_progress(
{ ARGV => ['apt-get', 'clean'], CHDIR => $options->{root} }); { 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>.