aboutsummaryrefslogtreecommitdiffstats
path: root/rpmtools.pm
diff options
context:
space:
mode:
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)];