Skip to content

Commit

Permalink
correctly support BuildConflicts
Browse files Browse the repository at this point in the history
Parsing needs to be enabled with $Build::Rpm::conflictdeps = 1
  • Loading branch information
mlschroe committed Dec 17, 2014
1 parent 8187ca9 commit 6255fb1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Build.pm
Expand Up @@ -867,10 +867,14 @@ sub expand {
}
@directdepsend = grep {!/^-/} splice(@directdepsend, @p + 1);
}
@p = grep {!/^-/} @p;

my %p; # expanded packages
my %aconflicts; # packages we are conflicting with
for (grep {/^!/} @p) {
$aconflicts{substr($_, 1)} = "is in BuildConflicts";
}

@p = grep {!/^[-!]/} @p;
my %p; # expanded packages

# add direct dependency packages. this is different from below,
# because we add packages even if the dep is already provided and
Expand Down
11 changes: 8 additions & 3 deletions Build/Rpm.pm
Expand Up @@ -21,6 +21,7 @@
package Build::Rpm;

our $unfilteredprereqs = 0;
our $conflictdeps = 0;

use strict;

Expand Down Expand Up @@ -257,7 +258,7 @@ sub parse {
next;
}
if ($line =~ /^\s*#/) {
next unless $line =~ /^#!BuildIgnore/;
next unless $line =~ /^#!Build(?:Ignore|Conflicts)\s*:/i;
}
my $expandedline = '';
if (!$skip && ($line =~ /%/)) {
Expand Down Expand Up @@ -418,7 +419,7 @@ reexpand:

if ($skip) {
$xspec->[-1] = [ $xspec->[-1], undef ] if $xspec;
$ifdeps = 1 if $line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore)\s*:\s*(\S.*)$/i;
$ifdeps = 1 if $line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore|\#\!BuildConflicts)\s*:\s*(\S.*)$/i;
next;
}

Expand Down Expand Up @@ -488,7 +489,7 @@ reexpand:
}
next;
}
if ($preamble && ($line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore)\s*:\s*(\S.*)$/i)) {
if ($preamble && ($line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore|\#\!BuildConflicts)\s*:\s*(\S.*)$/i)) {
my $what = $1;
my $deps = $2;
$ifdeps = 1 if $hasif;
Expand Down Expand Up @@ -530,6 +531,10 @@ reexpand:

$replace = 1 if grep {/^-/} @ndeps;
if (lc($what) ne 'buildrequires' && lc($what) ne 'buildprereq') {
if ($conflictdeps && $what =~ /conflict/i) {
push @packdeps, map {"!$_"} @ndeps;
next;
}
push @packdeps, map {"-$_"} @ndeps;
next;
}
Expand Down

0 comments on commit 6255fb1

Please sign in to comment.