summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/branchsetup.py30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/backend/branchsetup.py b/src/backend/branchsetup.py
index 6524bb4..23670d1 100644
--- a/src/backend/branchsetup.py
+++ b/src/backend/branchsetup.py
@@ -2,7 +2,7 @@
import animation
import os
-import subprocess
+import git
import sisyphus.check
import sisyphus.branchreset
import sisyphus.filesystem
@@ -15,7 +15,6 @@ def getBranchRemote(branch,remote):
portageRemote = []
redcoreRemote = []
portageConfigRemote = []
- remoteBranch = []
if "master" in branch:
if "gitlab" in remote:
remote = sisyphus.filesystem.remoteGitlab
@@ -45,42 +44,29 @@ def getBranchRemote(branch,remote):
portageRemote = [remote, sisyphus.filesystem.portageRepo]
redcoreRemote = [remote, sisyphus.filesystem.redcoreRepo]
portageConfigRemote = [remote, sisyphus.filesystem.portageConfigRepo]
- remoteBranch = ['origin', branch]
- return portageRemote,redcoreRemote,portageConfigRemote,remoteBranch
+ return portageRemote,redcoreRemote,portageConfigRemote
@animation.wait('injecting Gentoo Linux portage tree')
def injectGentooPortageTree(branch,remote):
- portageRemote,redcoreRemote,portageConfigRemote,remoteBranch = getBranchRemote(branch,remote)
+ portageRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
if not os.path.isdir(os.path.join(sisyphus.filesystem.portageRepoDir, '.git')):
- os.chdir(sisyphus.filesystem.portageRepoDir)
- subprocess.call(['git', 'init', '-q'])
- subprocess.call(['git', 'remote', 'add', 'origin'] + "/".join(portageRemote).split())
- subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + branch.split() + ['--quiet'])
- subprocess.call(['git', 'checkout', '-b'] + branch.split() + "/".join(remoteBranch).split() + ['--quiet'])
+ git.Repo.clone_from("/".join(portageRemote), sisyphus.filesystem.portageRepoDir, depth=1, branch=branch)
@animation.wait('injecting Redcore Linux ebuild overlay')
def injectRedcoreEbuildOverlay(branch,remote):
- portageRemote,redcoreRemote,portageConfigRemote,remoteBranch = getBranchRemote(branch,remote)
+ portageRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
if not os.path.isdir(os.path.join(sisyphus.filesystem.redcoreRepoDir, '.git')):
- os.chdir(sisyphus.filesystem.redcoreRepoDir)
- subprocess.call(['git', 'init', '-q'])
- subprocess.call(['git', 'remote', 'add', 'origin'] + "/".join(redcoreRemote).split())
- subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + branch.split() + ['--quiet'])
- subprocess.call(['git', 'checkout', '-b'] + branch.split() + "/".join(remoteBranch).split() + ['--quiet'])
+ git.Repo.clone_from("/".join(redcoreRemote), sisyphus.filesystem.redcoreRepoDir, depth=1, branch=branch)
@animation.wait('injecting Redcore Linux portage config')
def injectRedcorePortageConfig(branch,remote):
- portageRemote,redcoreRemote,portageConfigRemote,remoteBranch = getBranchRemote(branch,remote)
+ portageRemote,redcoreRemote,portageConfigRemote = getBranchRemote(branch,remote)
if not os.path.isdir(os.path.join(sisyphus.filesystem.portageConfigDir, '.git')):
- os.chdir(sisyphus.filesystem.portageConfigDir)
- subprocess.call(['git', 'init', '-q'])
- subprocess.call(['git', 'remote', 'add', 'origin'] + "/".join(portageConfigRemote).split())
- subprocess.call(['git', 'fetch', '--depth=1', 'origin'] + branch.split() + ['--quiet'])
- subprocess.call(['git', 'checkout', '-b'] + branch.split() + "/".join(remoteBranch).split() + ['--quiet'])
+ git.Repo.clone_from("/".join(portageConfigRemote), sisyphus.filesystem.portageConfigDir, depth=1, branch=branch)
def warnAboutBinaryRepository(branch,remote):
if "master" in branch: