diff options
Diffstat (limited to 'URPM')
-rw-r--r-- | URPM/Resolve.pm | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index dded564..1816eb1 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -58,7 +58,12 @@ Returns the property name (eg: "mageia-release" in above example) sub property2name { my ($property) = @_; - $property =~ /^([^\s\[]*)/ && $1; + my $name = $property; + if ($property =~ /^([^\s]+)\s*\[[^\[]*\]$/) { + $name = $1; + } + $name =~ s/\[\*\]$//; + return $name; } =item property2name_range($property) @@ -69,7 +74,14 @@ Returns the property name & range (eg: "mageia-release" & ">= 1" in above exampl sub property2name_range { my ($property) = @_; - $property =~ /^([^\s\[]*)(?:\[\*\])?\[?([^\s\]]*\s*[^\s\]]*)/; + my ($name, $range) = ($property, ""); + $name =~ s/\[\*\]$//; + if ($name =~ /^([^\s]+)\s*\[([^\[]*)\]$/) { + $name = $1; + $range = $2; + } + $name =~ s/\[\*\]$//; + return ($name, $range); } =item property2name_op_version($property) @@ -81,7 +93,15 @@ Returns the property name, operator & range (eg: "mageia-release", ">=", & "1" i sub property2name_op_version { my ($property) = @_; - $property =~ /^([^\s\[]*)(?:\[\*\])?\s*\[?([^\s\]]*)\s*([^\s\]]*)/; + my ($name, $op, $version) = ($property, "", ""); + $name =~ s/\[\*\]$//; + if ($name =~ /^([^\s]+)\s*\[([^\s\[]*)\s*([^\s\]]*)\]$/) { + $name = $1; + $op = $2; + $version = $3; + } + $name =~ s/\[\*\]$//; + return ($name, $op, $version); } |