diff options
author | MyungJoo Ham <myungjoo.ham@samsung.com> | 2016-10-27 14:26:00 +0900 |
---|---|---|
committer | SoonKyu Park <sk7.park@samsung.com> | 2017-02-10 10:03:19 +0900 |
commit | 5b60f70921a1174e9ee2ebb475a4c1f2c990be0c (patch) | |
tree | 2d808f375d64127b44772771707756be4960ef5f /expanddeps | |
parent | 53409a67edf5778f7939506c30c192551f982bee (diff) | |
download | build-5b60f70921a1174e9ee2ebb475a4c1f2c990be0c.tar.gz build-5b60f70921a1174e9ee2ebb475a4c1f2c990be0c.tar.bz2 build-5b60f70921a1174e9ee2ebb475a4c1f2c990be0c.zip |
Recognize Recommends relations of RPMs
When there are multiple candidate packages as a result of
Provides, the current obs-build gives an error: "have choice for".
However, according to http://www.rpm.org/wiki/PackagerDocs/Dependencies ,
Recommends tells the system to install the corresponding package
unless there is a conflict; thus, if there is a package recommended
(as described in issue #302), obs-build shall install the recommended
package, resolving "have choice for" error.
To enable, OBS project should declare:
"BuildFlags: UseRecommendsForChoices=1"
or
"BuildFlags: UseRecommendsForChoices"
in its project config.
Fixes #302
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Conflicts:
createdirdeps
expanddeps
Change-Id: I65dc6dd16a6874b7c1ae47932d37c23ec98b9cdf
Diffstat (limited to 'expanddeps')
-rwxr-xr-x | expanddeps | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -126,7 +126,7 @@ if (defined($dist) && $dist ne '') { $binarytype = $cf->{'binarytype'} if $cf->{'binarytype'} && $cf->{'binarytype'} ne 'UNDEFINED'; } -my (%fn, %prov, %req, %con, %obs); +my (%fn, %prov, %req, %rec, %con, %obs); my %packs; my %repo; @@ -170,7 +170,7 @@ my %exportfilters = %{$cf->{'exportfilter'}}; open(F, '<', $rpmdeps) || die("$rpmdeps: $!\n"); # WARNING: the following code assumes that the 'I' tag comes last -my ($pkgF, $pkgP, $pkgR, $pkgC, $pkgO); +my ($pkgF, $pkgP, $pkgR, $pkgr, $pkgC, $pkgO); my $verscmp = \&Build::Rpm::verscmp; @@ -210,6 +210,8 @@ while(<F>) { $pkgR = $2; next if $req{$1}; $req{$1} = $2; + } elsif (/^r:(.*?)-\d+\/\d+\/\d+: (.*)$/) { + $pkgr = $2; } elsif (/^C:(.*?)-\d+\/\d+\/\d+: (.*)$/) { $pkgC = $2; next if $con{$1}; @@ -241,9 +243,11 @@ while(<F>) { $fn{$i} = $pkgF; $prov{$i} = $pkgP; delete $req{$i}; + delete $rec{$i}; delete $con{$i}; delete $obs{$i}; $req{$i} = $pkgR; + $rec{$i} = $pkgr; $con{$i} = $pkgC if defined $pkgC; $obs{$i} = $pkgO if defined $pkgO; } else { @@ -253,6 +257,7 @@ while(<F>) { undef $pkgF; undef $pkgP; undef $pkgR; + undef $pkgr; undef $pkgC; undef $pkgO; } elsif ($_ eq 'D:') { @@ -267,7 +272,7 @@ for my $arch (@archs) { for my $pack (keys %packs) { my $r = {}; - my (@s, $s, @pr, @re, @co, @ob); + my (@s, $s, @pr, @re, @rc, @co, @ob); @s = split(' ', $prov{$packs{$pack}} || ''); while (@s) { $s = shift @s; @@ -300,6 +305,22 @@ for my $pack (keys %packs) { splice(@s, 0, 2); } } + @s = split(' ', $rec{$packs{$pack}} || ''); + while (@s) { + $s = shift @s; + next if !$dofileprovides && $s =~ /^\//; + if ($s =~ /^rpmlib\(/) { + splice(@s, 0, 2); + next; + } + push @rc, $s; + while (@s && $s[0] =~ /^[\(<=>|]/) { + $rc[-1] .= " $s[0] $s[1]"; + $rc[-1] =~ s/ \((.*)\)/ $1/; + $rc[-1] =~ s/(<|>){2}/$1/; + splice(@s, 0, 2); + } + } @s = split(' ', $con{$packs{$pack}} || ''); while (@s) { $s = shift @s; @@ -326,6 +347,7 @@ for my $pack (keys %packs) { } $r->{'provides'} = \@pr; $r->{'requires'} = \@re; + $r->{'recommends'} = \@rc; $r->{'conflicts'} = \@co; $r->{'obsoletes'} = \@ob; $repo{$pack} = $r; |