Merge branch 'backend_manual' into 'backend_uu'
Backend manual See merge request kylinos-src/update-manager-group/kylin-system-updater!507
This commit is contained in:
commit
00dce29788
|
@ -17,6 +17,7 @@ class LogInstallProgress(apt.progress.base.InstallProgress):
|
|||
self.filename=file
|
||||
self.error_pkg=""
|
||||
self.errormsg=""
|
||||
# raise Exception("for test!!!")
|
||||
|
||||
def error(self,pkg, errormsg):
|
||||
logging.error(("Install mode - dpkg, Install error: %s"), errormsg)
|
||||
|
|
|
@ -639,7 +639,7 @@ class UpdateManager():
|
|||
if depends.split('_')[0] == debfile.split('_')[0] and depends.split('_')[1] == debfile.split('_')[1] and debfile not in satisfy_list:
|
||||
depends_count += 1
|
||||
satisfy_list.append(debfile)
|
||||
if depends_count < len(noSatisfyList):
|
||||
if depends_count < len(noSatisfyList) or depends_count < len(depends_pkg):
|
||||
#本地依赖不满足
|
||||
error_string = str(debname.split("_")[0])+_("dependency is not satisfied")+", ".join(noSatisfyList)
|
||||
logging.error(error_string)
|
||||
|
@ -687,12 +687,12 @@ class UpdateManager():
|
|||
# 检查本地破损
|
||||
try:
|
||||
deb_cache = Cache()
|
||||
logging.info("Install deb package, check broken")
|
||||
logging.info("Install deb_package, check broken")
|
||||
broken_count = deb_cache._depcache.broken_count
|
||||
deb = DebPackage(deb_path, deb_cache)
|
||||
deb.check(allow_downgrade=True)
|
||||
logging.info("Install deb package, required changes")
|
||||
(install, remove, unauth) = deb.required_changes # need in cach
|
||||
debPackage = DebPackage(deb_path, deb_cache)
|
||||
debPackage.check(allow_downgrade=True)
|
||||
logging.info("Install deb_package, required changes")
|
||||
(install, remove, unauth) = debPackage.required_changes # need in cach
|
||||
if broken_count > 0:
|
||||
self._is_broken = True
|
||||
else :
|
||||
|
@ -712,7 +712,7 @@ class UpdateManager():
|
|||
raise UpdateBaseError(ERROR_INSTALL_DEB_BASE)
|
||||
self._need_downgrade = False
|
||||
# 不满足的依赖列表
|
||||
depends = deb.depends
|
||||
depends = debPackage.depends
|
||||
self.noSatisfyList = self._gen_noSatisfyList(depends, deb_cache)
|
||||
_list = []
|
||||
# cache是否满足
|
||||
|
@ -736,8 +736,8 @@ class UpdateManager():
|
|||
_group_satify = False
|
||||
providers = []
|
||||
for or_group in depends:
|
||||
for deb in or_group:
|
||||
debname,ver,oper = deb
|
||||
for deb_info in or_group:
|
||||
debname,ver,oper = deb_info
|
||||
if ":" in debname:
|
||||
debname=debname.split(":")[0]
|
||||
try:
|
||||
|
|
|
@ -54,6 +54,13 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
|
||||
self.transaction = None
|
||||
|
||||
def __check_change__(self, _config = None, _section = "", _option = "", _value = ""):
|
||||
if _config == None:
|
||||
return False
|
||||
if _value == _config.getWithDefault(_section,_option,_value," "):
|
||||
return True
|
||||
return False
|
||||
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,
|
||||
in_signature="", out_signature="",
|
||||
sender_keyword="caller_name")
|
||||
|
@ -74,11 +81,14 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' SetPreDownloadState, state is %r, time: %s, sender name: %s .',state,time,sender_name)
|
||||
try:
|
||||
if state:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "preDownload", "on"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "preDownload", "on", True)
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "preDownloadTime", time, True)
|
||||
self.PropertyChanged("preDownload","on")
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "preDownloadTime", time):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "preDownloadTime", time, True)
|
||||
self.PropertyChanged("preDownloadTime",time)
|
||||
else:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "preDownload", "off"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "preDownload", "off", True)
|
||||
self.PropertyChanged("preDownload","off")
|
||||
except Exception as e:
|
||||
|
@ -94,7 +104,8 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' SetUpdateDays, days: %d , sender:%s .'\
|
||||
,_days,sender_name)
|
||||
try:
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "updateDays", _days, True)
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "updateDays", _days):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "updateDays", str(_days), True)
|
||||
self.PropertyChanged("updateDays",str(_days))
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
@ -106,9 +117,10 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
def SetAutoUpgradeRandomRange(self,randomRange,sender=None):
|
||||
_randomRange = str(randomRange)
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' SetAutoUpgradeRandomRange will be set value %d, sender: %s .',\
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' SetAutoUpgradeRandomRange will be set value %s, sender: %s .',\
|
||||
_randomRange,sender_name)
|
||||
try:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "randomRange", _randomRange):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "randomRange", _randomRange, True)
|
||||
self.PropertyChanged("randomRange",_randomRange)
|
||||
except Exception as e:
|
||||
|
@ -125,11 +137,14 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
,_state,_reboot_time,sender_name)
|
||||
try:
|
||||
if _state:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "automaticReboot", "on"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "automaticReboot", "on", True)
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "automaticRebootTime", _reboot_time, True)
|
||||
self.PropertyChanged("automaticReboot","on")
|
||||
self.PropertyChanged("preDownloadTime",_reboot_time)
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "automaticRebootTime", _reboot_time):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "automaticRebootTime", _reboot_time, True)
|
||||
self.PropertyChanged("automaticRebootTime",_reboot_time)
|
||||
else:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "automaticReboot", "off"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "automaticReboot", "off", True)
|
||||
self.PropertyChanged("automaticReboot","off")
|
||||
except Exception as e:
|
||||
|
@ -144,15 +159,17 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' SetAutoUpgradeState, state is %r ...',state)
|
||||
try:
|
||||
if state:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "autoUpgradeState", "on"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "on", True)
|
||||
self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "true")
|
||||
self.ButtonStatusChange("autoUpgradeStatus", "true")
|
||||
self.PropertyChanged("autoUpgradeState","on")
|
||||
self.ButtonStatusChange("autoUpgradeStatus", "true")
|
||||
else :
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "autoUpgradeState", "off"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "off", True)
|
||||
self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "false")
|
||||
self.ButtonStatusChange("autoUpgradeStatus", "false")
|
||||
self.PropertyChanged("autoUpgradeState","off")
|
||||
self.ButtonStatusChange("autoUpgradeStatus", "false")
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return False
|
||||
|
@ -165,27 +182,28 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
|
|||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' SetAutoUpgradeMode, mode is %s, time is %s ...',mode,_time)
|
||||
try:
|
||||
if mode == UU_UPGRADE_MODE_AUTOMATIC_DOWNLOAD:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "downloadMode", "timing"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True)
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadTime", str(_time), True)
|
||||
|
||||
self.ButtonStatusChange("autoUpgradeTime", str(_time))
|
||||
self.PropertyChanged("downloadMode","timing")
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "downloadTime", str(_time)):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadTime", str(_time), True)
|
||||
self.PropertyChanged("downloadTime",str(_time))
|
||||
self.ButtonStatusChange("autoUpgradeTime", str(_time))
|
||||
elif mode == UU_UPGRADE_MODE_AUTOMATIC_INSTALL:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "installMode", "timing"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "timing", True)
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installTime", str(_time), True)
|
||||
|
||||
self.PropertyChanged("installMode","timing")
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "installTime", str(_time)):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installTime", str(_time), True)
|
||||
self.PropertyChanged("installTime",str(_time))
|
||||
elif mode == UU_UPGRADE_MODE_BEFORE_SHUTDOWN:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "installTime", "bshutdown"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "bshutdown", True)
|
||||
|
||||
self.PropertyChanged("installMode","bshutdown")
|
||||
elif mode == UU_UPGRADE_MODE_MANUAL:
|
||||
if not self.__check_change__(self.parent.uuconfigs, "autoUpgradePolicy", "downloadMode", "manual"):
|
||||
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "manual", True)
|
||||
|
||||
self.PropertyChanged("downloadMode","manual")
|
||||
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return False
|
||||
|
|
|
@ -106,8 +106,10 @@ class UpdateEssentialItem():
|
|||
|
||||
def check_white(self,remove_pkgs):
|
||||
logging.info("Check: remove pkg in White Packages...")
|
||||
for pkg in remove_pkgs:
|
||||
if pkg in self.remove_white:
|
||||
new_upgrade_list = list(set(remove_pkgs) & set(self.remove_white))
|
||||
|
||||
for pkg in new_upgrade_list:
|
||||
if pkg in remove_pkgs:
|
||||
logging.info("%s will be remove in remove pkg...",pkg)
|
||||
remove_pkgs.remove(pkg)
|
||||
|
||||
|
|
Loading…
Reference in New Issue