aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-12-11 15:55:00 +0000
committerRomain d'Alverny <rda@mageia.org>2011-12-11 15:55:00 +0000
commit543061d149e356be0fc8b3fbaf524e80e8abe70e (patch)
tree52ed4bc92397320596f734228a77ddcecb3fbab4
parent22c137a43c56a0136c51690d75add85d9e9d55f9 (diff)
downloadisocheck-543061d149e356be0fc8b3fbaf524e80e8abe70e.tar
isocheck-543061d149e356be0fc8b3fbaf524e80e8abe70e.tar.gz
isocheck-543061d149e356be0fc8b3fbaf524e80e8abe70e.tar.bz2
isocheck-543061d149e356be0fc8b3fbaf524e80e8abe70e.tar.xz
isocheck-543061d149e356be0fc8b3fbaf524e80e8abe70e.zip
Revert to previous test structure + updated regexp.
Changed regexp did not validate all needed test cases.
-rw-r--r--Tools.pm21
1 files changed, 15 insertions, 6 deletions
diff --git a/Tools.pm b/Tools.pm
index 54d4f66..2342992 100644
--- a/Tools.pm
+++ b/Tools.pm
@@ -31,16 +31,25 @@ use base 'Exporter';
our @EXPORT = qw(parse_mageia_iso_name);
+# Check image filename if it is valid (see https://wiki.mageia.org/en/Product_naming)
+#
+# In: filename
+# Out: populated hash if valid, empty hash otherwise.
+#
sub parse_mageia_iso_name {
my ($name) = @_;
my %info;
- if ((@info{qw(name version release variant arch medium build ext)})
- = $name =~ m/^(Mageia)-(\d+)-((?:alpha|beta|RC)\d*)?(-(?:.*))?-(i586|x86_64|dual)?(?:-(CD|DVD|BD))?(?:-(build_\w+))?\.(.*)$/)
- {
- $info{full} = $name;
- } else {
- %info = ();
+ if ($name =~ m/^(Mageia)-(\d+)(-((nightly|alpha|beta|RC)\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BR))?(-(build_\w+))?\.(.*)$/) {
+ $info{full} = $name;
+ $info{name} = $1 if defined $1;
+ $info{version} = $2 if defined $2;
+ $info{release} = $4 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;
}
return %info;