diff options
author | Joe Guo <joeg@catalyst.net.nz> | 2019-05-03 22:34:32 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-05-10 08:19:16 +0000 |
commit | 9ea81c0e3764cbda449c1d98595981ce32a8558c (patch) | |
tree | 11588ab3cb7676011257ad6e8f84a837adf188d3 /script/autobuild.py | |
parent | af0e0c544b9bf46967a91c1a177bc012a161f483 (diff) | |
download | samba-9ea81c0e3764cbda449c1d98595981ce32a8558c.tar.gz |
script/autobuild.py: mv find_git_root and gitroot to top
so the reset of the code can use gitroot directly.
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'script/autobuild.py')
-rwxr-xr-x | script/autobuild.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/script/autobuild.py b/script/autobuild.py index 62d304f4749..aac42f41176 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -31,6 +31,22 @@ os.environ["PYTHONUNBUFFERED"] = "1" # This speeds up testing remarkably. os.environ['TDB_NO_FSYNC'] = '1' + +def find_git_root(): + '''get to the top of the git repo''' + p = os.getcwd() + while p != '/': + if os.path.isdir(os.path.join(p, ".git")): + return p + p = os.path.abspath(os.path.join(p, '..')) + return None + + +gitroot = find_git_root() +if gitroot is None: + raise Exception("Failed to find git root") + + cleanup_list = [] builddirs = { @@ -770,16 +786,6 @@ def cleanup(): run_cmd("rm -rf %s" % d) -def find_git_root(): - '''get to the top of the git repo''' - p = os.getcwd() - while p != '/': - if os.path.isdir(os.path.join(p, ".git")): - return p - p = os.path.abspath(os.path.join(p, '..')) - return None - - def daemonize(logfile): pid = os.fork() if pid == 0: # Parent @@ -861,10 +867,6 @@ def push_to(push_url, push_branch="master"): def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER')) -gitroot = find_git_root() -if gitroot is None: - raise Exception("Failed to find git root") - parser = OptionParser() parser.add_option("", "--tail", help="show output while running", default=False, action="store_true") parser.add_option("", "--keeplogs", help="keep logs", default=False, action="store_true") |