Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/2540 )

Change subject: scons: Detect and remove broken git hook symlinks.
......................................................................

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 <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
---
M SConstruct
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved; Looks good to me, approved



diff --git a/SConstruct b/SConstruct
index b4ab0bf..4593fdd 100755
--- a/SConstruct
+++ b/SConstruct
@@ -393,6 +393,10 @@
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())


--
To view, visit https://gem5-review.googlesource.com/2540
To unsubscribe, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I59aa51feb5bd74ca33e51e89cde2ceabeb41bd76
Gerrit-Change-Number: 2540
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to