diff --git a/0005-update-validate-encoding-format.patch b/0005-update-validate-encoding-format.patch new file mode 100644 index 0000000..9cfbc8a --- /dev/null +++ b/0005-update-validate-encoding-format.patch @@ -0,0 +1,167 @@ +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 + diff --git a/0005-update-copyright.patch b/0006-update-copyright.patch similarity index 100% rename from 0005-update-copyright.patch rename to 0006-update-copyright.patch diff --git a/0006-update-readme-about-docker.patch b/0007-update-readme-about-docker.patch similarity index 100% rename from 0006-update-readme-about-docker.patch rename to 0007-update-readme-about-docker.patch diff --git a/0008-fix-simplejson-question.patch b/0008-fix-simplejson-question.patch new file mode 100644 index 0000000..abc00b1 --- /dev/null +++ b/0008-fix-simplejson-question.patch @@ -0,0 +1,13 @@ +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) diff --git a/pkgship.spec b/pkgship.spec index a249bd1..d8894ae 100755 --- a/pkgship.spec +++ b/pkgship.spec @@ -1,6 +1,6 @@ Name: pkgship Version: 2.2.0 -Release: 7 +Release: 8 Summary: Pkgship implements rpm package dependence ,maintainer, patch query and so on. License: Mulan 2.0 URL: https://gitee.com/openeuler/pkgship @@ -9,8 +9,10 @@ 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-copyright.patch -Patch0006: 0006-update-readme-about-docker.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 BuildArch: noarch @@ -116,6 +118,10 @@ create_dir_file /var/log/pkgship-operation 700 d %attr(0640,pkgshipuser,pkgshipuser) /lib/systemd/system/pkgship.service %changelog +* Thu Nov 18 2021 Haiwei Li - 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 - 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.