Eric Ye has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/50410 )

Change subject: cons: Allow clean non-interactive builds
......................................................................

cons: Allow clean non-interactive builds

On a clean build, the git tool will wait for input() before installing
git hooks. Allow bypassing this via a command-line flag, making it
possible to perform a clean build non-interactively.

Bug: 199780674
Test: build_gem5 --install_hooks
Change-Id: I48be2c1a7c2335a2f4f6359adf582ca8b0ae5939
---
M SConstruct
M site_scons/site_tools/git.py
2 files changed, 11 insertions(+), 5 deletions(-)



diff --git a/SConstruct b/SConstruct
index 4e2ed47..aae68e2 100755
--- a/SConstruct
+++ b/SConstruct
@@ -123,6 +123,8 @@
           help='Build with Address Sanitizer if available')
 AddOption('--with-systemc-tests', action='store_true',
           help='Build systemc tests')
+AddOption('--install_hooks', action='store_true',
+          help='Install git hooks non-interactively')

# Imports of gem5_scons happen here since it depends on some options which are
 # declared above.
diff --git a/site_scons/site_tools/git.py b/site_scons/site_tools/git.py
index 3a71c9f..8236bde 100644
--- a/site_scons/site_tools/git.py
+++ b/site_scons/site_tools/git.py
@@ -42,6 +42,7 @@
 import sys

 import gem5_scons.util
+import SCons.Script

 git_style_message = """
 You're missing the gem5 style or commit message hook. These hooks help
@@ -99,11 +100,14 @@
         return

     print(git_style_message, end=' ')
-    try:
-        input()
-    except:
-        print("Input exception, exiting scons.\n")
-        sys.exit(1)
+    if SCons.Script.GetOption('install_hooks'):
+ print("Got install_hooks flags so installing hooks non-interactively.")
+    else:
+        try:
+            input()
+        except:
+            print("Input exception, exiting scons.\n")
+            sys.exit(1)

     git_style_script = env.Dir("#util").File("git-pre-commit.py")
     git_msg_script = env.Dir("#ext").File("git-commit-msg")

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50410
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I48be2c1a7c2335a2f4f6359adf582ca8b0ae5939
Gerrit-Change-Number: 50410
Gerrit-PatchSet: 1
Gerrit-Owner: Eric Ye <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to