Commit d61fa286 authored by wanli's avatar wanli

update

parent 820e33b6
...@@ -21,4 +21,4 @@ backup_dir = backup ...@@ -21,4 +21,4 @@ backup_dir = backup
evueapps_dir = evueapps evueapps_dir = evueapps
launcher_dir = launcher launcher_dir = launcher
host = 127.0.0.1 host = 127.0.0.1
port = 5000 port = 5001
\ No newline at end of file \ No newline at end of file
...@@ -80,7 +80,8 @@ class AppsManager(object): ...@@ -80,7 +80,8 @@ class AppsManager(object):
app_info = epk.pack() 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('\\', '/') 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()) 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() commit()
...@@ -200,7 +201,7 @@ class AppsManager(object): ...@@ -200,7 +201,7 @@ class AppsManager(object):
temp.append(item.to_dict(only=["uuid", "app_name"])) temp.append(item.to_dict(only=["uuid", "app_name"]))
return temp, len(temp), "get app {}.".format("success" if temp else "fail") 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() count = Apps.select().where(**temp).count()
if result and len(result): if result and len(result):
......
...@@ -72,7 +72,8 @@ class BuildLogsManager(object): ...@@ -72,7 +72,8 @@ class BuildLogsManager(object):
params['algorithm'] = "h" params['algorithm'] = "h"
epk = EpkApp(**params) epk = EpkApp(**params)
app_info = epk.pack() 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: for sf in source_files:
......
...@@ -52,6 +52,10 @@ def str_to_bin(s): ...@@ -52,6 +52,10 @@ def str_to_bin(s):
def bin_to_str(s): def bin_to_str(s):
return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]]) 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): class EpkApp(object):
...@@ -61,10 +65,10 @@ class EpkApp(object): ...@@ -61,10 +65,10 @@ class EpkApp(object):
self._appName = appName self._appName = appName
self._appDir = os.path.abspath(appDir) self._appDir = os.path.abspath(appDir)
self.algorithm = algorithm self.algorithm = algorithm
print(sys.argv) eprint(sys.argv)
print(appName) eprint(appName)
print(appDir) eprint(appDir)
print(self._appDir) eprint(self._appDir)
self._appVersion = appVersion self._appVersion = appVersion
self._appCRCCode = None self._appCRCCode = None
self._files = [] self._files = []
...@@ -114,7 +118,7 @@ class EpkApp(object): ...@@ -114,7 +118,7 @@ class EpkApp(object):
} }
if self._infoPath == os.sep.join([path, fname]): if self._infoPath == os.sep.join([path, fname]):
print(finfo) eprint(finfo)
files.insert(0, finfo) files.insert(0, finfo)
else: else:
files.append(finfo) files.append(finfo)
...@@ -159,7 +163,7 @@ class EpkApp(object): ...@@ -159,7 +163,7 @@ class EpkApp(object):
md5 = hashlib.md5() #获取一个md5加密算法对象 md5 = hashlib.md5() #获取一个md5加密算法对象
md5.update(content) #指定需要加密的字符串 md5.update(content) #指定需要加密的字符串
newmd5 = md5.hexdigest() #获取加密后的16进制字符串 newmd5 = md5.hexdigest() #获取加密后的16进制字符串
print("md5 == ",newmd5) eprint("md5 == ",newmd5)
content = self.sign(newmd5) content = self.sign(newmd5)
ret = b"" ret = b""
...@@ -186,8 +190,8 @@ class EpkApp(object): ...@@ -186,8 +190,8 @@ class EpkApp(object):
fileBytes += struct.pack("<%ds" % len(_name), fname.encode("utf-8")) fileBytes += struct.pack("<%ds" % len(_name), fname.encode("utf-8"))
with open(fpath, "rb") as fc: with open(fpath, "rb") as fc:
fileContentBytes = fc.read() fileContentBytes = fc.read()
print(info["name"]) eprint(info["name"])
print(len(fileContentBytes)) eprint(len(fileContentBytes))
fileBytes += struct.pack("<L", len(fileContentBytes)) fileBytes += struct.pack("<L", len(fileContentBytes))
if fext == "md5": if fext == "md5":
...@@ -195,11 +199,11 @@ class EpkApp(object): ...@@ -195,11 +199,11 @@ class EpkApp(object):
else: else:
fileCompressBytes = self.compress()(fileContentBytes, level) fileCompressBytes = self.compress()(fileContentBytes, level)
print("===",fileCompressBytes[0]) eprint("===",fileCompressBytes[0])
print(fileCompressBytes) eprint(fileCompressBytes)
fileBytes += struct.pack("<L", len(fileCompressBytes)) fileBytes += struct.pack("<L", len(fileCompressBytes))
print(fileBytes) eprint(fileBytes)
fileBytes += fileCompressBytes fileBytes += fileCompressBytes
...@@ -212,6 +216,7 @@ class EpkApp(object): ...@@ -212,6 +216,7 @@ class EpkApp(object):
# infos = self.epkInfo() # infos = self.epkInfo()
epkFileBytes = b"" epkFileBytes = b""
ret = None
epkFileContentBytes = b"" epkFileContentBytes = b""
file_count = len(infos["files"]) file_count = len(infos["files"])
with open(self._epkName, "wb") as f: with open(self._epkName, "wb") as f:
...@@ -251,6 +256,8 @@ class EpkApp(object): ...@@ -251,6 +256,8 @@ class EpkApp(object):
pprint.pprint(ret) pprint.pprint(ret)
return ret
def main(path, appName, algorithm): def main(path, appName, algorithm):
epk = EpkApp(appName, path, 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