Merge branch 'backend_dev' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_dev
This commit is contained in:
commit
ba170cd6ff
|
@ -54,7 +54,6 @@ class UpdateManager():
|
|||
|
||||
#配置文件
|
||||
self.configs = UpgradeConfig("/var/lib/kylin-system-updater/")
|
||||
self.uuconfigs = UpgradeConfig(datadir = "/var/lib/unattended-upgrades/", name = "unattended-upgrades-policy.conf")
|
||||
|
||||
#数据采集器
|
||||
self.collector = UpdateMsgCollector(self)
|
||||
|
@ -441,6 +440,11 @@ class UpdateManager():
|
|||
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),
|
||||
"var/run/reboot-required"))
|
||||
|
||||
def is_logout_required(self):
|
||||
"""If a reboot is required to get all changes into effect."""
|
||||
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),
|
||||
"var/run/logout-required"))
|
||||
|
||||
def _check_cache_broken(self,cache):
|
||||
with cache.actiongroup():
|
||||
if cache.get_changes():
|
||||
|
|
|
@ -7,7 +7,7 @@ import logging
|
|||
import os
|
||||
from gettext import gettext as _
|
||||
|
||||
import apt_pkg
|
||||
import apt
|
||||
from SystemUpdater.Core.utils import (
|
||||
unLockedEnableShutdown,
|
||||
check_free_space,
|
||||
|
@ -330,14 +330,18 @@ class InstallBackend():
|
|||
with cache.actiongroup():
|
||||
if cache.get_changes():
|
||||
cache.clear()
|
||||
Fix = apt_pkg.ProblemResolver(cache._depcache)
|
||||
resolver = apt.cache.ProblemResolver(cache)
|
||||
|
||||
#计算出来的需要删除的包列表
|
||||
all_delete_pkgs = []
|
||||
all_delete_desc = []
|
||||
#标记计算所有需要升级的包
|
||||
for pkg in pkgs_upgrade:
|
||||
cache[pkg].mark_upgrade()
|
||||
cache[pkg].mark_install(False, False, True)
|
||||
|
||||
resolver.clear(cache[pkg])
|
||||
resolver.protect(cache[pkg])
|
||||
|
||||
deleted_pkgs = self._make_delete_pkgs(cache,all_delete_pkgs)
|
||||
for d_pkg in deleted_pkgs:
|
||||
delete_desc = str(d_pkg) + _(" Will be deleted Due to Upgrade ") + str(pkg)
|
||||
|
@ -346,14 +350,17 @@ class InstallBackend():
|
|||
|
||||
#标记计算所有需要安装的
|
||||
for pkg in pkgs_install:
|
||||
cache[pkg].mark_install()
|
||||
cache[pkg].mark_install(False, False,True)
|
||||
|
||||
resolver.clear(cache[pkg])
|
||||
resolver.protect(cache[pkg])
|
||||
deleted_pkgs = self._make_delete_pkgs(cache,all_delete_pkgs)
|
||||
for d_pkg in deleted_pkgs:
|
||||
delete_desc = str(d_pkg) + _(" Will be deleted Due to Install ") + str(pkg)
|
||||
all_delete_desc.append(delete_desc)
|
||||
logging.warning(delete_desc)
|
||||
#会安装新包和卸载包
|
||||
Fix.resolve()
|
||||
resolver.resolve()
|
||||
#不会安装和卸载 只升级
|
||||
return _success,all_delete_pkgs,all_delete_desc,header,desc
|
||||
except Exception as e:
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
# a) it breaks if its not available
|
||||
# b) the string we have here does not need it (because it has no vars)
|
||||
eval_gettext() {
|
||||
if [ -x /usr/bin/gettext ]; then
|
||||
echo $(gettext "$1")
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
export TEXTDOMAIN=update-notifier
|
||||
export TEXTDOMAINDIR=/usr/share/locale
|
||||
|
||||
case "$DPKG_MAINTSCRIPT_PACKAGE::$DPKG_MAINTSCRIPT_NAME" in
|
||||
linux-image-extra*::postrm)
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
if [ "$0" = "/etc/kernel/postinst.d/update-notifier" ]; then
|
||||
DPKG_MAINTSCRIPT_PACKAGE=linux-base
|
||||
fi
|
||||
|
||||
# Wake the applet up
|
||||
echo "*** $(eval_gettext "System logout required") ***" > /var/run/logout-required
|
||||
echo "$DPKG_MAINTSCRIPT_PACKAGE" >> /var/run/logout-required.pkgs
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
# a) it breaks if its not available
|
||||
# b) the string we have here does not need it (because it has no vars)
|
||||
eval_gettext() {
|
||||
if [ -x /usr/bin/gettext ]; then
|
||||
echo $(gettext "$1")
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
export TEXTDOMAIN=update-notifier
|
||||
export TEXTDOMAINDIR=/usr/share/locale
|
||||
|
||||
case "$DPKG_MAINTSCRIPT_PACKAGE::$DPKG_MAINTSCRIPT_NAME" in
|
||||
linux-image-extra*::postrm)
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
if [ "$0" = "/etc/kernel/postinst.d/update-notifier" ]; then
|
||||
DPKG_MAINTSCRIPT_PACKAGE=linux-base
|
||||
fi
|
||||
|
||||
# Wake the applet up
|
||||
echo "*** $(eval_gettext "System restart required") ***" > /var/run/reboot-required
|
||||
echo "$DPKG_MAINTSCRIPT_PACKAGE" >> /var/run/reboot-required.pkgs
|
|
@ -5,7 +5,7 @@ domain=kylin-system-updater
|
|||
formats = bztar
|
||||
|
||||
[nosetests]
|
||||
match=^test
|
||||
match=test
|
||||
|
||||
[install]
|
||||
skip-build=0
|
||||
|
|
|
@ -3,6 +3,8 @@ backend/data/kylin-system-updater.db /usr/share/kylin-system-updater/
|
|||
backend/data/30kylin-system-updater /etc/apt/apt.conf.d/
|
||||
backend/data/com.kylin.systemupgrade.conf /etc/dbus-1/system.d/
|
||||
backend/data/kylin-system-updater.service /usr/lib/systemd/system/
|
||||
backend/data/kylin-logout-required /usr/share/kylin-system-updater/
|
||||
backend/data/kylin-reboot-required /usr/share/kylin-system-updater/
|
||||
backend/kylin-system-updater /usr/share/kylin-system-updater/
|
||||
backend/SystemUpdater/*.py /usr/share/kylin-system-updater/SystemUpdater/
|
||||
backend/SystemUpdater/backend/*.py /usr/share/kylin-system-updater/SystemUpdater/backend/
|
||||
|
|
Loading…
Reference in New Issue