From 9675aec7c9868fb9293b6219ea28722cc5ba6b46 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 24 May 2017 16:02:29 +0200 Subject: [PATCH] Kiwi: Fix versionstring function The old version could not deal with '0' components. Make it quite a bit shorter as well. --- Build/Kiwi.pm | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Build/Kiwi.pm b/Build/Kiwi.pm index c46c84833..80864eef4 100644 --- a/Build/Kiwi.pm +++ b/Build/Kiwi.pm @@ -48,13 +48,9 @@ sub findFallBackArchs { # sles10 perl does not have the version.pm # implement own hack sub versionstring { - my ($str) = @_; - my @xstr = split (/\./,$str); + my ($str) = @_; my $result = 0; - while (my $digit = shift(@xstr)) { - $result = $result * 100; - $result += $digit; - } + $result = $result * 100 + $_ for split (/\./, $str); return $result; } @@ -72,7 +68,7 @@ sub kiwiparse { my @requiredarch; my @badarch; my $schemaversion = 0; - my $schemaversion56 = versionstring("5.6"); + my $schemaversion56 = versionstring('5.6'); my $obsexclusivearch; my $obsexcludearch; $obsexclusivearch = $1 if $xml =~ /^\s*\s*$/im; @@ -232,11 +228,11 @@ sub kiwiparse { for my $package (@pkgs) { # filter packages, which are not targeted for the wanted plattform if ($package->{'arch'}) { - my $valid=undef; + my $valid; if (@requiredarch) { # this is a product - foreach my $ma(@requiredarch) { - foreach my $pa(split(",", $package->{'arch'})) { + for my $ma (@requiredarch) { + for my $pa (split(",", $package->{'arch'})) { $valid = 1 if $ma eq $pa; } } @@ -244,7 +240,7 @@ sub kiwiparse { # live appliance my $ma = $arch; $ma =~ s/i[456]86/i386/; - foreach my $pa(split(",", $package->{'arch'})) { + for my $pa (split(",", $package->{'arch'})) { $pa =~ s/i[456]86/i386/; $valid = 1 if $ma eq $pa; }