From ad2fb1ede8739c49823292ff54f46343b35ca219 Mon Sep 17 00:00:00 2001 From: dingsheng Date: Wed, 23 Oct 2024 12:05:31 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=93=E5=BA=93=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E8=A7=A3=E6=9E=90=EF=BC=8C=E6=8A=A5=E5=91=8A=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=88=9D=E5=A7=8B=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/report/__init__.py | 0 src/utils/depparse.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 src/report/__init__.py diff --git a/src/report/__init__.py b/src/report/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/src/utils/depparse.py b/src/utils/depparse.py index e19852a..f32b29e 100755 --- a/src/utils/depparse.py +++ b/src/utils/depparse.py @@ -13,6 +13,7 @@ # ********************************************************************************** """ import copy +import json from collections import defaultdict import hawkey @@ -118,3 +119,32 @@ class ISODepParse(DepParse): deps_by_dict[tmp_k] = tmp_v return deps_by_dict + +class RepoDepParse(DepParse): + """ + 仓库软件包依赖解析模块 + """ + def __init__(self): + pass + + def _load_data(self): + """ + 加载仓库配置数据 + Returns: + res (list): 仓库配置数据 + """ + with open('/opt/kyclassifier/src/data/repos_data.json','r') as f: + res = json.load(f) + return res + + def _get_all_pkgs(self): + """ + 解析仓库中所有软件包名集合 + Returns: + res_set (set): 仓库中所有软件包名集合 + """ + if isinstance(self.dep_dict,dict): + res_set = set(self.dep_dict.keys()) + else: + res_set = set() + return res_set -- Gitee