From 76abcd91020a70f9b90a0b0748b0128efaebddf9 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 1 Apr 2018 21:14:46 +0100 Subject: Fix some perl -cw and perl_checker warnings. --- lib/MGA/DrakISO/BuildBoot.pm | 13 ++++++------- lib/MGA/DrakISO/BuildISO.pm | 9 +++------ lib/MGA/DrakISO/BuildLoop.pm | 1 - lib/MGA/DrakISO/BuildMedia.pm | 1 - lib/MGA/DrakISO/BuildRoot.pm | 3 +-- lib/MGA/DrakISO/Config.pm | 2 +- lib/MGA/DrakISO/Utils.pm | 2 +- 7 files changed, 12 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm index 69d989c..9336f9e 100644 --- a/lib/MGA/DrakISO/BuildBoot.pm +++ b/lib/MGA/DrakISO/BuildBoot.pm @@ -29,7 +29,6 @@ package MGA::DrakISO::BuildBoot; use strict; use MDK::Common; -use common; use File::Copy qw(mv); use Try::Tiny; @@ -212,7 +211,7 @@ sub prepare_iso_bootloader { output($grub2_cfg, build_grub2_cfg($build, $theme_name, \@theme_fonts, $add_lang_menu, $add_kbd_menu)); } - my $title = $build->{media}{bootloader_title} // $label =~ s/-/ /gr; + my $title = $build->{media}{bootloader_title} || $label =~ s/-/ /gr; my $mode = $arch eq 'x86_64' ? '64-bit' : '32-bit'; # If we have a theme, replace the menu title with the name of the ISO @@ -222,7 +221,7 @@ sub prepare_iso_bootloader { run_('sed', '-i', qq(s/title-text:.*/title-text: "$title ($mode)"/), $base_theme_txt); } - my $efi_type = $build->{media}{efi_type} // 'none'; + my $efi_type = $build->{media}{efi_type} || 'none'; member($efi_type, qw(none 32bit 64bit all)) or die "ERROR: unrecognised EFI type '$efi_type'\n"; # If we are building a legacy-boot only ISO, we are done. @@ -365,9 +364,9 @@ sub build_grub2_cfg { ), (map { my ($name, $options) = @$_; - my $command = $options->{command} // 'linux'; - my $image = $options->{image} // get_default_image($build, $name); - my $initrd = $options->{initrd} // get_default_initrd($build); + my $command = $options->{command} || 'linux'; + my $image = $options->{image} || get_default_image($build, $name); + my $initrd = $options->{initrd} || get_default_initrd($build); my $append = $options->{append}; my $initrd_command = $command eq 'linux16 ' ? 'initrd16' : 'initrd'; @@ -378,7 +377,7 @@ sub build_grub2_cfg { ), "menuentry $gettext\"$name\" {", " $command $image " . join(' ', get_default_append($build), $append), - if_($initrd, + if_($initrd ne 'none', " $initrd_command $initrd", ), "}", diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm index f4278b1..09096a7 100644 --- a/lib/MGA/DrakISO/BuildISO.pm +++ b/lib/MGA/DrakISO/BuildISO.pm @@ -26,7 +26,6 @@ package MGA::DrakISO::BuildISO; use strict; use MDK::Common; -use common; use MGA::DrakISO::ISOBuild; use MGA::DrakISO::Loopback; @@ -46,7 +45,7 @@ our @EXPORT = qw(build_iso); sub build_iso { my ($build) = @_; - my $efi_type = $build->{media}{efi_type} // 'none'; + my $efi_type = $build->{media}{efi_type} || 'none'; my $loopbacks = $build->get_build_dir('loopbacks'); my $files = $build->get_build_dir('files'); @@ -99,11 +98,9 @@ sub list_selected_loopbacks { sub build_iso_image { my ($build, @opts) = @_; - my $arch = $build->{settings}{arch}; + my $efi_type = $build->{media}{efi_type} || 'none'; - my $efi_type = $build->{media}{efi_type} // 'none'; - - my $mbr_image = $build->get_absolute_path($build->{media}{mbr_boot_img}) // '/usr/lib/grub/i386-pc/boot_hybrid.img'; + my $mbr_image = $build->get_absolute_path($build->{media}{mbr_boot_img}) || '/usr/lib/grub/i386-pc/boot_hybrid.img'; -e $mbr_image or die "ERROR: cannot find MBR boot image $mbr_image\n"; my $esp_image = $build->get_build_dir('images') . '/esp.img'; diff --git a/lib/MGA/DrakISO/BuildLoop.pm b/lib/MGA/DrakISO/BuildLoop.pm index 5860310..e325d09 100644 --- a/lib/MGA/DrakISO/BuildLoop.pm +++ b/lib/MGA/DrakISO/BuildLoop.pm @@ -27,7 +27,6 @@ package MGA::DrakISO::BuildLoop; use strict; use MDK::Common; -use common; use File::Temp qw(tmpnam); diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm index 98473a3..b4479d9 100644 --- a/lib/MGA/DrakISO/BuildMedia.pm +++ b/lib/MGA/DrakISO/BuildMedia.pm @@ -26,7 +26,6 @@ package MGA::DrakISO::BuildMedia; use strict; use MDK::Common; -use common; use URPM; use urpm; use urpm::media; diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm index 85aefab..d1f4531 100644 --- a/lib/MGA/DrakISO/BuildRoot.pm +++ b/lib/MGA/DrakISO/BuildRoot.pm @@ -27,7 +27,6 @@ package MGA::DrakISO::BuildRoot; use strict; use MDK::Common; -use common; use File::Temp qw(tmpnam); use Try::Tiny; @@ -178,7 +177,7 @@ sub install_live_system { or die "ERROR: failed to install base system\n"; # Add the release notes. - for (qw(release-notes.html release-notes.txt)) { + foreach (qw(release-notes.html release-notes.txt)) { copy_file_to_root($live_root, '', 0644, $arch_repository . '/' . $_); } diff --git a/lib/MGA/DrakISO/Config.pm b/lib/MGA/DrakISO/Config.pm index 98d25ea..84363fb 100644 --- a/lib/MGA/DrakISO/Config.pm +++ b/lib/MGA/DrakISO/Config.pm @@ -28,7 +28,7 @@ use strict; use MDK::Common; use Pod::Usage; -use Cwd 'abs_path'; +use Cwd qw(abs_path); #- these modules can be used from config files use MGA::DrakISO::Mounts; diff --git a/lib/MGA/DrakISO/Utils.pm b/lib/MGA/DrakISO/Utils.pm index 5dad0ba..f5d83a7 100644 --- a/lib/MGA/DrakISO/Utils.pm +++ b/lib/MGA/DrakISO/Utils.pm @@ -26,7 +26,7 @@ package MGA::DrakISO::Utils; use strict; use MDK::Common; -use common; +use common qw(removeXiBSuffix); use fs; use IPC::Open3; use IO::Select; -- cgit v1.2.1