diff options
author | Pascal Terjan <pterjan@mageia.org> | 2022-12-18 21:36:53 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2022-12-19 20:31:51 +0000 |
commit | 8c53742a5e1b5b01a7635ea33dbb72ec3c957e13 (patch) | |
tree | 6738d37059a05ba87009b4c9eebb88c9d9d377b6 /URPM | |
parent | dfacc46ae9b38949e9089eb5e68db8fc812db25e (diff) | |
download | perl-URPM-8c53742a5e1b5b01a7635ea33dbb72ec3c957e13.tar perl-URPM-8c53742a5e1b5b01a7635ea33dbb72ec3c957e13.tar.gz perl-URPM-8c53742a5e1b5b01a7635ea33dbb72ec3c957e13.tar.bz2 perl-URPM-8c53742a5e1b5b01a7635ea33dbb72ec3c957e13.tar.xz perl-URPM-8c53742a5e1b5b01a7635ea33dbb72ec3c957e13.zip |
Add back support for foo > 5 in property2name*
This is used internally to create search queries.
At the same time update synthesis tests to be more representative
by using foo[< 5] syntax which has been what is genereated for
many many years.
Diffstat (limited to 'URPM')
-rw-r--r-- | URPM/Resolve.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 1816eb1..dde3159 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -48,6 +48,9 @@ sub find(&@) { The property2name* functions parse things like "mageia-release[>= 1]" which is the format returned by URPM.xs for ->requires, ->provides, ->conflicts... +They also support the format "mageia-release > 1" which get generated by +some code to find newer versions of a package for example. + =over 4 =item property2name($property) @@ -59,7 +62,7 @@ Returns the property name (eg: "mageia-release" in above example) sub property2name { my ($property) = @_; my $name = $property; - if ($property =~ /^([^\s]+)\s*\[[^\[]*\]$/) { + if ($property =~ /^([^\s]+)(\s*\[[^\[]*\]$|\s+[><=])/) { $name = $1; } $name =~ s/\[\*\]$//; @@ -76,9 +79,9 @@ sub property2name_range { my ($property) = @_; my ($name, $range) = ($property, ""); $name =~ s/\[\*\]$//; - if ($name =~ /^([^\s]+)\s*\[([^\[]*)\]$/) { + if ($name =~ /^([^\s]+)(\s*\[([^\[]+)\]|\s+([><=].*))$/) { $name = $1; - $range = $2; + $range = $3 || $4; } $name =~ s/\[\*\]$//; return ($name, $range); @@ -93,12 +96,11 @@ Returns the property name, operator & range (eg: "mageia-release", ">=", & "1" i sub property2name_op_version { my ($property) = @_; - my ($name, $op, $version) = ($property, "", ""); - $name =~ s/\[\*\]$//; - if ($name =~ /^([^\s]+)\s*\[([^\s\[]*)\s*([^\s\]]*)\]$/) { - $name = $1; - $op = $2; - $version = $3; + my ($name, $range) = property2name_range($property); + my ($op, $version) = ("", ""); + if ($range =~ /^([><=]+)\s+(.*)$/) { + $op = $1; + $version = $2; } $name =~ s/\[\*\]$//; return ($name, $op, $version); |