summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2014-10-09 12:40:47 (GMT)
committerMichael Schroeder <mls@suse.de>2014-10-09 12:41:25 (GMT)
commit4343cba3cdf83a28684072aaf8bf9cc429f86b90 (patch)
treec9731238d9d6e5d4f450860c8e7fa0aad5e79ca4
parent03cbe99986faf4379fb758b46e40ecd746d3ef60 (diff)
downloadobs-build-4343cba3cdf83a28684072aaf8bf9cc429f86b90.tar.gz
obs-build-4343cba3cdf83a28684072aaf8bf9cc429f86b90.tar.xz
Collect conflicts dependencies as well
Needed for conflict handling.
-rwxr-xr-xcreaterepomddeps5
-rwxr-xr-xcreaterpmdeps10
-rwxr-xr-xcreateyastdeps40
-rwxr-xr-xexpanddeps56
4 files changed, 58 insertions, 53 deletions
diff --git a/createrepomddeps b/createrepomddeps
index d1281a8..8d9105b 100755
--- a/createrepomddeps
+++ b/createrepomddeps
@@ -379,6 +379,11 @@ sub printasbuildcachefile(@)
$deps = deps2string(@{$pkg->{'requires'}});
print "R:$id$deps\n";
+ if (@{$pkg->{'conflicts'} || []}) {
+ $deps = deps2string(@{$pkg->{'conflicts'}});
+ print "C:$id$deps\n";
+ }
+
my $tag = sprintf("%s-%s-%s %s",
$pkg->{'name'},
$pkg->{'ver'},
diff --git a/createrpmdeps b/createrpmdeps
index 30bf555..7a40dda 100755
--- a/createrpmdeps
+++ b/createrpmdeps
@@ -35,6 +35,7 @@ my %tag;
my %oldp;
my %oldr;
+my %oldc;
if (defined($rpmdepfile) && open(F, '<', $rpmdepfile)) {
while (<F>) {
chomp;
@@ -42,6 +43,8 @@ if (defined($rpmdepfile) && open(F, '<', $rpmdepfile)) {
$oldp{$1} = $_;
} elsif (/^R:([^ ]): /) {
$oldr{$1} = $_;
+ } elsif (/^C:([^ ]): /) {
+ $oldc{$1} = $_;
}
}
close F;
@@ -94,9 +97,11 @@ foreach my $dir (@ARGV) {
my %newp;
my %newr;
+ my %newc;
for (@known) {
$newp{$_} = $oldp{$_} if $oldp{$_};
$newr{$_} = $oldr{$_} if $oldr{$_};
+ $newc{$_} = $oldc{$_} if $oldc{$_};
}
my @todo = grep {!($newp{$_} && $newr{$_})} @known;
@@ -104,10 +109,11 @@ foreach my $dir (@ARGV) {
for my $known (@todo) {
my $path = $known2path{$known};
if ($path =~ /\.rpm$/) {
- my %res = Build::Rpm::rpmq($path, 1000, 1001, 1002, 1006, 1022, 1047, 1049, 1048, 1050, 1112, 1113);
+ my %res = Build::Rpm::rpmq($path, 1000, 1001, 1002, 1006, 1022, 1047, 1049, 1048, 1050, 1053, 1054, 1055, 1112, 1113);
next unless %res;
Build::Rpm::add_flagsvers(\%res, 1047, 1112, 1113);
Build::Rpm::add_flagsvers(\%res, 1049, 1048, 1050);
+ Build::Rpm::add_flagsvers(\%res, 1054, 1053, 1055);
my $id = $known;
$id =~ s/.*-//;
if ($known ne "$res{1000}->[0].$res{1022}->[0]-$id") {
@@ -127,6 +133,7 @@ foreach my $dir (@ARGV) {
$newp{$known} = "P:$known: ".join(' ', @{$res{1047} || []});
$newr{$known} = "R:$known: ".join(' ', @{$res{1049} || []});
+ $newc{$known} = "C:$known: ".join(' ', @{$res{1054} || []}) if @{$res{1054} || []};
#$tag{$known} = $res{1000}->[0]."-".$res{1001}->[0]."-".$res{1002}->[0]." ".$res{1007}->[0]."-".$res{1006}->[0];
$tag{$known} = $res{1000}->[0]."-".$res{1001}->[0]."-".$res{1002}->[0]." ".$res{1006}->[0];
} else {
@@ -161,6 +168,7 @@ foreach my $dir (@ARGV) {
print "F:$_: $known2path{$_}\n";
print "$newp{$_}\n";
print "$newr{$_}\n";
+ print "$newc{$_}\n" if $newc{$_};
print "I:$_: $tag{$_}\n" if exists $tag{$_};
}
}
diff --git a/createyastdeps b/createyastdeps
index 58a58af..e38c46b 100755
--- a/createyastdeps
+++ b/createyastdeps
@@ -37,18 +37,11 @@ sub print_pkg($)
my $pkg = shift;
return if $pkg->{'arch'} eq 'src' || $pkg->{'arch'} eq 'nosrc';
- my $id = sprintf("%s.%s-%d/%d/%d: ",
- $pkg->{'name'},
- $pkg->{'arch'},
- $pkg->{'buildtime'},
- 0,
- 0);
- print sprintf('F:%s%ssuse/%s/%s',$id,$pkg->{'baseurl'},
- $pkg->{'arch'}, $pkg->{'location'}), "\n";
-
- print "P:$id".$pkg->{'provides'}."\n";
- print "R:$id".$pkg->{'requires'}."\n";
-
+ my $id = sprintf("%s.%s-%d/%d/%d: ", $pkg->{'name'}, $pkg->{'arch'}, $pkg->{'buildtime'}, 0, 0);
+ print "F:$id$pkg->{'baseurl'}suse/$pkg->{'arch'}/$pkg->{'location'}\n";
+ print "P:$id$pkg->{'provides'}\n";
+ print "R:$id$pkg->{'requires'}\n";
+ print "C:$id$pkg->{'conflicts'}\n" if $pkg->{'conflicts'};
my $tag = sprintf("%s-%s-%s %s",
$pkg->{'name'},
$pkg->{'version'},
@@ -64,23 +57,21 @@ sub callback
$pkg->{'provides'} = [] unless exists $pkg->{'provides'};
# add self provides (rpm3 misses that)
my $n = $pkg->{'name'};
- if(substr($pkg->{'arch'}, -3) ne 'src' && !scalar grep(/^\Q$n\E( =.*)?$/,@{$pkg->{'provides'}}))
- {
+ if(substr($pkg->{'arch'}, -3) ne 'src' && !grep(/^\Q$n\E( =.*)?$/,@{$pkg->{'provides'}})) {
push @{$pkg->{'provides'}}, sprintf("%s = %s-%s", $pkg->{'name'}, $pkg->{'version'}, $pkg->{'release'});
}
$pkg->{'provides'} = join(' ', @{$pkg->{'provides'}});
$pkg->{'requires'} = join(' ', @{$pkg->{'requires'}}) if $pkg->{'requires'};
+ $pkg->{'conflicts'} = join(' ', @{$pkg->{'conflicts'}}) if $pkg->{'conflicts'};
$pkg->{'baseurl'} = $url;
my @data = split(' ', $pkg->{'location'});
# multi cd support hack
my $num = $data[0];
- if($pkg->{'baseurl'} =~ /1\/$/ && $num ne 0) {
+ if($pkg->{'baseurl'} =~ /1\/$/ && $num ne '0') {
$pkg->{'baseurl'} =~ s/1\/$/$num\//;
}
$pkg->{'location'} = $data[1];
-
print_pkg($pkg);
-
return 0;
}
@@ -89,19 +80,10 @@ sub callback
my $opt_zypp;
my $cachedir = "/var/cache/build";
-GetOptions (
- "zypp=s" => \$opt_zypp,
- "cachedir=s" => \$cachedir,
- ) or exit(1);
+GetOptions ("zypp=s" => \$opt_zypp, "cachedir=s" => \$cachedir) or exit(1);
for my $url (@ARGV) {
- my $dir;
- if ($opt_zypp) {
- $dir = $opt_zypp;
- } else {
- $dir = $url;
- }
-
+ my $dir = $opt_zypp ? $opt_zypp : $url;
$dir .= '/' unless $dir =~ /\/$/;
$url .= '/' unless $url =~ /\/$/;
@@ -110,6 +92,6 @@ for my $url (@ARGV) {
my @order = ();
my $pkgs = Build::Susetags::parse($packages,
- { 'Loc' => 'location', 'Prv' => 'provides', 'Req' => 'requires', 'Tim' => 'buildtime' },
+ { 'Loc' => 'location', 'Prv' => 'provides', 'Req' => 'requires', 'Con' => 'conflicts', 'Tim' => 'buildtime' },
{ cb => \&callback, data => $url });
}
diff --git a/expanddeps b/expanddeps
index fc9da3f..73a85e6 100755
--- a/expanddeps
+++ b/expanddeps
@@ -115,7 +115,7 @@ if (defined($dist) && $dist ne '') {
$binarytype = $cf->{'binarytype'} if $cf->{'binarytype'} && $cf->{'binarytype'} ne 'UNDEFINED';
}
-my (%fn, %prov, %req);
+my (%fn, %prov, %req, %con);
my %packs;
my %repo;
@@ -125,7 +125,7 @@ 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);
+my ($pkgF, $pkgP, $pkgR, $pkgC);
my $verscmp = \&Build::Rpm::verscmp;
@@ -140,35 +140,32 @@ while(<F>) {
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;
- $prov{$1} ||= $2;
} elsif (/^R:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
$pkgR = $2;
- $req{$1} ||= $2;
+ } elsif (/^C:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+ $pkgC = $2;
} elsif (/^I:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
- if ($ids{$1} && !$packs_done{$1} && defined($pkgF) && defined($pkgP) && defined($pkgR)) {
- my $i = $1;
- my $oldid = $ids{$1};
- my $newid = $2;
- if ($verscmp->($oldid, $newid) < 0) {
- $ids{$i} = $newid;
- $fn{$i} = $pkgF;
- $prov{$i} = $pkgP;
- $req{$i} = $pkgR;
- }
- } else {
- next if $ids{$1};
- $ids{$1} = $2;
+ next if $packs_done{$1};
+ my ($i, $newid) = ($1, $2);
+ undef $i unless !$ids{$i} || $verscmp->($ids{$i}, $newid) < 0;
+ undef $i unless defined($pkgF) && defined($pkgP);
+ if (defined $i) {
+ $i =~ /^(.*)\.([^\.]+)$/ or die;
+ push @{$packs_arch{$2}}, $1;
+ $ids{$i} = $newid;
+ $fn{$i} = $pkgF;
+ $prov{$i} = $pkgP;
+ delete $req{$i};
+ delete $con{$i};
+ $req{$i} = $pkgR;
+ $con{$i} = $pkgC;
}
undef $pkgF;
undef $pkgP;
undef $pkgR;
+ undef $pkgC;
} elsif ($_ eq 'D:') {
%packs_done = %ids;
}
@@ -214,7 +211,7 @@ $dofileprovides = 1 if ($binarytype || 'rpm') ne 'rpm';
for my $pack (keys %packs) {
my $r = {};
- my (@s, $s, @pr, @re);
+ my (@s, $s, @pr, @re, @co);
@s = split(' ', $prov{$packs{$pack}} || '');
while (@s) {
$s = shift @s;
@@ -247,8 +244,21 @@ for my $pack (keys %packs) {
splice(@s, 0, 2);
}
}
+ @s = split(' ', $con{$packs{$pack}} || '');
+ while (@s) {
+ $s = shift @s;
+ next if !$dofileprovides && $s =~ /^\//;
+ push @co, $s;
+ while (@s && $s[0] =~ /^[\(<=>|]/) {
+ $co[-1] .= " $s[0] $s[1]";
+ $co[-1] =~ s/ \((.*)\)/ $1/;
+ $co[-1] =~ s/(<|>){2}/$1/;
+ splice(@s, 0, 2);
+ }
+ }
$r->{'provides'} = \@pr;
$r->{'requires'} = \@re;
+ $r->{'conflicts'} = \@co;
$repo{$pack} = $r;
}