mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 22:50:49 +00:00
* Support references to parent directories, e.g., \input{../../macros.ltx}.
svn path=/nixpkgs/trunk/; revision=3748
This commit is contained in:
parent
c27109efa0
commit
860e14cd3d
|
@ -5,11 +5,32 @@ sub createDirs;
|
|||
sub createDirs {
|
||||
my $path = shift;
|
||||
return unless $path =~ /^(.*)\/([^\/]*)$/;
|
||||
return if -d $1;
|
||||
createDirs $1;
|
||||
mkdir $1 or die "cannot create directory `$1'";
|
||||
my $dir = $1;
|
||||
return if -d $dir;
|
||||
return if -e $dir;
|
||||
createDirs $dir;
|
||||
mkdir $dir or die "cannot create directory `$dir'";
|
||||
}
|
||||
|
||||
my $maxParents = 0;
|
||||
for (my $n = 0; $n < @ARGV; $n += 2) {
|
||||
my $fullPath = $ARGV[$n];
|
||||
my $relPath = $ARGV[$n + 1];
|
||||
my $parents = 0;
|
||||
foreach my $comp (split /\//, $relPath) {
|
||||
$parents++ if ($comp eq "..")
|
||||
}
|
||||
$maxParents = $parents if $parents > $maxParents;
|
||||
}
|
||||
|
||||
my $startDir = "./";
|
||||
for (my $n = 0; $n < $maxParents; $n++) {
|
||||
$startDir .= "dotdot/";
|
||||
mkdir "$startDir" or die "cannot create directory `$startDir': $!";
|
||||
}
|
||||
|
||||
chdir $startDir or die;
|
||||
|
||||
for (my $n = 0; $n < @ARGV; $n += 2) {
|
||||
my $fullPath = $ARGV[$n];
|
||||
my $relPath = $ARGV[$n + 1];
|
||||
|
@ -18,3 +39,5 @@ for (my $n = 0; $n < @ARGV; $n += 2) {
|
|||
|
||||
symlink $fullPath, $relPath or die "cannot create symlink `$relPath'";
|
||||
}
|
||||
|
||||
print "$startDir\n";
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
ensureDir $out
|
||||
|
||||
perl $copyIncludes $includes
|
||||
startDir=$(perl $copyIncludes $includes)
|
||||
cd $startDir
|
||||
|
||||
for i in $extraFiles; do
|
||||
if test -d $i; then
|
||||
|
|
Loading…
Reference in a new issue