From 851a38bdcae9a2a88c5abb41529619b50a393ebe Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 1 Dec 2010 18:13:01 +0100 Subject: [PATCH] - make expanddeps use the highest version of a package if multiple versions aver available in a repository [bnc#656599] --- Build/Zypp.pm | 2 +- expanddeps | 27 +++++++++++++++++++++++++-- init_buildsystem | 1 + 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Build/Zypp.pm b/Build/Zypp.pm index ac1550e..354adca 100644 --- a/Build/Zypp.pm +++ b/Build/Zypp.pm @@ -18,7 +18,7 @@ sub parsecfg($) $name = $1; } else { my ($key, $value) = split(/=/,$_,2); - $repo->{$key} = $value; + $repo->{$key} = $value if defined $key; } } close(REPO); diff --git a/expanddeps b/expanddeps index f2929c1..554c1e8 100755 --- a/expanddeps +++ b/expanddeps @@ -75,24 +75,47 @@ my %repo; my %ids; my %packs_arch; +my %packs_done; open(F, '<', $rpmdeps) || die("$rpmdeps: $!\n"); +# WARNING: the following code assumes that the 'I' tag comes last +my ($pkgF, $pkgP, $pkgR); while() { chomp; if (/^F:(.*?)-\d+\/\d+\/\d+: (.*)$/) { + $pkgF = $2; next if $fn{$1}; $fn{$1} = $2; my $pack = $1; $pack =~ /^(.*)\.([^\.]+)$/ or die; push @{$packs_arch{$2}}, $1; } elsif (/^P:(.*?)-\d+\/\d+\/\d+: (.*)$/) { + $pkgP = $2; next if $prov{$1}; $prov{$1} = $2; } elsif (/^R:(.*?)-\d+\/\d+\/\d+: (.*)$/) { + $pkgR = $2; next if $req{$1}; $req{$1} = $2; } elsif (/^I:(.*?)-\d+\/\d+\/\d+: (.*)$/) { - next if $ids{$1}; - $ids{$1} = $2; + if ($ids{$1} && !$packs_done{$1} && defined($pkgF) && defined($pkgP) && defined($pkgR)) { + my $i = $1; + my $oldid = $ids{$1}; + my $newid = $2; + if (Build::Rpm::verscmp($oldid, $newid) < 0) { + $ids{$i} = $newid; + $fn{$i} = $pkgF; + $prov{$i} = $pkgP; + $req{$i} = $pkgR; + } + } else { + next if $ids{$1}; + $ids{$1} = $2; + } + undef $pkgF; + undef $pkgP; + undef $pkgR; + } elsif ($_ eq 'D:') { + %packs_done = %ids; } } close F; diff --git a/init_buildsystem b/init_buildsystem index a3e55be..f0e013f 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -326,6 +326,7 @@ validate_cache_file() fi echo "$@" >&2 "$@" || cleanup_and_exit 1 + echo D: done > $CACHE_FILE.new mv $CACHE_FILE.new $CACHE_FILE -- 2.7.4