update for perltidy 20220613

pull/32/head
parent a156d93314
commit 889c02419e
Signed by: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -36,7 +36,7 @@ use File::Find;
use Cwd qw(abs_path getcwd); use Cwd qw(abs_path getcwd);
require "syscall.ph"; ## no critic (Modules::RequireBarewordIncludes) require "syscall.ph"; ## no critic (Modules::RequireBarewordIncludes)
require "sys/ioctl.ph"; ## no critic (Modules::RequireBarewordIncludes) require "sys/ioctl.ph"; ## no critic (Modules::RequireBarewordIncludes)
use Fcntl qw(S_IFCHR S_IFBLK FD_CLOEXEC F_GETFD F_SETFD); use Fcntl qw(S_IFCHR S_IFBLK FD_CLOEXEC F_GETFD F_SETFD);
use List::Util qw(any none); use List::Util qw(any none);
use POSIX use POSIX
qw(SIGINT SIGHUP SIGPIPE SIGTERM SIG_BLOCK SIG_UNBLOCK strftime isatty); qw(SIGINT SIGHUP SIGPIPE SIGTERM SIG_BLOCK SIG_UNBLOCK strftime isatty);
@ -1153,10 +1153,8 @@ sub setup_mounts {
} }
} elsif ($type == 3 or $type == 4) { } elsif ($type == 3 or $type == 4) {
# character/block special # character/block special
if ( if (any { $_ =~ '^chroot/mount(?:/dev)?$' }
any { $_ =~ '^chroot/mount(?:/dev)?$' } @{ $options->{skip} }) {
@{ $options->{skip} }
) {
info "skipping chroot/mount/dev as requested"; info "skipping chroot/mount/dev as requested";
} elsif (!$options->{canmount}) { } elsif (!$options->{canmount}) {
warning "skipping bind-mounting ./dev/$fname"; warning "skipping bind-mounting ./dev/$fname";
@ -1215,10 +1213,8 @@ sub setup_mounts {
} }
} elsif ($type == 5) { } elsif ($type == 5) {
# directory # directory
if ( if (any { $_ =~ '^chroot/mount(?:/dev)?$' }
any { $_ =~ '^chroot/mount(?:/dev)?$' } @{ $options->{skip} }) {
@{ $options->{skip} }
) {
info "skipping chroot/mount/dev as requested"; info "skipping chroot/mount/dev as requested";
} elsif (!$options->{canmount}) { } elsif (!$options->{canmount}) {
warning "skipping bind-mounting ./dev/$fname"; warning "skipping bind-mounting ./dev/$fname";
@ -2371,10 +2367,8 @@ sub run_download() {
dryrun => $options->{dryrun}, dryrun => $options->{dryrun},
}, },
); );
} elsif ( } elsif (any { $_ eq $options->{variant} }
any { $_ eq $options->{variant} } ('essential', 'standard', 'important', 'required', 'buildd')) {
('essential', 'standard', 'important', 'required', 'buildd')
) {
# 2021-06-07, #debian-apt on OFTC, times in UTC+2 # 2021-06-07, #debian-apt on OFTC, times in UTC+2
# 17:27 < DonKult> (?essential includes 'apt' through) # 17:27 < DonKult> (?essential includes 'apt' through)
# 17:30 < josch> DonKult: no, because pkgCacheGen::ForceEssential ","; # 17:30 < josch> DonKult: no, because pkgCacheGen::ForceEssential ",";
@ -2890,10 +2884,8 @@ sub run_install() {
if ($options->{variant} eq 'buildd') { if ($options->{variant} eq 'buildd') {
$pkgs_to_install{'build-essential'} = (); $pkgs_to_install{'build-essential'} = ();
} }
if ( if (any { $_ eq $options->{variant} }
any { $_ eq $options->{variant} } ('required', 'important', 'standard', 'buildd')) {
('required', 'important', 'standard', 'buildd')
) {
# Many of the priority:required packages are also essential:yes. We # Many of the priority:required packages are also essential:yes. We
# make sure not to select those here to avoid useless "xxx is already # make sure not to select those here to avoid useless "xxx is already
# the newest version" messages. # the newest version" messages.
@ -3267,10 +3259,8 @@ sub hookhelper {
error "unknown hook: $hook"; error "unknown hook: $hook";
} }
if ( if (any { $_ eq $command } ('copy-in', 'tar-in', 'upload', 'sync-in'))
any { $_ eq $command } {
('copy-in', 'tar-in', 'upload', 'sync-in')
) {
if (scalar @args < 2) { if (scalar @args < 2) {
error "$command needs at least one path on the" error "$command needs at least one path on the"
. " outside and the output path inside the chroot"; . " outside and the output path inside the chroot";
@ -3284,17 +3274,13 @@ sub hookhelper {
if ($hook eq 'setup') { if ($hook eq 'setup') {
# tar runs outside, so acquire the correct path # tar runs outside, so acquire the correct path
$directory = chrooted_realpath $root, $outpath; $directory = chrooted_realpath $root, $outpath;
} elsif ( } elsif (any { $_ eq $hook }
any { $_ eq $hook } ('extract', 'essential', 'customize')) {
('extract', 'essential', 'customize')
) {
if ($mode eq 'fakechroot') { if ($mode eq 'fakechroot') {
# tar will run inside the chroot # tar will run inside the chroot
$directory = $outpath; $directory = $outpath;
} elsif ( } elsif (any { $_ eq $mode }
any { $_ eq $mode } ('root', 'chrootless', 'unshare')) {
('root', 'chrootless', 'unshare')
) {
$directory = chrooted_realpath $root, $outpath; $directory = chrooted_realpath $root, $outpath;
} else { } else {
error "unknown mode: $mode"; error "unknown mode: $mode";
@ -3325,10 +3311,8 @@ sub hookhelper {
# open the requested file for writing # open the requested file for writing
open $fh, '|-', @cmdprefix, 'sh', '-c', 'cat > "$1"', open $fh, '|-', @cmdprefix, 'sh', '-c', 'cat > "$1"',
'exec', $directory // error "failed to fork(): $!"; 'exec', $directory // error "failed to fork(): $!";
} elsif ( } elsif (any { $_ eq $command }
any { $_ eq $command } ('copy-in', 'tar-in', 'sync-in')) {
('copy-in', 'tar-in', 'sync-in')
) {
# open a tar process that extracts the tarfile that we # open a tar process that extracts the tarfile that we
# supply it with on stdin to the output directory inside # supply it with on stdin to the output directory inside
# the chroot # the chroot
@ -3411,10 +3395,8 @@ sub hookhelper {
error "tar failed"; error "tar failed";
} }
} }
} elsif ( } elsif (any { $_ eq $command }
any { $_ eq $command } ('copy-out', 'tar-out', 'download', 'sync-out')) {
('copy-out', 'tar-out', 'download', 'sync-out')
) {
if (scalar @args < 2) { if (scalar @args < 2) {
error "$command needs at least one path inside the chroot and" error "$command needs at least one path inside the chroot and"
. " the output path on the outside"; . " the output path on the outside";
@ -3428,17 +3410,13 @@ sub hookhelper {
if ($hook eq 'setup') { if ($hook eq 'setup') {
# tar runs outside, so acquire the correct path # tar runs outside, so acquire the correct path
$directory = chrooted_realpath $root, $file; $directory = chrooted_realpath $root, $file;
} elsif ( } elsif (any { $_ eq $hook }
any { $_ eq $hook } ('extract', 'essential', 'customize')) {
('extract', 'essential', 'customize')
) {
if ($mode eq 'fakechroot') { if ($mode eq 'fakechroot') {
# tar will run inside the chroot # tar will run inside the chroot
$directory = $file; $directory = $file;
} elsif ( } elsif (any { $_ eq $mode }
any { $_ eq $mode } ('root', 'chrootless', 'unshare')) {
('root', 'chrootless', 'unshare')
) {
$directory = chrooted_realpath $root, $file; $directory = chrooted_realpath $root, $file;
} else { } else {
error "unknown mode: $mode"; error "unknown mode: $mode";
@ -4141,10 +4119,8 @@ sub get_sourceslist_by_suite {
# the security mirror changes, starting with bullseye # the security mirror changes, starting with bullseye
# https://lists.debian.org/87r26wqr2a.fsf@43-1.org # https://lists.debian.org/87r26wqr2a.fsf@43-1.org
my $bullseye_or_later = 0; my $bullseye_or_later = 0;
if ( if (any { $_ eq $suite } ('stable', 'bullseye', 'bookworm', 'trixie'))
any { $_ eq $suite } {
('stable', 'bullseye', 'bookworm', 'trixie')
) {
$bullseye_or_later = 1; $bullseye_or_later = 1;
} }
my $distro_info = '/usr/share/distro-info/debian.csv'; my $distro_info = '/usr/share/distro-info/debian.csv';
@ -5593,10 +5569,8 @@ sub main() {
); );
waitpid $pid, 0; waitpid $pid, 0;
$? == 0 or error "havemknod failed"; $? == 0 or error "havemknod failed";
} elsif ( } elsif (any { $_ eq $options->{mode} }
any { $_ eq $options->{mode} } ('root', 'fakechroot', 'chrootless')) {
('root', 'fakechroot', 'chrootless')
) {
$options->{havemknod} = havemknod($options->{root}); $options->{havemknod} = havemknod($options->{root});
} else { } else {
error "unknown mode: $options->{mode}"; error "unknown mode: $options->{mode}";
@ -5754,10 +5728,8 @@ sub main() {
}, },
\@idmap \@idmap
); );
} elsif ( } elsif (any { $_ eq $options->{mode} }
any { $_ eq $options->{mode} } ('root', 'fakechroot', 'chrootless')) {
('root', 'fakechroot', 'chrootless')
) {
$pid = fork() // error "fork() failed: $!"; $pid = fork() // error "fork() failed: $!";
if ($pid == 0) { if ($pid == 0) {
local $SIG{'INT'} = 'DEFAULT'; local $SIG{'INT'} = 'DEFAULT';
@ -5819,10 +5791,8 @@ sub main() {
0 == system('chroot', $options->{root}, 'tar', 0 == system('chroot', $options->{root}, 'tar',
@taropts, '-C', '/', '.') @taropts, '-C', '/', '.')
or error "tar failed: $?"; or error "tar failed: $?";
} elsif ( } elsif (any { $_ eq $options->{mode} } ('root', 'chrootless'))
any { $_ eq $options->{mode} } {
('root', 'chrootless')
) {
# If the chroot directory is not owned by the root user, # If the chroot directory is not owned by the root user,
# then we assume that no measure was taken to fake root # then we assume that no measure was taken to fake root
# permissions. Since the final tarball should contain # permissions. Since the final tarball should contain
@ -6051,10 +6021,8 @@ sub main() {
rmdir "$options->{root}" rmdir "$options->{root}"
or error "cannot rmdir $options->{root}: $!"; or error "cannot rmdir $options->{root}: $!";
} }
} elsif ( } elsif (any { $_ eq $options->{mode} }
any { $_ eq $options->{mode} } ('root', 'fakechroot', 'chrootless')) {
('root', 'fakechroot', 'chrootless')
) {
# without unshare, we use the system's rm to recursively remove the # without unshare, we use the system's rm to recursively remove the
# temporary directory just to make sure that we do not accidentally # temporary directory just to make sure that we do not accidentally
# remove more than we should by using --one-file-system. # remove more than we should by using --one-file-system.

Loading…
Cancel
Save