Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
android-package
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
周烽
android-package
Commits
e7eff1d2
Commit
e7eff1d2
authored
Dec 11, 2018
by
徐晗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first
parents
Pipeline
#86666
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
135 additions
and
0 deletions
+135
-0
package.py
package.py
+135
-0
No files found.
package.py
0 → 100644
View file @
e7eff1d2
import
os
import
sys
import
pexpect
import
requests
enviorments
=
[
"debug"
,
"intranettest"
,
"outnettest"
,
"preonline"
,
"release"
]
jiagu_username
=
"tiantianquwen@qq.com"
jiagu_psd
=
"tiantianquwen2018"
keyAlias
=
"kAlias-TUIA-312214"
keyPassword
=
"kPwd-TUIA-756658"
storePassword
=
"store-TUIA-201103"
jiagu_path
=
"./360jiagu/"
path
=
"./"
download_path
=
"/Library/WebServer/Documents/download/"
test_upload_url
=
"http://10.254.221.103:3344/apk/upload"
prod_upload_url
=
"http://10.254.71.106:3344/apk/upload"
def
get_arg
(
arg_dict
,
key
,
default_value
):
if
key
not
in
arg_dict
:
return
default_value
return
arg_dict
[
key
]
if
__name__
==
'__main__'
:
argv
=
sys
.
argv
if
len
(
argv
)
<
4
:
print
(
"param error!"
)
exit
(
-
1
)
environment
=
argv
[
1
]
channel
=
argv
[
2
]
apk_name
=
argv
[
3
]
if
len
(
apk_name
)
==
len
(
".apk"
):
apk_name
=
environment
+
"-"
+
channel
+
".apk"
arg_dict
=
{}
if
len
(
argv
)
>
6
:
for
arg
in
argv
:
if
"="
not
in
arg
:
continue
split
=
arg
.
split
(
"="
)
arg_dict
[
split
[
0
]]
=
split
[
1
]
# if environment not in enviorments:
# print(environment + " not valid!\n")
# exit(-1)
command
=
"cd "
+
path
+
"
\n
gradle clean assemble"
+
\
environment
.
capitalize
()
+
" -PCHANNEL_CODE="
+
channel
# print("开始打包...........\n")
# os.system(command)
# print("打包完成...........\n")
command
=
"find "
+
path
+
"app/build/outputs -name '*.apk' | grep tuia-android-news"
apk_path
=
str
(
os
.
popen
(
command
)
.
read
())
.
replace
(
"
\n
"
,
""
)
if
len
(
apk_path
)
==
0
:
print
(
"package error!
\n
"
)
exit
(
-
1
)
is_upload
=
get_arg
(
arg_dict
,
"upload"
,
"no"
)
if
is_upload
==
"yes"
:
# 加固登录
command
=
"sudo java -jar "
+
jiagu_path
+
\
"/jiagu.jar -login "
+
jiagu_username
+
" "
+
jiagu_psd
os
.
system
(
command
)
# 加固
command
=
"sudo java -jar "
+
jiagu_path
+
\
"/jiagu.jar -jiagu "
+
apk_path
+
" "
+
path
os
.
system
(
command
)
command
=
"find "
+
path
+
" -name '*.apk' | grep jiagu"
apk_path
=
str
(
os
.
popen
(
command
)
.
read
())
.
replace
(
"
\n
"
,
""
)
if
len
(
apk_name
)
==
0
:
print
(
"can not find apk
\n
"
)
exit
(
-
1
)
jkl_path
=
path
+
"/app/funNewsKey.jks"
command
=
"jarsigner -digestalg SHA1 -sigalg SHA1withRSA -verbose -keystore "
+
jkl_path
+
\
" -signedjar "
+
path
+
"/"
+
"jiagu.apk"
+
\
" "
+
apk_path
+
" "
+
keyAlias
+
"
\n
"
child
=
pexpect
.
spawn
(
command
)
child
.
expect
(
".*"
)
child
.
sendline
(
storePassword
)
child
.
expect
(
".*"
)
child
.
sendline
(
keyPassword
)
child
.
expect
(
pexpect
.
EOF
)
apk_path
=
path
+
"jiagu.apk"
# 上传至oss
version
=
get_arg
(
arg_dict
,
"version"
,
"normal"
)
force_upload
=
get_arg
(
arg_dict
,
"force"
,
"no"
)
oss_dir
=
"download/"
+
version
+
"/"
+
channel
data
=
{
'enctype'
:
'multipart/form-data'
,
'dir'
:
oss_dir
,
'fileName'
:
apk_name
,
'force'
:
force_upload
==
"yes"
}
files
=
{
'file'
:
open
(
apk_path
,
'rb'
)}
if
environment
==
'release'
or
environment
==
'Release'
:
url
=
prod_upload_url
else
:
url
=
test_upload_url
response
=
requests
.
post
(
url
,
data
=
data
,
files
=
files
)
download_url
=
response
.
text
if
"http"
in
download_url
:
success
=
True
else
:
success
=
False
# 返回下载链接
os
.
system
(
"echo "
+
response
.
text
)
# 将文件放到下载服务器下
command
=
"sudo cp "
+
apk_path
+
" "
+
download_path
+
apk_name
os
.
system
(
command
)
os
.
system
(
"echo http://172.16.71.249/download/"
+
apk_name
)
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