summaryrefslogtreecommitdiffstats
path: root/perl-install/pkgs.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-12-12 10:27:49 +0000
committerFrancois Pons <fpons@mandriva.com>2000-12-12 10:27:49 +0000
commit12bbf61cabc866672e1c8026d5a826e921bf0ca4 (patch)
tree2b024c4c9a1ecfa5063328259736b815a345b3bd /perl-install/pkgs.pm
parent7e1dcea7f367619fe2fca98d79087a0beed267b4 (diff)
downloaddrakx-12bbf61cabc866672e1c8026d5a826e921bf0ca4.tar
drakx-12bbf61cabc866672e1c8026d5a826e921bf0ca4.tar.gz
drakx-12bbf61cabc866672e1c8026d5a826e921bf0ca4.tar.bz2
drakx-12bbf61cabc866672e1c8026d5a826e921bf0ca4.tar.xz
drakx-12bbf61cabc866672e1c8026d5a826e921bf0ca4.zip
fixed versionCompare to always return number. added checking of version to
select obsoletes on upgrade.
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r--perl-install/pkgs.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 42c7e3cd9..40dba3cf3 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -839,7 +839,7 @@ sub versionCompare($$) {
while ($a || $b) {
my ($sb, $sa) = map { $1 if $a =~ /^\W*\d/ ? s/^\W*0*(\d+)// : s/^\W*(\D*)// } ($b, $a);
$_ = length($sa) cmp length($sb) || $sa cmp $sb and return $_;
- $sa eq '' && $sb eq '' and return $a cmp $b;
+ $sa eq '' && $sb eq '' and return $a cmp $b || 0;
}
}
@@ -961,7 +961,10 @@ sub selectPackagesToUpgrade($$$;$$) {
#- TODO take into account version number and flags (that's why regexp :-)
$ask_child->(packageName($p), "obsoletes", sub {
- if ($_[0] =~ /^(\S*)/ && c::rpmdbNameTraverse($db, $1) > 0) {
+ #- take care of flags and version and release if present
+ if ($_[0] =~ /^(\S*)\s*(\S*)\s*([^\s-]*)-?(\S*)/ && c::rpmdbNameTraverse($db, $1) > 0) {
+ $3 and eval(versionCompare(packageVersion($p), $3) . $2 . 0) or next;
+ $4 and eval(versionCompare(packageRelease($p), $4) . $2 . 0) or next;
log::l("selecting " . packageName($p) . " by selection on obsoletes");
$obsoletedPackages{$1} = undef;
selectPackage($packages, $p);