From 786171ebb7723a74b841f7c1c1457bd825783a16 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 22 May 2015 22:13:46 +0200 Subject: perl_checker cleanups --- draklive | 2 +- lib/MDV/Draklive/Live.pm | 2 +- lib/MDV/Draklive/Loopback.pm | 3 +-- lib/MDV/Draklive/Media.pm | 2 +- lib/MDV/Draklive/Mounts.pm | 20 ++++++++++---------- lib/MDV/Draklive/Utils.pm | 4 ++-- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/draklive b/draklive index eafd017..5eb0b82 100755 --- a/draklive +++ b/draklive @@ -172,7 +172,7 @@ sub install_system { local %ENV = ( %ENV, - (map { "DRAKLIVE_". uc($_->[0]) => $_->[1] } group_by2(%{$live->{settings}})), + (map { "DRAKLIVE_" . uc($_->[0]) => $_->[1] } group_by2(%{$live->{settings}})), %{$live->{system}{install_env}}, ); $ENV{DRAKLIVE_LANGS} = join(':', get_langs($live)); diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm index 9603879..545c96c 100644 --- a/lib/MDV/Draklive/Live.pm +++ b/lib/MDV/Draklive/Live.pm @@ -49,7 +49,7 @@ sub find_kernel { sub get_initrd_name { my ($live) = @_; - 'initrd-'. $live->find_kernel->{version} . '.img'; + 'initrd-' . $live->find_kernel->{version} . '.img'; } sub get_lib_prefix { diff --git a/lib/MDV/Draklive/Loopback.pm b/lib/MDV/Draklive/Loopback.pm index 0032e6e..258f70e 100644 --- a/lib/MDV/Draklive/Loopback.pm +++ b/lib/MDV/Draklive/Loopback.pm @@ -117,7 +117,7 @@ our %loop_types; mount => sub { my ($live, $dir) = @_; my $mnt = $live->{prefix}{live}{mnt} . $dir->{mountpoint}; - my $mount_opts = $dir->{mount_opts}?"-o $dir->{mount_opts}":""; + my $mount_opts = $dir->{mount_opts} ? "-o $dir->{mount_opts}" : ""; my $cmd = "mount -t tmpfs $mount_opts $mnt $mnt"; $dir->{fallback} ? qq(sh -c 'if ! grep -q " $mnt " /proc/mounts; then $cmd; fi') : $cmd; }, @@ -135,7 +135,6 @@ sub get_loop_modules { sub has_squashfs4_with { my ($live, $comp) = @_; - my $kernel = $live->find_kernel; my $ucomp = uc($comp); cat_($live->get_system_root . "/boot/config-" . $live->find_kernel->{version}) =~ /^CONFIG_SQUASHFS_$ucomp=y$/m; } diff --git a/lib/MDV/Draklive/Media.pm b/lib/MDV/Draklive/Media.pm index c891ef0..8487e29 100644 --- a/lib/MDV/Draklive/Media.pm +++ b/lib/MDV/Draklive/Media.pm @@ -12,7 +12,7 @@ sub new { $media->{partitions} ||= [ { mntpoint => '/' } ]; - for $mntpoint (qw(/ OEM_RESCUE)) { + foreach my $mntpoint (qw(/ OEM_RESCUE)) { my $part = find { $_->{mntpoint} eq $mntpoint } @{$media->{partitions}}; $part->{fs_type} ||= $media->get_media_setting('fs'); if (my $label = $mntpoint eq '/' && $media->get_media_label) { diff --git a/lib/MDV/Draklive/Mounts.pm b/lib/MDV/Draklive/Mounts.pm index 5bdacd7..7aea117 100644 --- a/lib/MDV/Draklive/Mounts.pm +++ b/lib/MDV/Draklive/Mounts.pm @@ -2,7 +2,7 @@ package MDV::Draklive::Mounts; use MDK::Common; -my $_dir_distrib_sqfs = { +my $dir_distrib_sqfs = { mountpoint => '/distrib', type => 'squashfs', path => '/distrib', @@ -10,13 +10,13 @@ my $_dir_distrib_sqfs = { sort => "config/distrib.sort", build_from => '/', }; -my $_dir_memory = { +my $dir_memory = { mountpoint => '/memory', type => 'tmpfs', mount_opts => 'mode=755', }; -my $_dir_modules = { +my $dir_modules = { mountpoint => '/modules', type => 'modules', path => '/modules', @@ -36,7 +36,7 @@ our $simple_union = { mountpoint => '/media', type => 'plain', }, - $_dir_memory, + $dir_memory, ], }; @@ -44,7 +44,7 @@ our $squash_rw_union = { root => '/union', overlay => 'unionfs', dirs => [ - $_dir_distrib_sqfs, + $dir_distrib_sqfs, { mountpoint => '/media/system', type => 'plain', @@ -58,9 +58,9 @@ sub volatile_squash_union { root => '/union', overlay => 'unionfs', dirs => [ - $_dir_distrib_sqfs, - if_($o_modules, $_dir_modules), - $_dir_memory, + $dir_distrib_sqfs, + if_($o_modules, $dir_modules), + $dir_memory, ], }; } @@ -71,8 +71,8 @@ sub squash_union { root => '/union', overlay => 'unionfs', dirs => [ - $_dir_distrib_sqfs, - if_($o_modules, $_dir_modules), + $dir_distrib_sqfs, + if_($o_modules, $dir_modules), { mountpoint => '/system', type => 'loopfs', diff --git a/lib/MDV/Draklive/Utils.pm b/lib/MDV/Draklive/Utils.pm index f98074a..7637d32 100644 --- a/lib/MDV/Draklive/Utils.pm +++ b/lib/MDV/Draklive/Utils.pm @@ -13,7 +13,7 @@ our @EXPORT = qw(directory_usage run_ run_foreach); sub directory_usage { my ($dir, $o_apparent) = @_; my $apparent = $o_apparent && "--apparent-size"; - first(split /\s/, `du -s -B 1 $apparent $_[0]`); + first(split /\s/, `du -s -B 1 $apparent $dir`); } #- expand only if the pattern contains '*' @@ -42,7 +42,7 @@ sub run_foreach { my $selector = IO::Select->new($cmd_out); while (my @ready = $selector->can_read) { foreach my $fh (@ready) { - local $_ = scalar<$fh>; + local $_ = scalar <$fh>; return if /^open3:/; $foreach->(); $selector->remove($fh) if eof($fh); -- cgit v1.2.1