Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
alpha
sun
Commits
5abda5d0
Commit
5abda5d0
authored
Mar 05, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改apk上传逻辑
parent
85ef596e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
tasks.py
api/tasks/tasks.py
+3
-2
channel_package_tools.py
utils/channel_package_tools.py
+5
-1
No files found.
api/tasks/tasks.py
View file @
5abda5d0
...
...
@@ -34,7 +34,8 @@ def version_release_task(packed_channels, version_id=None, version=None): # 一
@shared_task
def
channel_build_one
(
version
=
None
,
channel
=
None
,
data
=
None
):
url
=
ChannelPackage
.
apk_url
(
''
,
version
)
r
=
requests
.
get
(
url
)
r
=
requests
.
get
(
url
,
stream
=
True
)
info_logger
.
debug
(
url
)
chn_pkg
=
ChannelPackage
(
r
.
content
,
version
)
build_one_channel
(
chn_pkg
,
channel
)
...
...
@@ -50,7 +51,7 @@ def channel_build(version=None, channels=None, data=None, ):
return
info_logger
.
debug
(
channels
)
chn_pkg
=
ChannelPackage
(
target_path
,
version
)
chn_pkg
=
ChannelPackage
(
data
,
version
)
# 遍历渠道号并创建对应渠道号的apk文件
for
channel
in
channels
:
build_one_channel
(
chn_pkg
,
channel
)
...
...
utils/channel_package_tools.py
View file @
5abda5d0
...
...
@@ -53,14 +53,18 @@ class ChannelPackage(object):
def
build_channel_apk
(
self
,
channel_name
):
cp
=
re
.
compile
(
r'[^{}]+'
)
self
.
apk
=
self
.
channel_prefix
+
'.apk'
walle_cli_path
=
os
.
getcwd
()
+
'/walle-cli-all.jar'
os
.
system
(
'java -jar {0} batch -c {1} {2}'
.
format
(
walle_cli_path
,
channel_name
,
self
.
apk_data
))
with
open
(
self
.
apk
,
'wb'
)
as
fw
:
fw
.
write
(
self
.
apk_data
)
os
.
system
(
'java -jar {0} batch -c {1} {2}'
.
format
(
walle_cli_path
,
channel_name
,
self
.
apk
))
targe_apk
=
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
cmd_res
=
os
.
popen
(
'java -jar walle-cli-all.jar show
%
s'
%
targe_apk
)
ret_res
=
cmd_res
.
readlines
()[
0
]
target_channel_info
=
cp
.
findall
(
ret_res
)[
1
]
if
target_channel_info
and
channel_name
==
target_channel_info
.
split
(
'='
)[
1
]:
target_path
=
self
.
channel_prefix
+
'_'
+
channel_name
+
'.apk'
os
.
remove
(
self
.
apk
)
return
target_path
else
:
log_error
()
...
...
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