Compare commits
No commits in common. "acfe9e3291d069403754290ce65c891e3355be42" and "e6db7bc33c5fce7465376457cd7cb9cf778e6def" have entirely different histories.
acfe9e3291
...
e6db7bc33c
@ -1,167 +0,0 @@
|
||||
diff -Nur pkgship-2.2.0/packageship/application/core/compare/validate.py pkgship-2.2.1/packageship/application/core/compare/validate.py
|
||||
--- pkgship-2.2.0/packageship/application/core/compare/validate.py 2021-08-16 03:27:41.000000000 +0000
|
||||
+++ pkgship-2.2.1/packageship/application/core/compare/validate.py 2021-11-18 03:44:09.566149890 +0000
|
||||
@@ -1,81 +1,81 @@
|
||||
-#!/usr/bin/python3
|
||||
-# ******************************************************************************
|
||||
-# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
-# licensed under the Mulan PSL v2.
|
||||
-# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
-# You may obtain a copy of Mulan PSL v2 at:
|
||||
-# http://license.coscl.org.cn/MulanPSL2
|
||||
-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
-# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
-# PURPOSE.
|
||||
-# See the Mulan PSL v2 for more details.
|
||||
-# ******************************************************************************/
|
||||
-"""
|
||||
-Validate args of compare command
|
||||
-"""
|
||||
-import os
|
||||
-import shutil
|
||||
-
|
||||
-from packageship.application.common.constant import SUPPORT_QUERY_TYPE
|
||||
-from packageship.application.query import database
|
||||
-
|
||||
-# Maximum number of supported databases
|
||||
-MAX_SUPPORT_DB = 4
|
||||
-
|
||||
-
|
||||
-def validate_args(depend_type, dbs, output_path):
|
||||
- """
|
||||
- validate args of compare command
|
||||
- :param depend_type:
|
||||
- :param dbs: input databases
|
||||
- :param output_path:
|
||||
- :return:
|
||||
- """
|
||||
- if not all((depend_type, dbs, output_path)):
|
||||
- raise ValueError('[ERROR] Parameter error, please check the parameter and query again.')
|
||||
- # verify depend type
|
||||
- if depend_type not in SUPPORT_QUERY_TYPE:
|
||||
- raise ValueError(f'[ERROR] Dependent type ({depend_type}) is not supported, please enter again.')
|
||||
- # verify dbs
|
||||
- _validate_dbs(dbs)
|
||||
- # verify output_path
|
||||
- if not os.path.isdir(output_path) or not _is_writable(path=output_path):
|
||||
- raise ValueError(f'[ERROR] Output path ({output_path}) not exist or does not support user pkgshipuser writing.')
|
||||
-
|
||||
-
|
||||
-def _validate_dbs(dbs):
|
||||
- """
|
||||
- Verify that the input database is supported
|
||||
- :param dbs: input dbs
|
||||
- :return: None
|
||||
- """
|
||||
- if len(dbs) > MAX_SUPPORT_DB:
|
||||
- raise ValueError(f'[ERROR] Supports up to four databases.')
|
||||
-
|
||||
- if len(dbs) != len(set(dbs)):
|
||||
- raise ValueError(f'[ERROR] Duplicate database entered.')
|
||||
-
|
||||
- support_dbs = database.get_db_priority()
|
||||
- for db in dbs:
|
||||
- if db not in support_dbs:
|
||||
- raise ValueError(f'[ERROR] Database ({db}) is not supported, please enter again.')
|
||||
- if len(dbs) == 1:
|
||||
- print('[WARNING] There is only one input database, '
|
||||
- 'and only dependent information files will be generated without data comparison.')
|
||||
-
|
||||
-
|
||||
-def _is_writable(path):
|
||||
- """
|
||||
- Verify whether run user has write permission to the output path
|
||||
- :param path: cvs save path
|
||||
- :return: True False
|
||||
- """
|
||||
- tmp_path = os.path.join(path, 'tmp_compare')
|
||||
- try:
|
||||
- os.mkdir(tmp_path)
|
||||
- except PermissionError:
|
||||
- return False
|
||||
- finally:
|
||||
- if os.path.isdir(tmp_path):
|
||||
- shutil.rmtree(tmp_path)
|
||||
- return True
|
||||
+#!/usr/bin/python3
|
||||
+# ******************************************************************************
|
||||
+# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
+# licensed under the Mulan PSL v2.
|
||||
+# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+# You may obtain a copy of Mulan PSL v2 at:
|
||||
+# http://license.coscl.org.cn/MulanPSL2
|
||||
+# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
+# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
+# PURPOSE.
|
||||
+# See the Mulan PSL v2 for more details.
|
||||
+# ******************************************************************************/
|
||||
+"""
|
||||
+Validate args of compare command
|
||||
+"""
|
||||
+import os
|
||||
+import shutil
|
||||
+
|
||||
+from packageship.application.common.constant import SUPPORT_QUERY_TYPE
|
||||
+from packageship.application.query import database
|
||||
+
|
||||
+# Maximum number of supported databases
|
||||
+MAX_SUPPORT_DB = 4
|
||||
+
|
||||
+
|
||||
+def validate_args(depend_type, dbs, output_path):
|
||||
+ """
|
||||
+ validate args of compare command
|
||||
+ :param depend_type:
|
||||
+ :param dbs: input databases
|
||||
+ :param output_path:
|
||||
+ :return:
|
||||
+ """
|
||||
+ if not all((depend_type, dbs, output_path)):
|
||||
+ raise ValueError('[ERROR] Parameter error, please check the parameter and query again.')
|
||||
+ # verify depend type
|
||||
+ if depend_type not in SUPPORT_QUERY_TYPE:
|
||||
+ raise ValueError(f'[ERROR] Dependent type ({depend_type}) is not supported, please enter again.')
|
||||
+ # verify dbs
|
||||
+ _validate_dbs(dbs)
|
||||
+ # verify output_path
|
||||
+ if not os.path.isdir(output_path) or not _is_writable(path=output_path):
|
||||
+ raise ValueError(f'[ERROR] Output path ({output_path}) not exist or does not support user pkgshipuser writing.')
|
||||
+
|
||||
+
|
||||
+def _validate_dbs(dbs):
|
||||
+ """
|
||||
+ Verify that the input database is supported
|
||||
+ :param dbs: input dbs
|
||||
+ :return: None
|
||||
+ """
|
||||
+ if len(dbs) > MAX_SUPPORT_DB:
|
||||
+ raise ValueError(f'[ERROR] Supports up to four databases.')
|
||||
+
|
||||
+ if len(dbs) != len(set(dbs)):
|
||||
+ raise ValueError(f'[ERROR] Duplicate database entered.')
|
||||
+
|
||||
+ support_dbs = database.get_db_priority()
|
||||
+ for db in dbs:
|
||||
+ if db not in support_dbs:
|
||||
+ raise ValueError(f'[ERROR] Database ({db}) is not supported, please enter again.')
|
||||
+ if len(dbs) == 1:
|
||||
+ print('[WARNING] There is only one input database, '
|
||||
+ 'and only dependent information files will be generated without data comparison.')
|
||||
+
|
||||
+
|
||||
+def _is_writable(path):
|
||||
+ """
|
||||
+ Verify whether run user has write permission to the output path
|
||||
+ :param path: cvs save path
|
||||
+ :return: True False
|
||||
+ """
|
||||
+ tmp_path = os.path.join(path, 'tmp_compare')
|
||||
+ try:
|
||||
+ os.mkdir(tmp_path)
|
||||
+ except PermissionError:
|
||||
+ return False
|
||||
+ finally:
|
||||
+ if os.path.isdir(tmp_path):
|
||||
+ shutil.rmtree(tmp_path)
|
||||
+ return True
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
diff --git a/README.md b/README.md
|
||||
index eef54927c47f8b5703daa9c91590f38cadd98039..6be49b1586555cc3f09afc0d5baa6ef033ca3aea 100644
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -53,6 +53,8 @@ pkgship是一款管理OS软件包依赖关系,提供依赖和被依赖关系
|
||||
| Python | 版本 3.8及以上 |
|
||||
|
||||
## 安装工具
|
||||
+> 说明:该软件支持在docker下运行。目前在openEuler21.09版本下,由于环境条件限制,创建docker时请使用--privileged参数,不使用--privileged参数将会导致软件启动失败,后续适配后将更新该文档。
|
||||
+
|
||||
**1、pkgship工具安装**
|
||||
|
||||
工具安装可通过以下两种方式中的任意一种实现。
|
||||
@@ -223,6 +225,8 @@ pkgshipd stop 停止服务
|
||||
> 每次起停周期内仅支持一种方式,不允许两种操作同时使用。
|
||||
>
|
||||
> pkgshipd启动方式只允许在pkgshipuser用户下操作。
|
||||
+>
|
||||
+> docker环境下如果不支持systemctl命令,请使用pkgshipd启停方式。
|
||||
|
||||
## 工具使用
|
||||
@ -1,13 +0,0 @@
|
||||
diff --git a/packageship/application/initialize/integration.py b/packageship/application/initialize/integration.py
|
||||
index 99668eeb51b8199b5a80daea1917cbb395e57824..6a5c00f867dfcf54c629a5a48a8c1b5b44a442b1 100644
|
||||
--- a/packageship/application/initialize/integration.py
|
||||
+++ b/packageship/application/initialize/integration.py
|
||||
@@ -304,7 +304,7 @@ class InitializeService:
|
||||
es_json["provides"] = list()
|
||||
|
||||
for provide in self._bin_provides.get(bin_pack["pkgKey"]):
|
||||
- component_json = ESJson()
|
||||
+ component_json = dict()
|
||||
component_json['component'] = provide["name"]
|
||||
_build(component_json, provide)
|
||||
_install(component_json, provide)
|
||||
@ -1,123 +0,0 @@
|
||||
diff --color -Nur a/packageship/application/cli/base.py b/packageship/application/cli/base.py
|
||||
--- a/packageship/application/cli/base.py 2021-08-14 22:23:58.000000000 +0800
|
||||
+++ b/packageship/application/cli/base.py 2022-01-09 11:17:09.842737171 +0800
|
||||
@@ -30,7 +30,6 @@
|
||||
else:
|
||||
from packageship.application.common.constant import ResponseCode
|
||||
from packageship.application.common.constant import ERROR_CON
|
||||
- from packageship.libs.terminal_table import TerminalTable
|
||||
|
||||
|
||||
class BaseCommand():
|
||||
@@ -130,8 +129,7 @@
|
||||
Raises:
|
||||
|
||||
"""
|
||||
- table = TerminalTable(title)
|
||||
- # table.set_style(prettytable.PLAIN_COLUMNS)
|
||||
+ table = prettytable.PrettyTable(title)
|
||||
table.align = 'l'
|
||||
table.horizontal_char = '='
|
||||
table.junction_char = '='
|
||||
diff --color -Nur a/packageship/application/cli/cmd.py b/packageship/application/cli/cmd.py
|
||||
--- a/packageship/application/cli/cmd.py 2021-08-14 22:23:58.000000000 +0800
|
||||
+++ b/packageship/application/cli/cmd.py 2022-01-09 11:17:30.935093041 +0800
|
||||
@@ -26,7 +26,6 @@
|
||||
from packageship.application.common.constant import ResponseCode
|
||||
from packageship.application.common.constant import ListNode
|
||||
from packageship.application.common.constant import UWSIG_PATH
|
||||
- from packageship.libs.terminal_table import TerminalTable
|
||||
from packageship.application.common.constant import ERROR_CON
|
||||
from packageship.application.cli.commands.allpkg import AllPackageCommand
|
||||
from packageship.application.cli.commands.bedepend import BeDependCommand
|
||||
diff --color -Nur a/packageship/libs/terminal_table.py b/packageship/libs/terminal_table.py
|
||||
--- a/packageship/libs/terminal_table.py 2021-08-14 22:23:59.000000000 +0800
|
||||
+++ b/packageship/libs/terminal_table.py 1970-01-01 08:00:00.000000000 +0800
|
||||
@@ -1,87 +0,0 @@
|
||||
-#!/usr/bin/python3
|
||||
-# ******************************************************************************
|
||||
-# Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
|
||||
-# licensed under the Mulan PSL v2.
|
||||
-# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
-# You may obtain a copy of Mulan PSL v2 at:
|
||||
-# http://license.coscl.org.cn/MulanPSL2
|
||||
-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
-# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
-# PURPOSE.
|
||||
-# See the Mulan PSL v2 for more details.
|
||||
-# ******************************************************************************/
|
||||
-"""
|
||||
-Description: Simple encapsulation of pretty table
|
||||
-Class: TerminalTable
|
||||
-"""
|
||||
-import os
|
||||
-from prettytable import PrettyTable
|
||||
-
|
||||
-
|
||||
-class TerminalTable(PrettyTable):
|
||||
- """
|
||||
- Description: Rewrite several methods in prettytable
|
||||
- Attributes:
|
||||
- bottom:Bottom display
|
||||
- _vertical_char:Draw characters with vertical edges
|
||||
- """
|
||||
-
|
||||
- def __init__(self, field_names=None, **kwargs):
|
||||
- super().__init__(field_names, **kwargs)
|
||||
- self.bottom = kwargs.get('bottom') or False
|
||||
- self._vertical_char = kwargs.get('vertical_char') or self._unicode("")
|
||||
-
|
||||
- def _reduce_widths(self, columns, lpad, rpad):
|
||||
- """
|
||||
- Description: Handling over-width columns
|
||||
- Args:
|
||||
- columns:columns
|
||||
- lpad:The number of spaces to the left of the column data
|
||||
- rpad:The number of spaces to the right of the column data
|
||||
- Returns:
|
||||
-
|
||||
- """
|
||||
- extra_width = sum(self._widths) - columns + (lpad + rpad) * len(self._widths)
|
||||
- avg_width = columns / len(self._widths)
|
||||
- gt_avg = filter(lambda x: x > avg_width, self._widths)
|
||||
- denominator = sum(
|
||||
- [(item - avg_width) / avg_width * 1.0 for item in gt_avg])
|
||||
- zoom_width = list()
|
||||
- for width in self._widths:
|
||||
- if width > avg_width:
|
||||
- width = round(width - ((width - avg_width) / avg_width * 1.0) /
|
||||
- denominator * extra_width)
|
||||
- zoom_width.append(width)
|
||||
- self._widths = zoom_width
|
||||
- if sum(self._widths) > columns:
|
||||
- _max_val = max(self._widths)
|
||||
- self._widths[self._widths.index(_max_val)] = _max_val - (sum(self._widths) - columns)
|
||||
-
|
||||
- def _compute_widths(self, rows, options):
|
||||
- """
|
||||
- Description: Calculated width
|
||||
- Args:
|
||||
- rows:row of data, should be a list with as many elements as the table
|
||||
- options:option
|
||||
- Returns:
|
||||
-
|
||||
- """
|
||||
- super()._compute_widths(rows, options)
|
||||
- lpad, rpad = self._get_padding_widths(options)
|
||||
- # Total number of columns
|
||||
- try:
|
||||
- window_width = os.get_terminal_size().columns
|
||||
- except OSError as os_error:
|
||||
- window_width = 100
|
||||
- _columns = window_width - len(self._widths) - 1
|
||||
- if _columns < sum(map(lambda x: x + lpad + rpad, self._widths)):
|
||||
- coefficient = 1
|
||||
- self._reduce_widths(_columns, lpad, rpad)
|
||||
- else:
|
||||
- coefficient = _columns / (sum(map(lambda x: x, self._widths)) * 1.0)
|
||||
- self._widths = list(
|
||||
- map(lambda x: round(x * coefficient - lpad - rpad), self._widths))
|
||||
- if sum(map(lambda x: x + lpad + rpad, self._widths)) > _columns:
|
||||
- _max_val = max(self._widths)
|
||||
- self._widths[self._widths.index(_max_val)] =\
|
||||
- _max_val - (sum(map(lambda x: x + lpad + rpad, self._widths)) - _columns)
|
||||
@ -1,18 +0,0 @@
|
||||
From 89958aea1e373aae9298ca5b41be5ed44b09f840 Mon Sep 17 00:00:00 2001
|
||||
From: liheavy <lihaiwei8@huawei.com>
|
||||
Date: Tue, 29 Nov 2022 18:00:10 +0800
|
||||
Subject: [PATCH] fix restart due to redis
|
||||
|
||||
diff -Nur a/packageship/pkgshipd b/packageship/pkgshipd
|
||||
--- a/packageship/pkgshipd 2022-11-29 16:46:36.425308950 +0800
|
||||
+++ b/packageship/pkgshipd 2022-11-29 16:48:17.235065339 +0800
|
||||
@@ -355,7 +355,8 @@
|
||||
python_command="import redis
|
||||
try:
|
||||
response = redis.Redis(host='$redis_ip',
|
||||
- port="$redis_port")
|
||||
+ port="$redis_port",
|
||||
+ socket_timeout=3)
|
||||
print(response.ping())
|
||||
except Exception:
|
||||
print(False)"
|
||||
25
pkgship.spec
25
pkgship.spec
@ -1,6 +1,6 @@
|
||||
Name: pkgship
|
||||
Version: 2.2.0
|
||||
Release: 10
|
||||
Release: 5
|
||||
Summary: Pkgship implements rpm package dependence ,maintainer, patch query and so on.
|
||||
License: Mulan 2.0
|
||||
URL: https://gitee.com/openeuler/pkgship
|
||||
@ -9,12 +9,6 @@ Patch0001: 0001-bugfix-pkginfo.patch
|
||||
Patch0002: 0002-fix-install-and-start-script-info.patch
|
||||
Patch0003: 0003-bugfix-binary-name-mapping-source.patch
|
||||
Patch0004: 0004-fix-depend-query.patch
|
||||
Patch0005: 0005-update-validate-encoding-format.patch
|
||||
Patch0006: 0006-update-copyright.patch
|
||||
Patch0007: 0007-update-readme-about-docker.patch
|
||||
Patch0008: 0008-fix-simplejson-question.patch
|
||||
Patch0009: 0009-delete-terminal-fix-build-failed.patch
|
||||
Patch0010: 0010-fix-restart-due-to-redis-config-error.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -120,23 +114,6 @@ create_dir_file /var/log/pkgship-operation 700 d
|
||||
%attr(0640,pkgshipuser,pkgshipuser) /lib/systemd/system/pkgship.service
|
||||
|
||||
%changelog
|
||||
* Tue Nov 29 2022 Haiwei Li <lihaiwei8@huawei.com> - 2.2.0-10
|
||||
- Fixed the problem that the service keeps restarting due to a redis configuration problem.
|
||||
|
||||
* Sun Jan 9 2022 Haiwei Li <lihaiwei8@huawei.com> - 2.2.0-9
|
||||
- TerminalTable class Use the deprecated method of PrettyTable, resulting in compilation failure, delete the file.
|
||||
|
||||
* Thu Nov 18 2021 Haiwei Li <lihaiwei8@huawei.com> - 2.2.0-8
|
||||
- Solve the problem of patch application failure due to the file encoding format being crlf.
|
||||
- Solve the problem of json serialization caused by flask's new dependency on simple-json.
|
||||
|
||||
* Sun Sep 26 2021 Haiwei Li <lihaiwei8@huawei.com> - 2.2.0-7
|
||||
- Due to a problem with docker, when pkgship is used in docker,
|
||||
- it must be created with the --privileged parameter, otherwise it will fail. So update the instructions.
|
||||
|
||||
* Mon Sep 6 2021 Haiwei Li <lihaiwei8@huawei.com> - 2.2.0-6
|
||||
- Update the date in copyright.
|
||||
|
||||
* Fri Sep 3 2021 Haiwei Li <lihaiwei8@huawei.com> - 2.2.0-5
|
||||
- When the query is dependent, a list containing only None is entered,
|
||||
- which causes an error in the es query.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user