my ($config, $pkginfo, @depfiles) = @_;
my %requires = ();
+ my %recommends = ();
local *F;
my %provides;
my $dofileprovides = %{$config->{'fileprovides'}};
for my $rr (keys %$depfile) {
$provides{$rr} = $depfile->{$rr}->{'provides'};
$requires{$rr} = $depfile->{$rr}->{'requires'};
+ $recommends{$rr} = $depfile->{$rr}->{'recommends'};
}
next;
}
}
my %ss;
@ss = grep {!$ss{$_}++} @ss;
- if ($s =~ /^(P|R):(.*)\.(.*)-\d+\/\d+\/\d+:$/) {
+ if ($s =~ /^(P|R|r):(.*)\.(.*)-\d+\/\d+\/\d+:$/) {
my $pkgid = $2;
my $arch = $3;
if ($1 eq "R") {
$pkginfo->{$pkgid}->{'release'} = $r if defined($r);
$pkginfo->{$pkgid}->{'arch'} = $arch;
$pkginfo->{$pkgid}->{'provides'} = \@ss;
+ if ($1 eq "r") {
+ $recommends{$pkgid} = \@ss;
+ $pkginfo->{$pkgid}->{'recommends'} = \@ss if $pkginfo;
+ next;
+ }
}
}
}
}
$config->{'providesh'} = \%provides;
$config->{'requiresh'} = \%requires;
+ $config->{'recommendsh'} = \%recommends;
makewhatprovidesh($config);
}
+sub getbuildid {
+ my ($q) = @_;
+ my $evr = $q->{'version'};
+ $evr = "$q->{'epoch'}:$evr" if $q->{'epoch'};
+ $evr .= "-$q->{'release'}" if defined $q->{'release'};;
+ my $buildtime = $q->{'buildtime'} || 0;
+ $evr .= " $buildtime";
+ $evr .= "-$q->{'arch'}" if defined $q->{'arch'};
+ return "$q->{'name'}-$evr";
+}
+
+sub writedeps {
+ my ($fh, $pkg, $url) = @_;
+ $url = '' unless defined $url;
+ return unless defined($pkg->{'name'}) && defined($pkg->{'arch'});
+ return if $pkg->{'arch'} eq 'src' || $pkg->{'arch'} eq 'nosrc';
+ my $id = $pkg->{'id'};
+ $id = ($pkg->{'buildtime'} || 0)."/".($pkg->{'filetime'} || 0)."/0" unless $id;
+ $id = "$pkg->{'name'}.$pkg->{'arch'}-$id: ";
+ print $fh "F:$id$url$pkg->{'location'}\n";
+ print $fh "P:$id".join(' ', @{$pkg->{'provides'} || []})."\n";
+ print $fh "R:$id".join(' ', @{$pkg->{'requires'}})."\n" if $pkg->{'requires'};
+ print $fh "r:$id".join(' ', @{$pkg->{'recommends'}})."\n" if $pkg->{'recommends'};
+ print $fh "C:$id".join(' ', @{$pkg->{'conflicts'}})."\n" if $pkg->{'conflicts'};
+ print $fh "O:$id".join(' ', @{$pkg->{'obsoletes'}})."\n" if $pkg->{'obsoletes'};
+ print $fh "I:$id".getbuildid($pkg)."\n";
+}
+
+>>>>>>> d6ff6eb... Recognize Recommends relations of RPMs.
sub makewhatprovidesh {
my ($config) = @_;
delete $config->{'providesh'};
delete $config->{'whatprovidesh'};
delete $config->{'requiresh'};
+ delete $config->{'recommendsh'};
}
my %addproviders_fm = (
my $whatprovides = $config->{'whatprovidesh'};
my $requires = $config->{'requiresh'};
+ my $recommends = $config->{'recommendsh'};
my %xignore = map {substr($_, 1) => 1} grep {/^-/} @p;
@p = grep {!/^-/} @p;
last;
}
}
+ if (@q > 1 && $config->{"buildflags:userecommendsforchoices"} && @{$recommends->{$p} || []} > 0) {
+ my @recommendedq;
+ my $i;
+
+ for my $iq (@q) {
+ for my $rpkg (@{$recommends->{$p}}) {
+ if ($rpkg =~ /$iq/) {
+ push @recommendedq, $iq;
+ }
+ }
+ }
+ if (@recommendedq > 0) {
+ print "recommended [@recommendedq] among [@q]\n" if $expand_dbg;
+ @q = @recommendedq;
+ }
+ }
if (@q > 1) {
if ($r ne $p) {
push @error, "have choice for $r needed by $p: @q";
my ($config, @p) = @_;
my $requires = $config->{'requiresh'};
+ my $recommends = $config->{'recommendsh'};
my $whatprovides = $config->{'whatprovidesh'};
my %deps;
my %rdeps;
my ($config, @p) = @_;
my $whatprovides = $config->{'whatprovidesh'};
my $requires = $config->{'requiresh'};
+ my $recommends = $config->{'recommendsh'};
my %a;
for my $p (@p) {
for my $r (@{$requires->{$p} || [$p]}) {
push @archs, 'noarch' unless grep {$_ eq 'noarch'} @archs;
}
-my (%fn, %prov, %req);
+my (%fn, %prov, %req, %rec);
my %packs;
my %repo;
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);
+my ($pkgF, $pkgP, $pkgR, $pkgr);
while(<F>) {
chomp;
if (/^F:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
$pkgR = $2;
next if $req{$1};
$req{$1} = $2;
+ } elsif (/^r:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+ $pkgr = $2;
} elsif (/^I:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
my $r = 0;
if ($usehigherdeps) {
$fn{$i} = $pkgF;
$prov{$i} = $pkgP;
$req{$i} = $pkgR;
+ $rec{$i} = $pkgr;
}
} else {
next if $ids{$1};
undef $pkgF;
undef $pkgP;
undef $pkgR;
+ undef $pkgr;
} elsif ($_ eq 'D:') {
%packs_done = %ids;
}
}
for my $pack (keys %packs) {
my $r = {};
- my (@s, $s, @pr, @re);
+ my (@s, $s, @pr, @re, @rc);
@s = split(' ', $prov{$packs{$pack}} || '');
while (@s) {
$s = shift @s;
}
$r->{'provides'} = \@pr;
$r->{'requires'} = \@re;
+ $r->{'recommends'} = \@rc;
$repo{$pack} = $r;
}