diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-09-17 19:12:53 +0100 |
commit | e1562a71d6483021d332bccbfc5a3086688bc58c (patch) | |
tree | 6be3d468e0aadd6c4de6c4dbd7a58ebe9fd59cbb /src/backend/syncEnvironment.py | |
parent | 0cf2c9f8ec52b1ae276c1573210d252ab0c4577b (diff) |
rearrange the backend
Diffstat (limited to 'src/backend/syncEnvironment.py')
-rw-r--r-- | src/backend/syncEnvironment.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/backend/syncEnvironment.py b/src/backend/syncEnvironment.py new file mode 100644 index 0000000..04b662a --- /dev/null +++ b/src/backend/syncEnvironment.py @@ -0,0 +1,45 @@ +#!/usr/bin/python3 + +import os +import subprocess +import sisyphus.getFilesystem + +def syncStage1(): + os.chdir(sisyphus.getFilesystem.portageRepoDir) + localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) + remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) + + gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage1.communicate() + + gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage2.communicate() + +def syncStage2(): + os.chdir(sisyphus.getFilesystem.redcoreRepoDir) + localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) + remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) + + gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage1.communicate() + + gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage2.communicate() + +def syncStage3(): + os.chdir(sisyphus.getFilesystem.portageConfigDir) + localBranch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) + remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}']) + + gitExecStage1 = subprocess.Popen(['git', 'stash'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage1.communicate() + gitExecStage2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage2.communicate() + gitExecStage3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage3.communicate() + gitExecStage4 = subprocess.Popen(['git', 'stash', 'apply'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage4.communicate() + gitExecStage5 = subprocess.Popen(['git', 'stash', 'clear'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage5.communicate() + gitExecStage6 = subprocess.Popen(['git', 'gc', '--prune=now', '--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = gitExecStage6.communicate() |