From 281ffe466a71dd726cc08c471f7e330e2b38d909 Mon Sep 17 00:00:00 2001 From: serkus01 <7erkus@gmail.com> Date: Sun, 18 Jul 2021 16:11:48 +0900 Subject: [PATCH] add genRecovers file recovers.txt --- GenRecovers.py | 25 +++++++++++++++++++++++++ findfsdb.py | 33 +++++++++++++++++++++++---------- recovers.txt | 25 +++++++++++++++++++++++++ scripts/install.sh | 0 scripts/make.sh | 0 5 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 GenRecovers.py create mode 100644 recovers.txt create mode 100644 scripts/install.sh create mode 100644 scripts/make.sh diff --git a/GenRecovers.py b/GenRecovers.py new file mode 100644 index 0000000..89d7088 --- /dev/null +++ b/GenRecovers.py @@ -0,0 +1,25 @@ +# -*- coding: UTF-8 -*- +#!/usr/bin/env python +import os, sys +from package import search + +def ScanRecoverFile(): + ScanResult =[] + if os.path.exists('./recovers.txt'): + with open('./recovers.txt') as f: + ScanResult =f.read().split("\n") + else: + print("Файла со список рекомедации нейдлено") + res = GenRecoversFun(ScanResult) + return res + +def GenRecoversFun(Reclist): + result =[] + for r in Reclist: + result.append(search(r)) + + return result + + +if __name__ == '__main__': + ScanRecoverFile() diff --git a/findfsdb.py b/findfsdb.py index 01d559d..10588a4 100755 --- a/findfsdb.py +++ b/findfsdb.py @@ -2,14 +2,24 @@ # -*- coding: UTF-8 -*- import os, sys import json - +from io import StringIO +from utils.utils import get_list_overlays +from GenRecovers import ScanRecoverFile # создаём разширеную базу пактов с предлизительно структурой #pkg_list ={"category": [{name: name_pkg, versions:[list_version]}]} # и клладём это всё в json # -# +AliaseCategory ={"www-client": "Браузеры", + "www-server": "Сервера", + "game":"Игры", + "dev-lang":"Програмироыввние", + "media-video": "Видео", + "media-sound": "Аудио" + } def create_db(): + overlays = get_list_overlays() + recovers = ScanRecoverFile() pkg_list ={} port_dir =["/var/lib/layman/", "/usr/portage"] if not os.path.exists('./pkgs.json'): @@ -33,24 +43,27 @@ def create_db(): except Exception as e: print(e) - if not pkg_name[:-1] in all_pkgs: + if not pkg_name[:-1] in all_pkgs: - print(str(d.split("/")[-2] +"/" + d.split("/")[-1] +"\n")) - all_pkgs.append(str(d.split("/")[-2] +"/" + d.split("/")[-1])) + #print(str(d.split("/")[-2] +"/" + d.split("/")[-1] +"\n")) + if pkg_name[:-1] in AliaseCategory: + all_pkgs.append(AliaseCategory[pkg_name[:-1]]) + else: + all_pkgs.append(str(d.split("/")[-2] +"/" + d.split("/")[-1])) if d.split("/")[-2] not in pkg_list.keys(): pkg_list[str(d.split("/")[-2])] = [] pkg_list[d.split("/")[-2]].append(d.split('/')[-1]) - 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]]) + #print([d.split('/')[-1]]) - fn.write(json.dumps({"all_pkgs": all_pkgs,"Catalog": pkg_list})) - #print(len(pkg_list)) + fn.write(json.dumps({"all_pkgs": all_pkgs,"Catalog": pkg_list, "aliases": AliaseCategory, "overlays": overlays, "recovers": recovers})) + print(len(pkg_list)) - print("Found:\t"+ str(len(pkg_list.keys())) + " category\n" + str(len(all_pkgs)) +"packages\n") + #print("Found:\t"+ str(len(pkg_list.keys())) + " category\n" + str(len(all_pkgs)) +"packages\n") def on_find(p_v): if not os.path.exists('./pkgs.json'): diff --git a/recovers.txt b/recovers.txt new file mode 100644 index 0000000..1e60021 --- /dev/null +++ b/recovers.txt @@ -0,0 +1,25 @@ + +net-im/element-desktop-bin +net-im/telegram-desktop-bin + + +audacity +obs-studio +kdenlive +mixxx +mplayer +vlc +nginx +www-servers/apache +yaws +dev-util/pycharm-community +gimp +blender +steam-launcher +firefox-bin +vim +nano + + + + diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 0000000..e69de29 diff --git a/scripts/make.sh b/scripts/make.sh new file mode 100644 index 0000000..e69de29