Support build where ~/ and $(pwd) are different filesystems

download_file caches original zips in ~/.gerritcodereview/buck-cache.
If this is a different filesystem than $(pwd)/buck-out a symlink
was used to connect the build file with the original archive. This
confuses Buck when creating the $SRCDIR for a genrule().

If a hardlink does not work, copy the file.

Change-Id: If66c59fb6aecc93b5a3e85cdd76ef880538875ff
This commit is contained in:
Shawn Pearce
2013-08-06 12:20:30 -07:00
parent b6ccae2f61
commit f98b3798a6

View File

@@ -17,7 +17,7 @@ from __future__ import print_function
from hashlib import sha1
from optparse import OptionParser
from os import link, makedirs, path, remove, symlink
from os import link, makedirs, path, remove
import shutil
from subprocess import check_call, CalledProcessError
from sys import stderr
@@ -178,4 +178,4 @@ else:
try:
link(cache_ent, args.o)
except OSError as err:
symlink(cache_ent, args.o)
shutil.copyfile(cache_ent, args.o)