From 81a42ed35e61de32d82ac0e8c406841d5f37d53f Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 13 Jan 2018 17:41:42 +0000 Subject: Reduce perl_checker noise. --- lib/MGA/DrakISO/BuildMedia.pm | 15 +++++++-------- lib/MGA/DrakISO/BuildRoot.pm | 11 +++++------ lib/MGA/DrakISO/Utils.pm | 8 ++++---- 3 files changed, 16 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm index 6672367..98473a3 100644 --- a/lib/MGA/DrakISO/BuildMedia.pm +++ b/lib/MGA/DrakISO/BuildMedia.pm @@ -90,13 +90,13 @@ sub prepare_media { include_groups ($build, $build->{group_include_lists}); exclude_packages($build, $build->{group_exclude_lists}); - update_dependencies($build); + update_dependencies(); include_packages($build, $build->{package_include_lists}); - update_dependencies($build); + update_dependencies(); exclude_packages($build, $build->{package_exclude_lists}); - update_dependencies($build); + update_dependencies(); build_installer_media($build); @@ -182,8 +182,8 @@ sub get_available_packages { urpm::set_files($urpm, $build->get_chroot_dir); urpm::get_global_options($urpm); - $urpm->{info} = sub { }; - $urpm->{log} = sub { }; + $urpm->{info} = sub {}; + $urpm->{log} = sub {}; urpm::media::configure($urpm); @@ -381,8 +381,7 @@ sub exclude_packages { # Package Dependency Detection ############################################################################### -sub update_dependencies { - my ($build) = @_; +sub update_dependencies() { print "Calculating dependencies\n" if $::verbose; @@ -669,7 +668,7 @@ sub update_package_selection { $name =~ s/\*/.*/g; my @candidates = grep { $_ =~ /^$name$/ } keys %package; foreach (@candidates) { - $action->($file, $_, $class) ; + $action->($file, $_, $class); } } else { $action->($file, $name, $class, $o_warn); diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm index 1e44109..1ee471a 100644 --- a/lib/MGA/DrakISO/BuildRoot.pm +++ b/lib/MGA/DrakISO/BuildRoot.pm @@ -390,8 +390,8 @@ sub build_local_repo { urpm::set_files($urpm, $root); urpm::get_global_options($urpm); - $urpm->{info} = sub { }; - $urpm->{log} = sub { }; + $urpm->{info} = sub {}; + $urpm->{log} = sub {}; urpm::media::configure($urpm, cmdline_skiplist => join(',', @{$build->{system}{exclude_packages} || []})); @@ -435,9 +435,8 @@ sub build_local_repo { my $src_path = $medium[0]->{url} . '/' . $pkg->filename; my @path_parts = split('/', $src_path); my $class = $path_parts[-3]; - my $name = $path_parts[-1]; my $dst_dir = $local_repo_dir . $class; - mkdir_in_root($root, $dst_dir) if ! -d $root . $dst_dir; + mkdir_in_root($root, $dst_dir) if ! -d "$root$dst_dir"; # TODO: support remote repositories copy_to_root($root, $dst_dir, undef, $src_path); $classes{$class} = 1; @@ -519,7 +518,7 @@ sub customise_live_system { # Remove any additional media. if (@{$build->{system}{additional_media}}) { - run_in_root($root, undef, 'urpmi.removemedia', if_($::verbose < 3, '-q'),'-a'); + run_in_root($root, undef, 'urpmi.removemedia', if_($::verbose < 3, '-q'), '-a'); } print "..adding local repository media\n" if $::verbose > 1; @@ -601,7 +600,7 @@ sub customise_live_system { # Apply patches as requested by the user. foreach (@{$build->{system}{patches}}) { my $patch_file = $build->get_absolute_path($_); - my @patch_cmd = ( 'patch', '-p0', '-d', $root, '-i', $patch_file, if_($::verbose < 3, '-s') ); + my @patch_cmd = ('patch', '-p0', '-d', $root, '-i', $patch_file, if_($::verbose < 3, '-s')); run_as_root(join(' ', @patch_cmd, '--dry-run -f -R > /dev/null')) || run_as_root(@patch_cmd) or die "ERROR: unable to apply patch $patch_file\n"; } diff --git a/lib/MGA/DrakISO/Utils.pm b/lib/MGA/DrakISO/Utils.pm index 6c85ae6..0f97080 100644 --- a/lib/MGA/DrakISO/Utils.pm +++ b/lib/MGA/DrakISO/Utils.pm @@ -64,7 +64,7 @@ sub run_as_root { if (@cmd > 1) { unshift @cmd, $sudo if $sudo; } else { - @cmd[0] = join(' ', $sudo, @cmd[0]); + $cmd[0] = join(' ', $sudo, @cmd[0]); } run_(@cmd); } @@ -73,11 +73,11 @@ sub run_in_root { my ($root, $arch, @cmd) = @_; if (@cmd > 1) { - unshift @cmd, ( 'chroot', $root ); - unshift @cmd, ( 'setarch', $arch ) if $arch; + unshift @cmd, ('chroot', $root); + unshift @cmd, ('setarch', $arch) if $arch; unshift @cmd, $sudo if $sudo; } else { - @cmd[0] = join(' ', $sudo, if_($arch, 'setarch', $arch), 'chroot', $root, @cmd[0]); + $cmd[0] = join(' ', $sudo, if_($arch, 'setarch', $arch), 'chroot', $root, @cmd[0]); } print "@cmd\n" if $::verbose > 2; local %ENV = %ENV; -- cgit v1.2.1