From 4dda01f43e00a2412ee05595cb4d3ec559594f28 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 9 Mar 2023 19:37:11 +0000 Subject: systemBranch -> sys_brch; activeBranch -> act_brch; localBranch -> lcl_brch; remoteBranch -> rmt_brch --- src/backend/checkenv.py | 6 +++--- src/backend/getenv.py | 16 ++++++++-------- src/backend/syncenv.py | 24 ++++++++++++------------ src/backend/update.py | 12 ++++++------ 4 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py index ce0e056..503df16 100644 --- a/src/backend/checkenv.py +++ b/src/backend/checkenv.py @@ -10,17 +10,17 @@ def root(): def sanity(): - activeBranch = sisyphus.getenv.systemBranch() + act_brch = sisyphus.getenv.sys_brch() bh_addr = sisyphus.getenv.bh_addr() isSane = int() if "packages-next" in bh_addr: - if activeBranch == "next": + if act_brch == "next": isSane = int(1) else: isSane = int(0) else: - if activeBranch == "master": + if act_brch == "master": isSane = int(1) else: isSane = int(0) diff --git a/src/backend/getenv.py b/src/backend/getenv.py index 0dc2ec6..13b3831 100644 --- a/src/backend/getenv.py +++ b/src/backend/getenv.py @@ -38,18 +38,18 @@ def csv_addr(): return pcsv_addr, dcsv_addr -def systemBranch(): - activeBranch = None +def sys_brch(): + act_brch = None if os.path.isdir(os.path.join(sisyphus.getfs.gentooRepoDir, '.git')): os.chdir(sisyphus.getfs.gentooRepoDir) - localBranch = subprocess.check_output( + lcl_brch = subprocess.check_output( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) - if localBranch.decode().strip() == 'master': - activeBranch = str('master') + if lcl_brch.decode().strip() == 'master': + act_brch = str('master') - if localBranch.decode().strip() == 'next': - activeBranch = str('next') + if lcl_brch.decode().strip() == 'next': + act_brch = str('next') - return activeBranch + return act_brch diff --git a/src/backend/syncenv.py b/src/backend/syncenv.py index 09049ee..eef7fb1 100644 --- a/src/backend/syncenv.py +++ b/src/backend/syncenv.py @@ -7,49 +7,49 @@ import sisyphus.getfs def gentooRepo(): os.chdir(sisyphus.getfs.gentooRepoDir) - localBranch = subprocess.check_output( + lcl_brch = subprocess.check_output( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) - remoteBranch = subprocess.check_output( + rmt_brch = subprocess.check_output( ['git', 'rev-parse', '--symbolic-full-name', '@{u}']) g_exe1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + - localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) + lcl_brch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) g_exe1.wait() - g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode( + g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode( ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) g_exe2.wait() def redcoreRepo(): os.chdir(sisyphus.getfs.redcoreRepoDir) - localBranch = subprocess.check_output( + lcl_brch = subprocess.check_output( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) - remoteBranch = subprocess.check_output( + rmt_brch = subprocess.check_output( ['git', 'rev-parse', '--symbolic-full-name', '@{u}']) g_exe1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + - localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) + lcl_brch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) g_exe1.wait() - g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode( + g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode( ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) g_exe2.wait() def portageConfigRepo(): os.chdir(sisyphus.getfs.portageConfigDir) - localBranch = subprocess.check_output( + lcl_brch = subprocess.check_output( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) - remoteBranch = subprocess.check_output( + rmt_brch = subprocess.check_output( ['git', 'rev-parse', '--symbolic-full-name', '@{u}']) g_exe1 = subprocess.Popen(['git', 'stash'], stdout=subprocess.PIPE) g_exe1.wait() g_exe2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + - localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) + lcl_brch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) g_exe2.wait() - g_exe3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode( + g_exe3 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode( ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) g_exe3.wait() g_exe4 = subprocess.Popen( diff --git a/src/backend/update.py b/src/backend/update.py index 60aae3c..57b05b6 100644 --- a/src/backend/update.py +++ b/src/backend/update.py @@ -20,7 +20,7 @@ def syncAll(): @animation.wait('fetching updates') def start(): - activeBranch = sisyphus.getenv.systemBranch() + act_brch = sisyphus.getenv.sys_brch() bh_addr = sisyphus.getenv.bh_addr() isSane = sisyphus.checkenv.sanity() @@ -28,17 +28,17 @@ def start(): syncAll() else: if "packages-next" in bh_addr: - print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + activeBranch + "'" + " " + "(stable)" + + print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + act_brch + "'" + " " + "(stable)" + " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bh_addr + "'" + " " + "(testing)") else: - print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + activeBranch + "'" + " " + "(testing)" + + print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + act_brch + "'" + " " + "(testing)" + " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bh_addr + "'" + " " + "(stable)") sys.exit(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) def xstart(): - activeBranch = sisyphus.getenv.systemBranch() + act_brch = sisyphus.getenv.sys_brch() bh_addr = sisyphus.getenv.bh_addr() isSane = sisyphus.checkenv.sanity() @@ -46,10 +46,10 @@ def xstart(): syncAll() else: if "packages-next" in bh_addr: - print("\n\nActive branch:" + " " + "'" + activeBranch + "'" + " " + "(stable)" + + print("\n\nActive branch:" + " " + "'" + act_brch + "'" + " " + "(stable)" + "\nActive binhost:" + " " + "'" + bh_addr + "'" + " " + "(testing)") else: - print("\n\nActive branch:" + " " + "'" + activeBranch + "'" + " " + "(testing)" + + print("\n\nActive branch:" + " " + "'" + act_brch + "'" + " " + "(testing)" + "\nActive binhost:" + " " + "'" + bh_addr + "'" + " " + "(stable)") print("\n\nInvalid configuration!" + "\nUse 'sisyphus branch --help' for help\n") -- cgit v1.2.3