#!/usr/bin/perl -w
# search for files packaged more than once
# it is an error if such a file exists but the packages do not conflict
#
use strict;
use Data::Dumper;
my $had_errors = 0;
my $build_root = $::ENV{BUILD_ROOT} || '/';

my $TOPDIR = '/usr/src/packages';
$TOPDIR = '/.build.packages' if -d "$build_root/.build.packages";

local(*OUTPUT, $/);
open (OUTPUT, "chroot '$build_root' /bin/bash -c 'find $TOPDIR/RPMS/ -name \"*.rpm\" | grep -v -- -debuginfo | grep -v -- -debugsource | perl /usr/lib/build/checks-data/findfileconflicts --manifest -q -' 2>&1 |");
my $output = <OUTPUT>;
close(OUTPUT);

if ($output) {
  print $output . "\n";
  exit 1;
}

exit 0;

