1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/usr/bin/python3
import io
import os
import subprocess
import sisyphus.getfs
def bhaddr():
bhaddr = []
p_exe = subprocess.Popen(
['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
if "PORTAGE_BINHOST" in p_out:
bhaddr = p_out.rstrip().split("=")[1].strip('\"')
p_exe.wait()
return bhaddr
def csvaddr():
csvaddr = bhaddr()
pcsvaddr = []
dcsvaddr = []
if "packages-next" in csvaddr:
pcsvaddr = csvaddr.replace(
'packages-next', 'csv-next') + 'remotePackagesPre.csv'
dcsvaddr = csvaddr.replace(
'packages-next', 'csv-next') + 'remoteDescriptionsPre.csv'
else:
pcsvaddr = csvaddr.replace(
'packages', 'csv') + 'remotePackagesPre.csv'
dcsvaddr = csvaddr.replace(
'packages', 'csv') + 'remoteDescriptionsPre.csv'
return pcsvaddr, dcsvaddr
def systemBranch():
activeBranch = None
if os.path.isdir(os.path.join(sisyphus.getfs.gentooRepoDir, '.git')):
os.chdir(sisyphus.getfs.gentooRepoDir)
localBranch = subprocess.check_output(
['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
if localBranch.decode().strip() == 'master':
activeBranch = str('master')
if localBranch.decode().strip() == 'next':
activeBranch = str('next')
return activeBranch
|