aboutsummaryrefslogtreecommitdiffstats
path: root/rpmtools.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-06-06 13:34:46 +0000
committerFrancois Pons <fpons@mandriva.com>2001-06-06 13:34:46 +0000
commit64aaa2635e372f388137778e2998e6bafb76afd6 (patch)
tree23c870639bc913e23b9b6337d5de4bf9c9946ee2 /rpmtools.pm
parent6de0ff3b3f1739639690884c5b03519b81dcfce7 (diff)
downloadrpmtools-64aaa2635e372f388137778e2998e6bafb76afd6.tar
rpmtools-64aaa2635e372f388137778e2998e6bafb76afd6.tar.gz
rpmtools-64aaa2635e372f388137778e2998e6bafb76afd6.tar.bz2
rpmtools-64aaa2635e372f388137778e2998e6bafb76afd6.tar.xz
rpmtools-64aaa2635e372f388137778e2998e6bafb76afd6.zip
fix ordering of packages to avoid some nasty loop in prerequisite chain
as for GConf and libGConf currently.
Diffstat (limited to 'rpmtools.pm')
-rw-r--r--rpmtools.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/rpmtools.pm b/rpmtools.pm
index b708616..ddad337 100644
--- a/rpmtools.pm
+++ b/rpmtools.pm
@@ -304,7 +304,7 @@ sub compute_depslist {
#- give an id to each packages, start from number of package already
#- registered in depslist.
my $global_id = scalar @{$params->{depslist}};
- foreach (sort { $ordered{$b->{name}} <=> $ordered{$a->{name}} || $a->{name} cmp $b->{name} } @info) {
+ foreach (sort { $ordered{$b->{name}} <=> $ordered{$a->{name}} || package_name_compare($a->{name}, $b->{name}) } @info) {
$_->{id} = $global_id++;
}
@@ -570,6 +570,19 @@ sub version_compare {
0;
}
+#- compare package name to increase chance of avoiding loop in prerequisite chain.
+sub package_name_compare {
+ my ($a, $b) = @_;
+ my ($sa,$sb);
+
+ ($sa) = ($a =~ /^lib(.*)/);
+ ($sb) = ($b =~ /^lib(.*)/);
+ $sa && $sb and return $sa cmp $sb;
+ $sa and return -1;
+ $sb and return +1;
+ $a cmp $b; #- fall back.
+}
+
#- compability function which should be removed soon, do not use anymore and replace code.
sub get_packages_installed {
my ($prefix, $packages, $names, $flags) = @_; $flags ||= [ qw(name version release)];