fix conflict

This commit is contained in:
Luoxueyi 2022-09-24 11:02:16 +08:00
parent f6703956dc
commit d428407441
5 changed files with 74 additions and 17 deletions

View File

@ -470,11 +470,12 @@ class PHPServer(threading.Thread):
PINGBACK_INTRANET_URL = "http://archive.kylinos-intranet.cn/kylin-update-manager-server/main.php?"
PINGBACK_INTRANET_FILE_URL = "http://archive.kylinos-intranet.cn/kylin-update-manager-server/get_file.php?"
def get_values(self, _appname="", _appversion="", _state='', _errorcode=''):
def get_values(self, _appname="", _appversion="", _state='', _errorcode='', _errorstring=""):
self.appname = _appname
self.appversion = _appversion
self.status = _state
self.errorcode = _errorcode
self.errorstring = _errorstring
def run(self):
# 获取本机ip
@ -519,16 +520,25 @@ class PHPServer(threading.Thread):
log_dir = os.path.join(self.LOG_PATH, host_mac + "_" + nowtime)
log_file_gzip = log_dir + ".tar.gz"
os.makedirs(log_dir, exist_ok=True)
for name in os.listdir("/var/log/kylin-system-updater/"):
if "kylin-system-updater.log." in name:
shutil.copy(os.path.join("/var/log/kylin-system-updater/",name), log_dir)
for name in os.listdir("/var/log/kylin-update-manager"):
if "kylin-update-manager.log." in name:
shutil.copy(os.path.join("/var/log/kylin-update-manager",name), log_dir)
if os.path.exists(self.KYLIN_SOFTWARE_PROPERTIES_LOG):
shutil.copy(self.KYLIN_SOFTWARE_PROPERTIES_LOG, log_dir)
if os.path.exists("/var/log/dpkg.log"):
shutil.copy("/var/log/dpkg.log", log_dir)
#get updater log
updater_path = os.path.join(log_dir,"kylin-system-updater")
os.makedirs(updater_path, exist_ok=True)
#get updater log
if os.path.exists("/var/log/kylin-system-updater/kylin-system-updater.log.1"):
shutil.copy("/var/log/kylin-system-updater/kylin-system-updater.log.1", log_dir)
if os.path.exists("/var/log/kylin-system-updater/kylin-system-updater.log.1.1.gz"):
shutil.copy("/var/log/kylin-system-updater/kylin-system-updater.log.1.1.gz", log_dir)
#get apt log
if os.path.exists("/var/log/apt/history.log"):
shutil.copy("/var/log/apt/history.log", log_dir)
if os.path.exists("/var/log/apt/term.log"):
shutil.copy("/var/log/apt/term.log", log_dir)
#get version file
if os.path.exists(self.SYSTEM_VERSION_PATH):
shutil.copy(self.SYSTEM_VERSION_PATH, log_dir)
gZipFile(log_dir, log_file_gzip)
header = {'Content-Type': "multipart/form-data", "Accept-Encoding": "gzip"}
try:
@ -545,7 +555,7 @@ class PHPServer(threading.Thread):
log_file_gzip = ""
kmg_tmp = {'ip': host_ip, 'version': version, 'soft_version': soft_version, 'datetime': nowtime,
'host_mac': host_mac, 'appname': self.appname, 'appversion': self.appversion, 'serial_number': key,
'status': self.status, 'filename': log_file_gzip, 'errorcode': self.errorcode}
'state': self.status, 'filename': log_file_gzip, 'errorcode': self.errorcode, 'errorstring': self.errorstring})
kmg = parse.urlencode(kmg_tmp)
logging.debug("PHPServer UpdateInfos: %s .", kmg_tmp)
# 优先使用内网服务器,再使用外网
@ -562,10 +572,9 @@ class PHPServer(threading.Thread):
if os.path.isfile(log_file_gzip):
os.remove(log_file_gzip)
def PHPSeverSend(_send_log = False, _appname="", _appversion="", _statue="", _errorcode=""):
if _send_log == True:
def PHPSeverSend(_appname="", _appversion="", _statue="", _errorcode="", _errorstring=""):
send_thread = PHPServer()
send_thread.get_values(_appname=_appname, _appversion=_appversion, _state=_statue, _errorcode=_errorcode)
send_thread.get_values(_appname=_appname, _appversion=_appversion, _state=_statue, _errorcode=_errorcode, _errorstring=_errorstring)
send_thread.start()
def gZipFile(src, dst):

View File

@ -221,6 +221,7 @@ class Sqlite3Server(object):
self._refresh_system_version(pkgversion)
#FIXME: 临时方案 PHP
<<<<<<< HEAD
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
with open(self.config_path + str(pkgname) + ".yaml", "r") as stream:
try:
@ -228,6 +229,9 @@ class Sqlite3Server(object):
changeLog = data_yaml['changelog']
except yaml.YAMLError as exc:
logging.error(exc)
=======
PHPSeverSend(_appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
>>>>>>> b16a730... 增加错误消息描述字段,
elif pkg_list:
changeLog = " "
# 单包更新 # 获取单包数据插入数据库
@ -278,7 +282,11 @@ class Sqlite3Server(object):
# 软件商店获取中文名
appname_cn = self.get_cn_appname(str(pkgname))
#FIXME: 临时方案 PHP
<<<<<<< HEAD
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100")
=======
PHPSeverSend(_appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
>>>>>>> b16a730... 增加错误消息描述字段,
try:
self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
# FIXME: 发送插入数据库成功的信号local_upgrade_list
@ -332,7 +340,11 @@ class Sqlite3Server(object):
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
#FIXME: 临时方案 PHP
<<<<<<< HEAD
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100")
=======
PHPSeverSend(_appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
>>>>>>> b16a730... 增加错误消息描述字段,
# insert group deb next
for i in pkg_group:
# FIXME: 获取组信息
@ -352,6 +364,7 @@ class Sqlite3Server(object):
InstallInfos.update({"new_version":str(pkgversion)})
InstallInfos.update({"status":status})
InstallInfos.update({"errorCode":str(error_string+" "+error_desc)})
<<<<<<< HEAD
self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy())
#FIXME: 临时方案 PHP
PHPSeverSend(_send_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100")
@ -362,6 +375,17 @@ class Sqlite3Server(object):
changeLog = data_yaml['changelog']
except yaml.YAMLError as exc:
logging.error(exc)
=======
json_file = json.dumps(InstallInfos.copy())
try:
self.window_main.collector.UpdateMsg("InstallInfos", json_file)
except:
pass
#FIXME: 临时方案 PHP
PHPSeverSend(_appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100", _errorstring=errstr)
>>>>>>> b16a730... 增加错误消息描述字段,
try:
self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn, status_cn, changeLog)
self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr)
@ -431,7 +455,7 @@ class Sqlite3Server(object):
# pkg missing from fresh_cache can't be modified
pass
return pkgs_install,pkgs_upgrade,pkgs_remove
#查找数据库
def find_msg_from_datebase(self, table, field, action = 'check', cid = 0):
# 查询数据

View File

@ -21,7 +21,7 @@ def get_logfile():
for i in os.listdir(path):
if "kylin-system-updater.log." in os.path.basename(path + i):
numlist.append((path + i).split(".")[2])
if get_FileSize(path + i) < 10:
if get_FileSize(path + i) < 100:
return path + i
#获取1-5未使用的最小数字的标号作为日志文件
for i in range(1, 6):

View File

@ -0,0 +1,10 @@
/var/log/kylin-system-updater/kylin-system-updater.log.1
{
daily
missingok
rotate 7
compress
notifempty
minsize 10k
copytruncate
}

View File

@ -13,6 +13,7 @@ backend/SystemUpdater/*.py /usr/share/kylin-system-updater/SystemUpdater/
backend/SystemUpdater/backend/*.py /usr/share/kylin-system-updater/SystemUpdater/backend/
backend/SystemUpdater/Core/*.py /usr/share/kylin-system-updater/SystemUpdater/Core/
backend/build/mo/* /usr/share/locale/
<<<<<<< HEAD
backend/data/system-updater-defaults.conf /var/lib/kylin-system-updater/
backend/data/system-updater-coverable.conf /var/lib/kylin-system-updater/
backend/data/unattended-upgrades-policy.conf /var/lib/unattended-upgrades/
@ -24,6 +25,19 @@ backend/kylin-upgrade-strategies /usr/share/kylin-system-updater/
backend/data/com.kylin.UpgradeStrategies.conf /etc/dbus-1/system.d/
backend/data/com.kylin.UpgradeStrategies.service /usr/share/dbus-1/system-services/
backend/data/cn.kylinos.UpgradeStrategies.policy /usr/share/polkit-1/actions/
=======
backend/data/system-updater.conf /var/lib/kylin-system-updater/
plugin/config_file/* /usr/share/ukui-control-center/upgrade/
plugin/translations/* /usr/share/Upgrade/translations/
plugin/libupgrade.so /usr/lib/
plugin/src/kylin-system-update.desktop /etc/xdg/autostart
plugin_2107/* /tmp
#notification
notification/kylin-updatefinish-notify.desktop /etc/xdg/autostart
notification/kylin-system-updater-notify.mo /usr/share/locale/zh_CN/LC_MESSAGES
kylin-updatefinish-notify /usr/bin
backend/data/kylin-system-updater /etc/logrotate.d
>>>>>>> b16a730... 增加错误消息描述字段,
#uu
unattended-upgrades/*.service /lib/systemd/system/