Commit d61fa286 authored by wanli's avatar wanli

update

parent 820e33b6
......@@ -21,4 +21,4 @@ backup_dir = backup
evueapps_dir = evueapps
launcher_dir = launcher
host = 127.0.0.1
port = 5000
\ No newline at end of file
port = 5001
\ No newline at end of file
......@@ -80,7 +80,8 @@ class AppsManager(object):
app_info = epk.pack()
epk_filename = os.sep.join([os.path.dirname(epk_path).replace(config.get("UPLOAD_PATH"), ""), "{}.epk".format(app.app_name)]).replace('\\', '/')
app_info['md5'] = str(app_info['md5'])
if app_info:
app_info['md5'] = str(app_info['md5'])
result = BuildLogs(app=app, app_path=epk_filename, app_info=app_info, create_by=editor, create_at=datetime.now(), update_by=editor, update_at=datetime.now())
commit()
......@@ -200,7 +201,7 @@ class AppsManager(object):
temp.append(item.to_dict(only=["uuid", "app_name"]))
return temp, len(temp), "get app {}.".format("success" if temp else "fail")
result = Apps.select().where(**temp).order_by(Apps.sort).page(data.get("pagenum", 1), pagesize=data.get("pagesize", 10))
result = Apps.select().where(**temp).order_by(Apps.sort).sort_by(desc(Apps.create_at)).page(data.get("pagenum", 1), pagesize=data.get("pagesize", 10))
count = Apps.select().where(**temp).count()
if result and len(result):
......
......@@ -72,7 +72,8 @@ class BuildLogsManager(object):
params['algorithm'] = "h"
epk = EpkApp(**params)
app_info = epk.pack()
app_info['md5'] = str(app_info['md5'])
if app_info:
app_info['md5'] = str(app_info['md5'])
# 更新数据库对应文件路径
for sf in source_files:
......
......@@ -52,6 +52,10 @@ def str_to_bin(s):
def bin_to_str(s):
return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]])
def eprint(*args, **kwargs):
# print(*args, **kwargs)
pass
class EpkApp(object):
......@@ -61,10 +65,10 @@ class EpkApp(object):
self._appName = appName
self._appDir = os.path.abspath(appDir)
self.algorithm = algorithm
print(sys.argv)
print(appName)
print(appDir)
print(self._appDir)
eprint(sys.argv)
eprint(appName)
eprint(appDir)
eprint(self._appDir)
self._appVersion = appVersion
self._appCRCCode = None
self._files = []
......@@ -114,7 +118,7 @@ class EpkApp(object):
}
if self._infoPath == os.sep.join([path, fname]):
print(finfo)
eprint(finfo)
files.insert(0, finfo)
else:
files.append(finfo)
......@@ -159,7 +163,7 @@ class EpkApp(object):
md5 = hashlib.md5() #获取一个md5加密算法对象
md5.update(content) #指定需要加密的字符串
newmd5 = md5.hexdigest() #获取加密后的16进制字符串
print("md5 == ",newmd5)
eprint("md5 == ",newmd5)
content = self.sign(newmd5)
ret = b""
......@@ -186,8 +190,8 @@ class EpkApp(object):
fileBytes += struct.pack("<%ds" % len(_name), fname.encode("utf-8"))
with open(fpath, "rb") as fc:
fileContentBytes = fc.read()
print(info["name"])
print(len(fileContentBytes))
eprint(info["name"])
eprint(len(fileContentBytes))
fileBytes += struct.pack("<L", len(fileContentBytes))
if fext == "md5":
......@@ -195,11 +199,11 @@ class EpkApp(object):
else:
fileCompressBytes = self.compress()(fileContentBytes, level)
print("===",fileCompressBytes[0])
print(fileCompressBytes)
eprint("===",fileCompressBytes[0])
eprint(fileCompressBytes)
fileBytes += struct.pack("<L", len(fileCompressBytes))
print(fileBytes)
eprint(fileBytes)
fileBytes += fileCompressBytes
......@@ -212,6 +216,7 @@ class EpkApp(object):
# infos = self.epkInfo()
epkFileBytes = b""
ret = None
epkFileContentBytes = b""
file_count = len(infos["files"])
with open(self._epkName, "wb") as f:
......@@ -251,6 +256,8 @@ class EpkApp(object):
pprint.pprint(ret)
return ret
def main(path, appName, algorithm):
epk = EpkApp(appName, path, algorithm)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment