diff --git a/findfileconflicts b/findfileconflicts index 9eef0f54..c7b1ff80 100755 --- a/findfileconflicts +++ b/findfileconflicts @@ -142,8 +142,9 @@ close(FL) || die("close failed\n"); # connect dirs and add all dirs as files print "connecting ".@dirs." directories\n"; +my @implicit_conflicts; for (@dirs) { - next unless /^(.*\/)(.*?)$/; + next unless /^(.*\/)(.*?)\/$/; my $n = $dirs{$1}; if (!defined $n) { $n = @dirs; @@ -162,8 +163,61 @@ for (@dirs) { $have_dir = 1 if $modes_type[$m] == 040000; } next if $have_dir; - $filesc{$f} ||= [ $files{$f} ]; - push @{$filesc{$f}}, "implicit_directory 0 0 noarch pkg/0"; + push @implicit_conflicts, $f; +} +print "now ".@dirs." directories\n"; + +# the old and fast way +# +#for my $f (@implicit_conflicts) { +# $filesc{$f} ||= [ $files{$f} ]; +# push @{$filesc{$f}}, "implicit_directory 0 0 noarch pkg/0"; +#} + +if (@implicit_conflicts) { + print "have implicit conflicts, calculating dir owners\n"; + my @pdirs; # parent dirs + for (@dirs) { + next unless /^(.*\/)(.*?)\/$/; + $pdirs[$dirs{$_}] = $dirs{$1}; + } + my %baddir; + for (@implicit_conflicts) { + my ($n, $x) = split('/', $_, 2); + $baddir{$dirs{"$dirs[$n]$x/"}} = $_; + } + my $done; + while (!$done) { + $done = 1; + my $i = -1; + for (@pdirs) { + $i++; + next unless defined $_; + next unless $baddir{$_} && !$baddir{$i}; + $baddir{$i} ||= $baddir{$_}; + undef $done; + } + } + undef @pdirs; + # this is not cheap, sorry + my %baddir_pkgs; + for my $ff (keys %files) { + my ($n, undef) = split('/', $ff, 2); + next unless $baddir{$n}; + if (!$filesc{$ff}) { + my ($pkg, undef) = split('/', $files{$ff}, 2); + $baddir_pkgs{$baddir{$n}}->{"$pkg/0"} = 1; + } else { + for (@{$filesc{$ff} || []}) { + my ($pkg, undef) = split('/', $_, 2); + $baddir_pkgs{$baddir{$n}}->{"$pkg/0"} = 1; + } + } + } + for my $f (sort keys %baddir_pkgs) { + $filesc{$f} ||= [ $files{$f} ]; + push @{$filesc{$f}}, sort keys %{$baddir_pkgs{$f}}; + } } %files = (); # free mem @@ -250,10 +304,12 @@ for my $tc (sort keys %tocheck) { # no conflict if all dirs or all ghosts next if $modes_type[$m] == 040000 || $modes_ghost[$m] == 0100; } else { - my $m = (keys(%allm))[0]; # don't report mode mismatches for files/symlinks that are not ghosts - if (($modes_type[$m] != 0100000 && $modes_type[$m] != 0120000) || $modes_ghost[$m] == 0100) { - $info = ' [mode mismatch: '.join(', ', map {beautify_mode($_)} @pp).']'; + for my $m (keys %allm) { + if (($modes_type[$m] != 0100000 && $modes_type[$m] != 0120000) || $modes_ghost[$m] == 0100) { + $info = ' [mode mismatch: '.join(', ', map {beautify_mode($_)} @pp).']'; + last; + } } } # got one! diff --git a/repo-checker.pl b/repo-checker.pl index 2972e1ef..e3f67120 100644 --- a/repo-checker.pl +++ b/repo-checker.pl @@ -13,6 +13,7 @@ use Rpm; use strict; +my $ret = 0; my $dir = $ARGV[0]; my %toignore; foreach my $name (split(/,/, $ARGV[1])) { @@ -21,14 +22,14 @@ foreach my $name (split(/,/, $ARGV[1])) { if (! -f "$dir/rpmlint.log") { print "Couldn't find a rpmlint.log in the build results. This is mandatory\n"; - exit(1); -} - -open(GREP, "grep 'W:.*invalid-lcense ' $dir/rpmlint.log |"); -while ( ) { - print "Found rpmlint warning: "; - print $_; - exit(1); + $ret = 1; +} else { + open(GREP, "grep 'W:.*invalid-lcense ' $dir/rpmlint.log |"); + while ( ) { + print "Found rpmlint warning: "; + print $_; + $ret = 1; + } } my %targets; @@ -179,8 +180,8 @@ while ( ) { last if (m/^can't install /); print "$_"; } - close(INSTALL); - exit(1); + $ret = 1; + last; } } } @@ -194,10 +195,11 @@ while ( ) { if ($_ =~ m/found conflict of (\S+) .* with (\S+) /) { if (defined $targets{$1} || defined $targets{$2}) { print "FC $1 $2\n"; - exit(1); + $ret = 1; + last; } } } close(INSTALL); -exit(0); +exit($ret);