From 20aba66ec928599ddcd9dabc3a719665eccdaa5a Mon Sep 17 00:00:00 2001 From: gongzt Date: Wed, 9 Sep 2020 11:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E4=BA=8C=E8=BF=9B=E5=88=B6=E7=9A=84sq?= =?UTF-8?q?lite=E4=B8=AD=E7=9A=84files=E8=A1=A8=E4=B8=AD=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9B=E8=A1=8C=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/initsystem/data_import.py | 16 +++++++++++++++- .../packageship/application/models/package.py | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packageship/packageship/application/initsystem/data_import.py b/packageship/packageship/application/initsystem/data_import.py index 605775ef..1c84ca57 100644 --- a/packageship/packageship/application/initsystem/data_import.py +++ b/packageship/packageship/application/initsystem/data_import.py @@ -20,6 +20,7 @@ from packageship.application.models.package import BinPack from packageship.application.models.package import BinRequires from packageship.application.models.package import SrcRequires from packageship.application.models.package import BinProvides +from packageship.application.models.package import BinFiles from packageship.application.models.package import Packages from packageship import system_config @@ -60,7 +61,7 @@ class InitDataBase(): } self.database_name = None self._tables = ['src_pack', 'bin_pack', - 'bin_requires', 'src_requires', 'bin_provides'] + 'bin_requires', 'src_requires', 'bin_provides', 'bin_files'] # Create life cycle related databases and tables if not self.create_database(db_name='lifecycle', tables=['packages_issue', @@ -299,6 +300,7 @@ class InitDataBase(): self._save_bin_packages(db_name) self._save_bin_requires(db_name) self._save_bin_provides(db_name) + self._save_bin_files(db_name) except (SQLAlchemyError, ContentNoneException) as sql_error: LOGGER.logger.error(sql_error) self.__del_database(db_name) @@ -455,6 +457,18 @@ class InitDataBase(): with DBHelper(db_name=db_name) as database: database.batch_add(provides_datas, BinProvides) + def _save_bin_files(self, db_name): + + self.sql = " select * from files " + files_datas = self.__get_data() + if files_datas is None: + raise ContentNoneException( + '{db_name}:There is no relevant binary file installation\ + path data in the provided database '.format(db_name=db_name)) + + with DBHelper(db_name=db_name) as database: + database.batch_add(files_datas, BinFiles) + def __exists_repeat_database(self): """ Determine if the same database name exists diff --git a/packageship/packageship/application/models/package.py b/packageship/packageship/application/models/package.py index 9a13ac40..a8b9140f 100644 --- a/packageship/packageship/application/models/package.py +++ b/packageship/packageship/application/models/package.py @@ -127,6 +127,17 @@ class BinProvides(DBHelper.BASE): pkgKey = Column(Integer, nullable=True) +class BinFiles(DBHelper.BASE): + """ + Installation path of the binary package + """ + __tablename__ = 'bin_files' + id = Column(Integer, primary_key=True) + name = Column(String(500), nullable=True) + type = Column(String(50), nullable=True) + pkgKey = Column(Integer) + + class Packages(): """ Source code package version, issuer and other information -- Gitee