From: Gabe Black Date: Sat, 25 Mar 2017 09:06:39 +0000 (-0700) Subject: scons: Detect and remove broken git hook symlinks. X-Git-Tag: v19.0.0.0~2893 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed44b7f6e2e6e737eda6a305afc50d3f958736b1;p=gem5.git scons: Detect and remove broken git hook symlinks. When installing a git hook, it's possible for the hook to not "exist" if it's actually a symlink which points to a file that doesn't exist. Trying to create a new symlink in its place without first removing the old one causes a build failure in these cases. If the hook doesn't "exist" but is still a link, that means it's actually a broken link and should be deleted by the hook installation function before any new symlink is created. Change-Id: I59aa51feb5bd74ca33e51e89cde2ceabeb41bd76 Reviewed-on: https://gem5-review.googlesource.com/2540 Reviewed-by: Jason Lowe-Power Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- diff --git a/SConstruct b/SConstruct index b4ab0bfb9..4593fdd4b 100755 --- a/SConstruct +++ b/SConstruct @@ -393,6 +393,10 @@ def install_git_style_hooks(): print "Warning: Can't install %s, hook already exists." % hook_name return + if hook.islink(): + print "Warning: Removing broken symlink for hook %s." % hook_name + os.unlink(hook.get_abspath()) + if not git_hooks.exists(): mkdir(git_hooks.get_abspath())