diff options
-rw-r--r-- | Tools.pm | 24 | ||||
-rw-r--r-- | t/003_is_hybrid.t | 2 | ||||
-rw-r--r-- | t_install_iso/010_check_autorun.t | 16 | ||||
-rw-r--r-- | t_install_iso/012_check_ids.t | 2 | ||||
-rw-r--r-- | t_install_iso/013_check_rpms.t | 2 | ||||
-rw-r--r-- | t_install_iso/016_check_pubkey.t | 10 |
6 files changed, 27 insertions, 29 deletions
@@ -33,18 +33,18 @@ use base 'Exporter'; sub parse_mageia_iso_name { my ($name) = @_; - my %info = (); - - if ($name =~ m/^(Mageia)-(\d+)(-(alpha|beta|RC)(\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BD))?(-(build\_\w+))?\.(.*)$/) { - $info{"full"} = $name; - $info{"name"} = $1 if defined $1; - $info{"version"} = $2 if defined $2; - $info{"release"} = "$4$5" if defined $4; - $info{"variant"} = $7 if defined $7; - $info{"arch"} = $8 if defined $8; - $info{"medium"} = $10 if defined $10; - $info{"build"} = $12 if defined $12; - $info{"ext"} = $13 if defined $13; + my %info; + + if ($name =~ m/^(Mageia)-(\d+)(-(alpha|beta|RC)(\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BD))?(-(build_\w+))?\.(.*)$/) { + $info{full} = $name; + $info{name} = $1 if defined $1; + $info{version} = $2 if defined $2; + $info{release} = "$4$5" if defined $4; + $info{variant} = $7 if defined $7; + $info{arch} = $8 if defined $8; + $info{medium} = $10 if defined $10; + $info{build} = $12 if defined $12; + $info{ext} = $13 if defined $13; } diff --git a/t/003_is_hybrid.t b/t/003_is_hybrid.t index a491321..c1b0c25 100644 --- a/t/003_is_hybrid.t +++ b/t/003_is_hybrid.t @@ -24,7 +24,7 @@ bail_on_fail; my ($image_path) = @ARGV; -ok (is_hybrid($image_path, 0), "Is hybrid"); +ok is_hybrid($image_path, 0), "Is hybrid"; # Verification if the ISO is hybrid sub is_hybrid { diff --git a/t_install_iso/010_check_autorun.t b/t_install_iso/010_check_autorun.t index af8f4b9..ce6000a 100644 --- a/t_install_iso/010_check_autorun.t +++ b/t_install_iso/010_check_autorun.t @@ -30,20 +30,18 @@ my $name = basename($image_path); bail_on_fail; -set_failure_handler( sub { +set_failure_handler(sub { print "umount iso\n"; system 'umount /media/iso_check; rm -r /media/iso_check'; }); -# Autorun is on CD AND DVD -#my %info = Tools::parse_mageia_iso_name($name); -#skip 'Autorun is only on DVDs.', 13 unless $info{"medium"} eq 'DVD'; - # -ok (-r "/media/iso_check/autorun.inf", 'autorun.inf is there'); +ok -r "/media/iso_check/autorun.inf", 'autorun.inf is there'; BAIL_OUT('Autorun stuff is missing anyway.') if !(-r "/media/iso_check/autorun.inf"); +# TODO check media name in autorun.inf (for Windows) + # my $lines = `cat -e /media/iso_check/autorun.inf | wc -l`; my $num = `cat -e /media/iso_check/autorun.inf | grep "\\^M" | wc -l`; @@ -52,9 +50,9 @@ chomp($lines); my $last = `cat -e /media/iso_check/autorun.inf | tail -n 1 | grep "\\^M" | wc -l`; # TODO rewrite this -if ( ($lines != $num && $lines - 1 != $num) - || ($lines == 0) - || ($lines -1 == $num && $last == 1)) { +if ($lines != $num && $lines - 1 != $num + || $lines == 0 + || $lines - 1 == $num && $last == 1) { fail('autorun.inf valid EOL chars'); } else { pass('autorun.inf valid EOL chars'); diff --git a/t_install_iso/012_check_ids.t b/t_install_iso/012_check_ids.t index 3a13307..b7161af 100644 --- a/t_install_iso/012_check_ids.t +++ b/t_install_iso/012_check_ids.t @@ -36,6 +36,6 @@ $valid2 = -r "/media/iso_check/x86_64/isolinux/pci.ids" if -r "/media/iso_check/ $valid &= $valid2 if -r "/media/iso_check/x86_64" && -r "/media/iso_check/i586"; $valid = $valid2 if -r "/media/iso_check/x86_64" && !$valid; -ok ($valid, 'HDT can find pci.ids.'); +ok $valid, 'HDT can find pci.ids.'; done_testing(); diff --git a/t_install_iso/013_check_rpms.t b/t_install_iso/013_check_rpms.t index b87f4a0..f7c9a7a 100644 --- a/t_install_iso/013_check_rpms.t +++ b/t_install_iso/013_check_rpms.t @@ -38,7 +38,7 @@ while ($pkg = <$list>) { $sign = ''; chomp($pkg); $sign = `rpm -K $pkg | grep 'gpg OK'`; - ok ($sign, "$pkg is correctly signed."); + ok $sign, "$pkg is correctly signed."; $valid = 0 if !$sign; } diff --git a/t_install_iso/016_check_pubkey.t b/t_install_iso/016_check_pubkey.t index 3678059..d65e2bc 100644 --- a/t_install_iso/016_check_pubkey.t +++ b/t_install_iso/016_check_pubkey.t @@ -39,17 +39,17 @@ my $media; system "ls /media/iso_check/i586/media/ > temp_media_on_iso.log" if -r "/media/iso_check/i586/media/"; system "ls /media/iso_check/x86_64/media/ >> temp_media_on_iso.log" if -r "/media/iso_check/x86_64/media/"; -ok (-r "temp_media_on_iso.log", "Got a log for media contents"); +ok -r "temp_media_on_iso.log", "Got a log for media contents"; open(my $file, "temp_media_on_iso.log") if -r "temp_media_on_iso.log"; while ($media = <$file>) { chomp($media); - if ($info{"arch"} ne "dual" && $media ne 'media_info') { - $path = "/media/iso_check/" . $info{"arch"} . "/media/$media/media_info/pubkey"; - $url = "pubkey/" . $info{"arch"} . "-$media-pubkey"; + if ($info{arch} ne "dual" && $media ne 'media_info') { + $path = "/media/iso_check/" . $info{arch} . "/media/$media/media_info/pubkey"; + $url = "pubkey/" . $info{arch} . "-$media-pubkey"; #$url .= "-cooker" if !$finale; - $pubkey &= check_key($path, $url, $media, $info{"arch"}) if -r $path && -r $url; + $pubkey &= check_key($path, $url, $media, $info{arch}) if -r $path && -r $url; } elsif ($media ne 'media_info') { foreach my $arch ("i586", "x86_64") { |