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

@ -48,4 +48,4 @@ vim
nano
vscode
jedit
gedit
gedit

@ -60,7 +60,7 @@ def create_db():
overlays = get_list_overlays()
recovers = ScanRecoverFile()
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()
portage_list ={}
port_dir =["/var/db/repos", "/usr/portage"]
@ -86,8 +86,8 @@ def create_db():
print(e)
if not pkg_name[:-1] in all_pkgs:
portage_list[pkg_name] = search(pkg_name)
print
#portage_list[pkg_name] = search(pkg_name)
#print
#print(str(d.split("/")[-2] +"/" + d.split("/")[-1] +"\n"))
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():
pkg_list[str(d.split("/")[-2])] = []
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]))
print([d.split("/")[-2]])
# print([d.split("/")[-2]])
else:
if d.split('/')[-1] not in pkg_list[d.split('/')[-2]]:
pkg_list[d.split("/")[-2]].append(d.split('/')[-1])
#print([d.split('/')[-1]])
#"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))
"""
with open('./portage.json', 'w') as p:

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

@ -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

Loading…
Cancel
Save