Bug 1409876 - Refuse to perform a VCS checkout into a cache root; r=dustin

This seems like a reasonable thing to enforce.

MozReview-Commit-ID: 3BZQSkwRYeN

--HG--
extra : rebase_source : 8dae62edb35202da0f0e90ddec3eacb212ada371
This commit is contained in:
Gregory Szorc 2017-10-25 17:23:16 -07:00
Родитель 926bb25028
Коммит a953b72db5
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -471,6 +471,14 @@ def main(args):
if not checkout:
return
# The checkout path becomes the working directory. Since there are
# special cache files in the cache's root directory and working
# directory purging could blow them away, disallow this scenario.
if os.path.exists(os.path.join(checkout, '.cacherequires')):
print('error: cannot perform vcs checkout into cache root: %s' %
checkout)
sys.exit(1)
# Ensure the directory for the source checkout exists.
try:
os.makedirs(os.path.dirname(checkout))