fix localUSE und add inclides overlays

pull/1/head
serkus01 3 years ago
parent 32fa5b4a43
commit b6c09dff2c

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -60,7 +60,7 @@ def create_db():
overlays = get_list_overlays() overlays = get_list_overlays()
recovers = ScanRecoverFile() recovers = ScanRecoverFile()
pkg_list ={} pkg_list ={}
listUses= dict(LocalUSE=get_local_USE(), GlobalUSE=get_global_USE()) listUses= dict(LocalUSE=get_local_USE(), GlobalUSE=get_global_USE()) #[0] LocalUSE=get_local_USE(),
InstallPkgs= sort_install_pkg() InstallPkgs= sort_install_pkg()
portage_list ={} portage_list ={}
port_dir =["/var/db/repos", "/usr/portage"] port_dir =["/var/db/repos", "/usr/portage"]
@ -86,8 +86,8 @@ def create_db():
print(e) print(e)
if not pkg_name[:-1] in all_pkgs: if not pkg_name[:-1] in all_pkgs:
portage_list[pkg_name] = search(pkg_name) #portage_list[pkg_name] = search(pkg_name)
print #print
#print(str(d.split("/")[-2] +"/" + d.split("/")[-1] +"\n")) #print(str(d.split("/")[-2] +"/" + d.split("/")[-1] +"\n"))
if str(d.split("/")[-2] +"/" + d.split("/")[-1]) in AliaseCategory: if str(d.split("/")[-2] +"/" + d.split("/")[-1]) in AliaseCategory:
@ -99,15 +99,16 @@ def create_db():
if d.split("/")[-2] not in pkg_list.keys(): if d.split("/")[-2] not in pkg_list.keys():
pkg_list[str(d.split("/")[-2])] = [] pkg_list[str(d.split("/")[-2])] = []
pkg_list[d.split("/")[-2]].append(d.split('/')[-1]) pkg_list[d.split("/")[-2]].append(d.split('/')[-1])
if search(str(d.split("/")[-2]))['Name'] != 'Package is not Found': #if search(str(d.split("/")[-2]))['Name'] != 'Package is not Found':
#portage_list[str(d.split("/")[-2] +"/" + d.split("/")[-1])] = search(str(d.split("/")[-2])) #portage_list[str(d.split("/")[-2] +"/" + d.split("/")[-1])] = search(str(d.split("/")[-2]))
print([d.split("/")[-2]]) # print([d.split("/")[-2]])
else: else:
if d.split('/')[-1] not in pkg_list[d.split('/')[-2]]: if d.split('/')[-1] not in pkg_list[d.split('/')[-2]]:
pkg_list[d.split("/")[-2]].append(d.split('/')[-1]) pkg_list[d.split("/")[-2]].append(d.split('/')[-1])
#print([d.split('/')[-1]]) #print([d.split('/')[-1]])
#"all_pkgs": all_pkgs, [0] #"all_pkgs": all_pkgs, [0]
fn.write(json.dumps({"all_pkgs": all_pkgs, "Catalog": pkg_list, "aliases": AliaseCategory, "overlays": overlays, "recovers": recovers, "usesDecription":listUses, "InstallPkgs":InstallPkgs })) fn.write(json.dumps({ "all_pkgs": all_pkgs, "Catalog": pkg_list,"overlays": overlays, "aliases": AliaseCategory, "recovers": recovers, "usesDecription":listUses, "InstallPkgs":InstallPkgs }))
#json.length "InstallPkgs":InstallPkgs
print(len(pkg_list)) print(len(pkg_list))
""" """
with open('./portage.json', 'w') as p: with open('./portage.json', 'w') as p:

@ -28,8 +28,8 @@ def get_local_USE():
pass pass
else: else:
try: try:
ListUSE[line.split(':')[1] and line.split(' -')[0]] = str(line.replace(line.split(':')[1], "")) ListUSE[line.split(':')[1].split(' -')[0]] = str(line.replace(line.split(':')[0] + ":", ""))
except Exception (e): except Exception as e:
print(str(e)) print(str(e))
print(ListUSE) print(ListUSE)
return ListUSE return ListUSE

@ -38,6 +38,11 @@ def get_list_overlays():
description = "" description = ""
homepage = "" homepage = ""
feed ="" 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'): for child in root.findall('repo'):
name = child.find('name').text name = child.find('name').text
try: try:
@ -64,7 +69,7 @@ def get_list_overlays():
f.write(json.dumps({"repositories": overlays})) f.write(json.dumps({"repositories": overlays}))
#f.close() #f.close()
return overlays return dict(all=overlays, include=inc)
def xml_element_to_dict(elem): def xml_element_to_dict(elem):
@ -104,28 +109,32 @@ def load_config():
return conf return conf
#SORT IN INTALL PAKAGES #SORT IN INTALL PAKAGES
#'/var/db/pkg/' #''
def sort_install_pkg(): def sort_install_pkg():
pkg =scan_config_portage() #pkg =scan_config_portage()
INSTALL = {} INSTALL = {}
pkg_name =""
path = '/var/db/pkg/' path = '/var/db/pkg/'
for d, dirs, files in os.walk(path): for d, dirs, files in os.walk(path):
for f in files: for f in files:
if f.endswith('.ebuild'): if f.endswith('.ebuild'):
try: try:
#ver=int(f.replace('.ebuild', '').split('-')[-1][0]) #ver=int(f.replace('.ebuild', '').split('-')[-1][0])
for pn in f.replace('.ebuild', '').split('-')[:-1]: for pn in f.replace('.ebuild', '').split('-')[:-1]:
pkg_name = pkg_name + pn + "-" pkg_name = pkg_name + pn + "-"
except TypeError: except TypeError:
for pn in f.replace('.ebuild', '').split('-')[:-2]: for pn in f.replace('.ebuild', '').split('-')[:-2]:
pkg_name = pkg_name + pn + "-" pkg_name = pkg_name + pn + "-"
except Exception as e: except Exception as e:
print(e) print(e)
print(pkg_name)
if d.replace(path, "").split('/')[0] not in INSTALL: if d.replace(path, "").split('/')[0] not in INSTALL:
INSTALL[d.replace(path, "").split('/')[0]] =[] 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(f.replace(".ebuild", "") )
INSTALL[d.replace(path, "").split('/')[0]].append(dict(name=pkg_name, 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))) #print(str(len(INSTALL)))
#return json.dumps({'install_pkgs':INSTALL}) #return json.dumps({'install_pkgs':INSTALL})

Loading…
Cancel
Save