fix bug#91191 升级版本号记录不正确

This commit is contained in:
luoxueyi 2021-11-16 14:33:06 +08:00
parent ec1fe54aa7
commit 80ae44b5d7
3 changed files with 26 additions and 5 deletions

View File

@ -141,7 +141,7 @@ class Sqlite3Server(object):
logging.info(_("Data insertion complete ."))
# 接收更新列表与信息,生成数据并插入数据库中
def insert_info(self, mode, pkg_list=[], pkg_group=[], success = False, error_string = '', error_desc = ''):
def insert_info(self, mode, pkg_list=[], pkg_group=[], adjust_pkg=[], success = False, error_string = '', error_desc = ''):
errstr = error_string + " " + error_desc
status = " "
time = datetime.datetime.now()
@ -167,13 +167,23 @@ class Sqlite3Server(object):
elif pkg_list:
# 单包更新 # 获取单包数据插入数据库
pkgname = pkg_list[0]
for adj in adjust_pkg:
if pkgname in adj:
# 该部分升级的单包为调整版本,与候选版本不一致
pkgname = adj
break
try:
pkg = self.window_main.cache[pkgname]
pkg = self.window_main.cache[pkgname.split("=")[0]]
for ver in pkg.versions:
if ver.version == pkgname.split("=")[1]:
pkg_inst_ver = ver
break
pkgname = pkgname.split("=")[0]
except Exception as e:
logging.error(_("%s could not be detected in the source because the source was changed or for other reasons."), \
str(pkgname))
pkgversion = str(pkg.candidate.version)
pkgdescription = str(pkg.candidate.raw_description)
pkgversion = str(pkg_inst_ver.source_version)
pkgdescription = str(pkg_inst_ver.description)
try:
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr)
# FIXME: 发送插入数据库成功的信号local_upgrade_list

View File

@ -447,6 +447,7 @@ class InstallBackend():
self.now_upgrade.upgrade_mode,
self.now_upgrade.single_pkgs,
self.now_upgrade.upgrade_groups,
self.upgrade_data.adjust_pkgs,
success,
error_string, error_desc)
if success:

View File

@ -96,8 +96,18 @@
ACTION_REMOVE_PACKAGES = 6 #卸载包的状态中
```
#### UnattendedUpgradeValue
- `介绍:` 设置或获取是否允许关机前更新
- `入参`: `s:`operation("get"/"set")`s:`value将要设置的值
- `示例:`
```sh
operation = "set", value = "false"
```
#### Signal列表