Ignore fake collisions

svn path=/nixpkgs/trunk/; revision=21075
This commit is contained in:
Yury G. Kudryashov 2010-04-14 19:26:31 +00:00
parent cd56e341de
commit 295af6ab17

View File

@ -1,7 +1,7 @@
#! @perl@ -w #! @perl@ -w
use strict; use strict;
use Cwd; use Cwd 'abs_path';
use IO::Handle; use IO::Handle;
use File::Path; use File::Path;
use File::Basename; use File::Basename;
@ -96,9 +96,17 @@ sub createLinks {
} }
elsif (-l $dstFile) { elsif (-l $dstFile) {
if (!$ignoreCollisions) { my $oldTarget = readlink $dstFile;
my $target = readlink $dstFile; my $oldTargetReal = abs_path $oldTarget;
die "collission between `$srcFile' and `$target'"; my $newTarget = $srcFile;
my $newTargetReal = abs_path $newTarget;
unless ($newTargetReal eq $oldTargetReal) {
if ($ignoreCollisions) {
warn "collision between `$newTarget' and `$oldTarget'\n";
}
else {
die "collision between `$newTarget' and `$oldTarget'";
}
} }
} }
@ -114,7 +122,7 @@ my %done;
my %postponed; my %postponed;
sub addPkg; sub addPkg;
sub addPkg { sub addPkg($;$) {
my $pkgDir = shift; my $pkgDir = shift;
my $ignoreCollisions = shift; my $ignoreCollisions = shift;
@ -131,6 +139,7 @@ sub addPkg {
close PROP; close PROP;
my @propagated = split ' ', $propagated; my @propagated = split ' ', $propagated;
foreach my $p (@propagated) { foreach my $p (@propagated) {
print "$pkgDir propagates $p\n";
$postponed{$p} = 1 unless defined $done{$p}; $postponed{$p} = 1 unless defined $done{$p};
} }
} }