pull in win

master
serkus 2 years ago
commit c6f6e9ce43

@ -4,8 +4,16 @@ run:
#make cert &&
python server.py
testToken:
testToken:
python core/jwt.py
cert:
openssl req -new -x509 -keyout localhost.pem -out localhost.pem -nodes -days 365
testEnv:
python utils/parsePortage.py envMake
testEnvUse:
python utils/parsePortage.py use

@ -5,6 +5,12 @@
"THEME": "default"
},
"Portage":{
"make.conf":"/etc/portge/make.conf/custom"
"rootPth":"/etc/portage",
"make.conf":"/etc/portage/make.conf/custom",
"package.use":"/etc/portage/package.use/custom",
"package.accept_keywords":"/etc/portage/package.accept_keywords/custom",
"package.mask":"/etc/portage/package.mask",
"package.unmask":"/etc/portage/package.unmask/custom"
}
}

@ -8,35 +8,63 @@ class PortageConfig():
self.TargetParse =['USE', 'USE_EXPAN', 'VIDEO_CARDS', 'ACCEPT_CHOSTS', 'ACCEPT_LICENSE','CCACHE_DIR', 'CCACHE_SIZE',
'EMERGE_DEFAULT_OPTS', 'CFLAGS', 'CXXFLAGS', 'MAKEOPTS']
self.MakeConfig={}
def getLines(self, filename):
if os.path.exists(filename):
with open (filename, 'r') as f:
lines = f.read().split("\n")
else:
print("path is not Found")
return lines
def parseMakeConf(self):
StateBox = 'Null'
with open (Config.Portage['make.conf'], 'r') as f:
lines = f.read().split("\n")
Lines = self.getLines(self.Config['Portage']['make.conf'])
for line in lines:
if not line.startswith('#'):
if StateBox is 'Null' and not line.endswith('"'):
StateBox = line.split('=')[0]
MakeConfig[StateBox] = line.split('=')] = []
for i in line.split('=')] = line.split(" ")
MakeConfig[StateBox].append(i)
elif StateBox is not 'Null' and not line.endswith('"')
StateBox ='Null'
for i in line.split('=')] = line.split(" ")
MakeConfig[StateBox].append(i)
elif StateBox is 'Null' and line.endswith('"'):
MakeConfig[StateBox] = line.split(" ")
for line in Lines:
if not line.startswith('#') and len(line.split("="))>1:
line.replace('"', "")
if StateBox == 'Null' and not line.endswith('"'):
StateBox = line.split('=')[0]
self.MakeConfig[StateBox] =[]
self.MakeConfig[StateBox] = line.split('=')[1].split(" ")
for i in line.split('=')[1].split(" "):
self.MakeConfig[split('=')[0]].append(i)
elif StateBox !='Null' and not line.endswith('"'):
StateBox = line.split('=')[1]
for i in line.split('=')[1].split(" "):
self.MakeConfig[line.split('=')[0]].append(i)
elif StateBox == 'Null' and line.endswith('"'):
#line.replace('"', "")
self.MakeConfig[line.split('=')[0]] = line.split('="')[1].split(" ")
print(MakeConfig)
print(self.MakeConfig)
def parsePackageUse(self):
pass
def parsePackageMaskself(self):
pass
def def parsePackageKeywords(self):
pass
self.MakeConfig['package.use'] =[]
Lines = self.getLines(self.Config['Portage']['package.use'])
for i in Lines:
self.MakeConfig['package.use'].append(dict(Name=i.split(" ")[0], Uses=i.split(" ")[1:]))
def parsePackageMasks(self):
Lines = self.getLines(self.Config['Portage']['package.mask'])
def parsePakageUnmask(self):
Lines = self.getLines(self.Config['Portage']["package.unmask"])
def parsePackageKeywords(self):
Lines = self.getLines(self.Config['Portage']['package.accept_keywords'])
if __name__ == '__main__':
<<<<<<< HEAD
test = TestConfig()
test.parseMakeConfig()
test.parseMakeConfig()
=======
Test = PortageConfig()
if sys.argv[1] == "envMake":
Test.parseMakeConf()
elif sys.argv[1] == "use":
Test.parsePackageUse()
else:
Test.parseMakeConf()
>>>>>>> c4fbeaac94287a55325443257d1508c4141f2a34

@ -3,7 +3,7 @@
'__autor__' == 'serkus'
import os, sys, json
from urllib import request
from utils.package import search
from package import search
# import xml
import xml.etree.ElementTree as ET
@ -164,18 +164,14 @@ def sort_install_pkg():
#print(pkg_name)
if pkg_name not in INSTALL:
INSTALL[d.replace(path, "").split('/')[0]] = []
if
INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1], ver = f.replace(pkg_name, "")))
if d.replace(path, "").split('/')[0] not in INSTALL:
INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1], ver = f.replace(pkg_name, "")))
else:
INSTALL[d.replace(path,
"").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")))
if d.replace(path, "").split('/')[0] not in INSTALL:
INSTALL[d.replace(path, "").split('/')[0]] = []
INSTALL[d.replace(path, "").split('/')[0]].append(f.replace(".ebuild", "") )
INSTALL[d.replace(path,
"").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
INSTALL[d.replace(path,"").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
#print(str(len(INSTALL)))
@ -183,8 +179,8 @@ def sort_install_pkg():
return INSTALL
def ScanTreePortage():
DirsRoot = ["/var/db/repos", "/usr/portage"]
d, ListTree, f for in os.walk('/usr/portage') and d, ListTree, f for in os.walk("/var/db/repos")
return ListTree
#d, ListTree, f for in os.walk('/usr/portage') and d, ListTree, f for in os.walk("/var/db/repos")
#return ListTree
def scan_config_portage():
Dirs_root = ["/var/db/repos", "/usr/portage"]

Loading…
Cancel
Save