diff --git a/utils/findfsdb.py b/utils/findfsdb.py index 5f2baca..d881337 100755 --- a/utils/findfsdb.py +++ b/utils/findfsdb.py @@ -107,6 +107,7 @@ def create_db(): 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,"overlays": overlays, "aliases": AliaseCategory, "recovers": recovers, "usesDecription":listUses, "InstallPkgs":InstallPkgs })) #json.length "InstallPkgs":InstallPkgs print(len(pkg_list)) diff --git a/utils/utils.py b/utils/utils.py index 61378be..88df1ca 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -24,7 +24,6 @@ def read_configs(filename): def enable_overlays(): path='/etc/portage/repos.conf/' - def get_list_overlays(): overlays =[] OverlayList={} @@ -141,24 +140,31 @@ def sort_install_pkg(): 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 + "-" - - except TypeError: - for pn in f.replace('.ebuild', '').split('-')[:-2]: - pkg_name = pkg_name + pn + "-" - except Exception as e: + try: + #ver=int(f.replace('.ebuild', '').split('-')[-1][0]) + 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(e) print(pkg_name) + if pkg_name inot in INSTALL: + INSTALL[d.replace(path, "").split('/')[0]] =[] + 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, "") + """ 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, "") + """ #print(str(len(INSTALL))) #return json.dumps({'install_pkgs':INSTALL})