Skip to content

Commit 721cbab

Browse files
committed
nightly: Don't abort on dangling symlink
The code to recursive through the scratch tree and make files writeable before removing the scratch tree would abort on a dangling symlink. Catch the exception and continue, so that the tree can be properly cleaned. Signed-off-by: Brian Barrett <[email protected]>
1 parent 34213b1 commit 721cbab

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

nightly-tarball/Builder.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,12 +596,21 @@ def cleanup(self):
596596
"""
597597
dirpath = self._config['project_path']
598598
self._logger.debug("Deleting directory: %s" % (dirpath))
599-
# deal with "make distcheck"'s stupid permissions
599+
# deal with "make distcheck"'s stupid permissions. Exception
600+
# handling is inside the loop so that we do not skip some
601+
# files on an error. os.chmod will throw an error if it
602+
# tries to follow a dangling symlink.
600603
for root, dirs, files in os.walk(dirpath):
601604
for momo in dirs:
602-
os.chmod(os.path.join(root, momo), 0700)
605+
try:
606+
os.chmod(os.path.join(root, momo), 0700)
607+
except:
608+
pass
603609
for momo in files:
604-
os.chmod(os.path.join(root, momo), 0700)
610+
try:
611+
os.chmod(os.path.join(root, momo), 0700)
612+
except:
613+
pass
605614
shutil.rmtree(dirpath)
606615

607616

0 commit comments

Comments
 (0)