Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanli
evm-store
Commits
2a306825
Commit
2a306825
authored
Aug 26, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat: 更新utils/epk.py
parent
ee4278d4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
backend/controller/apps_manager.py
backend/controller/apps_manager.py
+1
-1
backend/utils/epk.py
backend/utils/epk.py
+8
-3
No files found.
backend/controller/apps_manager.py
View file @
2a306825
...
...
@@ -343,6 +343,6 @@ class AppsManager(object):
with
open
(
os
.
sep
.
join
([
target_dir
,
"epk.json"
]),
"w"
)
as
f
:
json
.
dump
(
app
.
to_dict
(
exclude
=
[
"uuid"
,
"create_at"
,
"update_at"
,
"delete_at"
]),
f
)
return
{
'app_name'
:
app
.
app_name
,
'app_file'
:
"{}.epk"
.
format
(
app
.
app_name
),
'app_url'
:
parse
.
urljoin
(
config
[
'UPLOAD_SERVER'
],
epk_path
)
},
"application build {}."
.
format
(
"success"
if
app_info
else
"fail"
)
return
{
'app_name'
:
app
.
app_name
,
'app_file'
:
"{}.epk"
.
format
(
app
.
app_name
),
'
file_length'
:
app_info
.
get
(
"fileLength"
,
0
),
'
app_url'
:
parse
.
urljoin
(
config
[
'UPLOAD_SERVER'
],
epk_path
)
},
"application build {}."
.
format
(
"success"
if
app_info
else
"fail"
)
appsManager
=
AppsManager
()
backend/utils/epk.py
View file @
2a306825
...
...
@@ -65,6 +65,7 @@ class EpkApp(object):
self
.
_appName
=
appName
self
.
_appDir
=
os
.
path
.
abspath
(
appDir
)
self
.
algorithm
=
algorithm
self
.
fileLength
=
0
eprint
(
sys
.
argv
)
eprint
(
appName
)
eprint
(
appDir
)
...
...
@@ -106,7 +107,7 @@ class EpkApp(object):
fsize
=
jspath
.
info
.
size
fbasename
,
fext
=
os
.
path
.
splitext
(
jspath
.
info
.
name
)
if
fext
in
[
"
"
,
"
.exe"
,
".dll"
,
".nv"
,
".conf"
]:
if
fext
in
[
".exe"
,
".dll"
,
".nv"
,
".conf"
]:
continue
finfo
=
{
...
...
@@ -122,6 +123,7 @@ class EpkApp(object):
files
.
insert
(
0
,
finfo
)
else
:
files
.
append
(
finfo
)
if
fext
==
".evue"
:
self
.
fileMD5
(
finfo
)
...
...
@@ -143,9 +145,9 @@ class EpkApp(object):
filecontent
=
f
.
read
()
newmd5
=
self
.
md5
(
filecontent
)
with
open
(
md5path
,
"wb"
)
as
f
:
f
.
write
(
newmd5
)
return
newmd5
def
sign
(
self
,
content
):
...
...
@@ -187,10 +189,12 @@ class EpkApp(object):
fileBytes
+=
struct
.
pack
(
"<B"
,
len
(
_name
))
fileBytes
+=
struct
.
pack
(
"<
%
ds"
%
len
(
_name
),
fname
.
encode
(
"utf-8"
))
with
open
(
fpath
,
"rb"
)
as
fc
:
fileContentBytes
=
fc
.
read
()
eprint
(
info
[
"name"
])
eprint
(
len
(
fileContentBytes
))
self
.
fileLength
+=
len
(
fileContentBytes
)
fileBytes
+=
struct
.
pack
(
"<L"
,
len
(
fileContentBytes
))
if
fext
==
"md5"
:
...
...
@@ -250,7 +254,8 @@ class EpkApp(object):
"md5"
:
epkmd5Bytes
,
"raw_crc"
:
hex
(
crcBytes
),
"compress_level"
:
level
,
"buff_length"
:
len
(
epkFileBytes
)
"buff_length"
:
len
(
epkFileBytes
),
"fileLength"
:
self
.
fileLength
}
pprint
.
pprint
(
ret
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment