Commit 85ef596e authored by 张永's avatar 张永

修改上传逻辑

parent 637cf7cd
...@@ -50,7 +50,7 @@ def channel_build(version=None, channels=None, data=None, ): ...@@ -50,7 +50,7 @@ def channel_build(version=None, channels=None, data=None, ):
return return
info_logger.debug(channels) info_logger.debug(channels)
chn_pkg = ChannelPackage(data, version) chn_pkg = ChannelPackage(target_path, version)
# 遍历渠道号并创建对应渠道号的apk文件 # 遍历渠道号并创建对应渠道号的apk文件
for channel in channels: for channel in channels:
build_one_channel(chn_pkg, channel) build_one_channel(chn_pkg, channel)
......
...@@ -45,35 +45,29 @@ class ChannelPackage(object): ...@@ -45,35 +45,29 @@ class ChannelPackage(object):
self.apk = None self.apk = None
@classmethod @classmethod
def get_parent_path(cls, data): def get_parent_path(cls, data): # 母包地址
path = os.getcwd() + '/' + cls.channel_prefix + '_parent.apk' path = os.getcwd() + '/' + cls.channel_prefix + '.apk'
with open(path, 'wb')as fw: with open(path, 'wb')as fw:
fw.write(data) fw.write(data)
return path return path
def build_channel_apk(self, channel_name): def build_channel_apk(self, channel_name):
cp = re.compile(r'[^{}]+') cp = re.compile(r'[^{}]+')
self.apk = self.channel_prefix + '.apk'
walle_cli_path = os.getcwd() + '/walle-cli-all.jar' walle_cli_path = os.getcwd() + '/walle-cli-all.jar'
with open(self.apk, 'wb') as fw: os.system('java -jar {0} batch -c {1} {2}'.format(walle_cli_path, channel_name, self.apk_data))
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()
targe_apk = self.channel_prefix + '_' + channel_name + '.apk' targe_apk = self.channel_prefix + '_' + channel_name + '.apk'
cmd_res = os.popen('java -jar walle-cli-all.jar show %s' % targe_apk) cmd_res = os.popen('java -jar walle-cli-all.jar show %s' % targe_apk)
ret_res = cmd_res.readlines()[0] ret_res = cmd_res.readlines()[0]
target_channel_info = cp.findall(ret_res)[1] target_channel_info = cp.findall(ret_res)[1]
if target_channel_info and channel_name == target_channel_info.split('=')[1]: if target_channel_info and channel_name == target_channel_info.split('=')[1]:
target_path = self.channel_prefix + '_' + channel_name + '.apk' target_path = self.channel_prefix + '_' + channel_name + '.apk'
os.remove(self.apk)
return target_path return target_path
else: else:
log_error() log_error()
os.remove(self.apk) os.remove(self.apk)
os.remove(self.channel_prefix + '_' + channel_name + '.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) chn_apk_path = self.build_channel_apk(channel_name)
apk_uri = self.apk_key(channel_name, self.version) apk_uri = self.apk_key(channel_name, self.version)
QiniuTool.delete(apk_uri, settings.APK_SCOPE) 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