|
|
|
@ -38,6 +38,11 @@ def get_list_overlays():
|
|
|
|
|
description = ""
|
|
|
|
|
homepage = ""
|
|
|
|
|
feed =""
|
|
|
|
|
for d, dirs, files in os.walk('/var/db/repos'):
|
|
|
|
|
if(d == "/var/db/repos"):
|
|
|
|
|
inc = dirs
|
|
|
|
|
else:
|
|
|
|
|
break
|
|
|
|
|
for child in root.findall('repo'):
|
|
|
|
|
name = child.find('name').text
|
|
|
|
|
try:
|
|
|
|
@ -54,7 +59,7 @@ def get_list_overlays():
|
|
|
|
|
except AttributeError:
|
|
|
|
|
feed = "У overlay нет ссылки и на дерево"
|
|
|
|
|
|
|
|
|
|
overlay = dict(name=name, description=description, homepage=homepage, feed=feed)
|
|
|
|
|
overlay =dict(name=name, description=description, homepage=homepage, feed=feed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overlays.append(overlay)
|
|
|
|
@ -64,7 +69,7 @@ def get_list_overlays():
|
|
|
|
|
f.write(json.dumps({"repositories": overlays}))
|
|
|
|
|
#f.close()
|
|
|
|
|
|
|
|
|
|
return overlays
|
|
|
|
|
return dict(all=overlays, include=inc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def xml_element_to_dict(elem):
|
|
|
|
@ -104,49 +109,53 @@ def load_config():
|
|
|
|
|
return conf
|
|
|
|
|
|
|
|
|
|
#SORT IN INTALL PAKAGES
|
|
|
|
|
#'/var/db/pkg/'
|
|
|
|
|
#''
|
|
|
|
|
def sort_install_pkg():
|
|
|
|
|
pkg =scan_config_portage()
|
|
|
|
|
INSTALL = {}
|
|
|
|
|
path = '/var/db/pkg/'
|
|
|
|
|
for d, dirs, files in os.walk(path):
|
|
|
|
|
for f in files:
|
|
|
|
|
if f.endswith('.ebuild'):
|
|
|
|
|
#pkg =scan_config_portage()
|
|
|
|
|
INSTALL = {}
|
|
|
|
|
pkg_name =""
|
|
|
|
|
path = '/var/db/pkg/'
|
|
|
|
|
for d, dirs, files in os.walk(path):
|
|
|
|
|
for f in files:
|
|
|
|
|
if f.endswith('.ebuild'):
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
#ver=int(f.replace('.ebuild', '').split('-')[-1][0])
|
|
|
|
|
for pn in f.replace('.ebuild', '').split('-')[:-1]:
|
|
|
|
|
pkg_name = pkg_name + pn + "-"
|
|
|
|
|
for pn in f.replace('.ebuild', '').split('-')[:-1]:
|
|
|
|
|
pkg_name = pkg_name + pn + "-"
|
|
|
|
|
|
|
|
|
|
except TypeError:
|
|
|
|
|
for pn in f.replace('.ebuild', '').split('-')[:-2]:
|
|
|
|
|
pkg_name = pkg_name + pn + "-"
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(e)
|
|
|
|
|
print(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, "")
|
|
|
|
|
|
|
|
|
|
if d.replace(path, "").split('/')[0] not in INSTALL:
|
|
|
|
|
INSTALL[d.replace(path, "").split('/')[0]] =[]
|
|
|
|
|
#INSTALL[d.replace(path, "").split('/')[0]].append(dict("name"=pkg_name, "vers"=f.replace(pkg_name) ))
|
|
|
|
|
INSTALL[d.replace(path, "").split('/')[0]].append(dict(name=pkg_name, ver=f.replace(pkg_name) ))
|
|
|
|
|
|
|
|
|
|
#print(str(len(INSTALL)))
|
|
|
|
|
#return json.dumps({'install_pkgs':INSTALL})
|
|
|
|
|
return INSTALL
|
|
|
|
|
#print(str(len(INSTALL)))
|
|
|
|
|
#return json.dumps({'install_pkgs':INSTALL})
|
|
|
|
|
return INSTALL
|
|
|
|
|
|
|
|
|
|
def scan_config_portage():
|
|
|
|
|
dirs_root =["/var/db/repos", "/usr/portage"]
|
|
|
|
|
config = {}
|
|
|
|
|
i = 0
|
|
|
|
|
dr = {}
|
|
|
|
|
data = {}
|
|
|
|
|
pf={}
|
|
|
|
|
for dir_root in dirs_root:
|
|
|
|
|
dirs_root =["/var/db/repos", "/usr/portage"]
|
|
|
|
|
config = {}
|
|
|
|
|
i = 0
|
|
|
|
|
dr = {}
|
|
|
|
|
data = {}
|
|
|
|
|
pf={}
|
|
|
|
|
for dir_root in dirs_root:
|
|
|
|
|
for d, dirs, files in os.walk(dir_root):
|
|
|
|
|
print(str(d))
|
|
|
|
|
i=i+1
|
|
|
|
|
for fl in files:
|
|
|
|
|
with open(d + "/" +fl) as f:
|
|
|
|
|
with open(d + "/" + fl) as f:
|
|
|
|
|
pf[str(d.split('/')[-1]) + "/"+ fl]= f.read().split('\n')
|
|
|
|
|
str(d.split('/')[-1])
|
|
|
|
|
#print(dr)
|
|
|
|
|
#config = {'portage': pf}
|
|
|
|
|
#print("config:\t" + str(config))
|
|
|
|
|
#return config
|
|
|
|
|
#print(dr)
|
|
|
|
|
#config = {'portage': pf}
|
|
|
|
|
#print("config:\t" + str(config))
|
|
|
|
|
#return config
|
|
|
|
|