Commit b1dc2f80 authored by 张永's avatar 张永

Merge branch 'feature/channel_package_zy' into 'dev'

修改上传逻辑

See merge request alpha/sun!82
parents 28e0909c 85ef596e
......@@ -50,7 +50,7 @@ def channel_build(version=None, channels=None, data=None, ):
return
info_logger.debug(channels)
chn_pkg = ChannelPackage(data, version)
chn_pkg = ChannelPackage(target_path, version)
# 遍历渠道号并创建对应渠道号的apk文件
for channel in channels:
build_one_channel(chn_pkg, channel)
......
......@@ -45,35 +45,29 @@ class ChannelPackage(object):
self.apk = None
@classmethod
def get_parent_path(cls, data):
path = os.getcwd() + '/' + cls.channel_prefix + '_parent.apk'
def get_parent_path(cls, data): # 母包地址
path = os.getcwd() + '/' + cls.channel_prefix + '.apk'
with open(path, 'wb')as fw:
fw.write(data)
return path
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'
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))
# with open(self.channel_prefix + '_' + channel_name + '.apk', 'rb') as fr:
# data = fr.read()
os.system('java -jar {0} batch -c {1} {2}'.format(walle_cli_path, channel_name, self.apk_data))
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()
os.remove(self.apk)
os.remove(self.channel_prefix + '_' + channel_name + '.apk')
def upload_apk(self, channel_name):# zhuoyi
def upload_apk(self, channel_name):
chn_apk_path = self.build_channel_apk(channel_name)
apk_uri = self.apk_key(channel_name, self.version)
QiniuTool.delete(apk_uri, settings.APK_SCOPE)
......
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