From 3e4f437b80193319b419b7b79fd18767505aa0e7 Mon Sep 17 00:00:00 2001 From: wangsong Date: Mon, 23 May 2022 16:04:02 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E7=9A=84=E6=AC=A1=E6=95=B0=E4=BB=8E1=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=88=B02=E6=AD=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/UpdateManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/SystemUpdater/UpdateManager.py b/backend/SystemUpdater/UpdateManager.py index 2d379cf..4ae2dec 100644 --- a/backend/SystemUpdater/UpdateManager.py +++ b/backend/SystemUpdater/UpdateManager.py @@ -38,7 +38,7 @@ class UpdateManager(): GROUPS_PKG_NAME = 'kylin-update-desktop-config' APTD_PKG_NAME = "aptdaemon" RUN_UNATTENDED_UPGRADE = '/var/run/unattended-upgrades.pid' - RETRY_LIMIT_NUM = 1 + RETRY_LIMIT_NUM = 2 def __init__(self,options): self.options = options From 8edb45d0f15bff43b6da89a39083858829a1d324 Mon Sep 17 00:00:00 2001 From: wangsong Date: Wed, 25 May 2022 11:29:01 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/data/system-updater.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/data/system-updater.conf b/backend/data/system-updater.conf index c0cc094..ebfed79 100644 --- a/backend/data/system-updater.conf +++ b/backend/data/system-updater.conf @@ -10,6 +10,6 @@ check_resover_remove = False check_frontend_pkg = True [InstallMode] -shutdown_install = True +shutdown_install = False manual_install = False auto_install = False \ No newline at end of file From 32236ee1088c341c32fd5cbd48b69d1bb8a937d0 Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 26 May 2022 10:07:03 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E5=8A=A0=E5=85=A5=E5=AF=B9=E5=8C=85=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/backend/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index 2434fba..e33dd4c 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -789,7 +789,7 @@ class InstallBackend(): self.window_main.sqlite3_server.insert_info(self.action_mode,[pkg],[],self.upgrade_data.adjust_pkgs,False,error_string, error_desc) else: #非调整版本的计算方式 - if pkg_obj.is_installed == True and pkg_obj.is_upgradable == False: + if pkg_obj.is_installed == True and pkg_obj.is_upgradable == False and pkg_obj.is_now_broken == False: self.window_main.sqlite3_server.insert_info(self.action_mode,[pkg],[],self.upgrade_data.adjust_pkgs,True,'', '') else: false_num += 1 @@ -806,12 +806,12 @@ class InstallBackend(): for pkg in pkgs_install + pkgs_upgrade: pkg_obj = fresh_cache[pkg] if pkg in adjust_pkgs: - if pkg_obj.is_installed == True and pkg_obj.installed.source_version + pkg_obj.name in self.upgrade_data.adjust_pkgs: + if pkg_obj.is_installed == True and pkg_obj.is_now_broken == False and pkg_obj.installed.source_version + pkg_obj.name in self.upgrade_data.adjust_pkgs: total_pkg.remove(pkg) else: install_error_pkgs.append(pkg) else: - if pkg_obj.is_installed == True and pkg_obj.is_upgradable == False: + if pkg_obj.is_installed == True and pkg_obj.is_upgradable == False and pkg_obj.is_now_broken == False: total_pkg.remove(pkg) else: install_error_pkgs.append(pkg) From cffe199de2ec797727474c8622ec0a578b7b80eb Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 26 May 2022 10:13:06 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/backend/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index e33dd4c..bb0454a 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -781,7 +781,7 @@ class InstallBackend(): #判断是否是源过滤调整的包 调整的话 判断安装版本 来解决是否安装成功 if pkg in adjust_pkgs: - if pkg_obj.is_installed == True and pkg_obj.name + '=' + pkg_obj.installed.source_version in self.upgrade_data.adjust_pkgs: + if pkg_obj.is_installed == True and pkg_obj.is_now_broken == False and pkg_obj.name + '=' + pkg_obj.installed.source_version in self.upgrade_data.adjust_pkgs: self.window_main.sqlite3_server.insert_info(self.action_mode,[pkg],[],self.upgrade_data.adjust_pkgs,True,'', '') else: false_num += 1 From 40c1de81727b19ffe52353cd17e39d78bae4b34b Mon Sep 17 00:00:00 2001 From: Xueyi Luo Date: Thu, 26 May 2022 14:57:12 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=90=8D=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/Database.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/SystemUpdater/Core/Database.py b/backend/SystemUpdater/Core/Database.py index 28fc5cb..c195747 100644 --- a/backend/SystemUpdater/Core/Database.py +++ b/backend/SystemUpdater/Core/Database.py @@ -505,10 +505,14 @@ class Sqlite3Server(object): sql = "select display_name_cn from application where display_name='"+name+"'" cursor.execute(sql) connect.commit() + if cursor.fetchone(): + return str(cursor.fetchone()[0]) + else: + return '' except Exception as e: logging.error(_("Failed to initialize the database: %s"), str(e)) - return False - return str(cursor.fetchone()[0]) + + def listtojsonstr(lists): import json From 99418a231411215e6010ace31a5b154d8280ac64 Mon Sep 17 00:00:00 2001 From: wangsong Date: Thu, 26 May 2022 16:22:24 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=9D=A5=E8=AE=A1=E7=AE=97=E7=A0=B4=E6=8D=9F=E7=9A=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/utils.py | 7 +++++++ backend/SystemUpdater/backend/__init__.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/backend/SystemUpdater/Core/utils.py b/backend/SystemUpdater/Core/utils.py index 8ffacde..8332c1f 100644 --- a/backend/SystemUpdater/Core/utils.py +++ b/backend/SystemUpdater/Core/utils.py @@ -289,6 +289,13 @@ def url_downloadable(uri, debug_func=None): return False return False +def emulate_calcul_broken(pkgs): + args = ["apt-get", "install","--simulate"] + args = args + pkgs + + p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True) + logging.error(str(p.stdout)) + def is_chinese(string): """ 检查整个字符串是否包含中文 diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index bb0454a..58a7bdb 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -19,6 +19,8 @@ from apt import Cache import subprocess from SystemUpdater.Core.UpdateList import LocalUpgradeDataList from SystemUpdater.Core.errors import * +import threading +from SystemUpdater.Core.utils import emulate_calcul_broken class NowUpgradeMeta: """ @@ -513,6 +515,8 @@ class InstallBackend(): logging.info('Resolver calculation Packages List: '+pkg_string+'\n') desc ='\n' + msg logging.error('\n' + msg) + threading_emulate = threading.Thread(target=emulate_calcul_broken,args=(pkgs_install + pkgs_upgrade,)) + threading_emulate.start() return _success,[],[],header,desc def _emulate_calcul_delete(self,pkg,cache): From f4ddcc8c39295ef754753bf2987840cd7e1b5a20 Mon Sep 17 00:00:00 2001 From: wangsong Date: Fri, 27 May 2022 11:11:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=AF=BB=E5=86=99=E7=9A=84=E4=BC=98=E5=8C=96=EF=BC=8C=E7=9B=AE?= =?UTF-8?q?=E5=89=8D=E6=9C=AA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/SystemUpdater/Core/UpdaterConfigParser.py | 3 +-- backend/data/system-updater-defaults.conf | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 backend/data/system-updater-defaults.conf diff --git a/backend/SystemUpdater/Core/UpdaterConfigParser.py b/backend/SystemUpdater/Core/UpdaterConfigParser.py index 60237d0..e7e39b1 100755 --- a/backend/SystemUpdater/Core/UpdaterConfigParser.py +++ b/backend/SystemUpdater/Core/UpdaterConfigParser.py @@ -24,8 +24,7 @@ class UpgradeConfig(SafeConfigParser): # defaults are read first self.config_files = [] if defaults_dir: - for cfg in glob.glob(defaults_dir + "/*.cfg"): - self.config_files.append(cfg) + self.config_files.append(os.path.join(datadir, defaults_dir)) # our config file self.config_files += [maincfg] # overrides are read later diff --git a/backend/data/system-updater-defaults.conf b/backend/data/system-updater-defaults.conf new file mode 100644 index 0000000..ebfed79 --- /dev/null +++ b/backend/data/system-updater-defaults.conf @@ -0,0 +1,15 @@ +[AutoUpgrade] +upgradelist = + +[SystemStatus] +abnormal_reboot = False +close_source_filter = False + +[ConfigPkgStatus] +check_resover_remove = False +check_frontend_pkg = True + +[InstallMode] +shutdown_install = False +manual_install = False +auto_install = False \ No newline at end of file