From 9aea33b52d3c7fbb649c2f538f7b88220de44aa7 Mon Sep 17 00:00:00 2001 From: vapao Date: Tue, 28 Jul 2020 20:31:02 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=92=E9=99=A4=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/deploy/utils.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/spug_api/apps/deploy/utils.py b/spug_api/apps/deploy/utils.py index 213d7e2..b78a6c1 100644 --- a/spug_api/apps/deploy/utils.py +++ b/spug_api/apps/deploy/utils.py @@ -90,7 +90,13 @@ def _ext1_deploy(req, helper, env): files = helper.parse_filter_rule(filter_rule['data']) if files: if filter_rule['type'] == 'exclude': - exclude = ' '.join(f'--exclude={env.SPUG_VERSION}/{x}' for x in files) + excludes = [] + for x in files: + if x.startswith('/'): + excludes.append(f'--exclude={env.SPUG_VERSION}{x}') + else: + excludes.append(f'--exclude={x}') + exclude = ' '.join(excludes) else: contain = ' '.join(f'{env.SPUG_VERSION}/{x}' for x in files) helper.local(f'cd {REPOS_DIR} && tar zcf {env.SPUG_VERSION}.tar.gz {exclude} {contain}') @@ -143,7 +149,13 @@ def _ext2_deploy(req, helper, env): if action['mode'] == '1': contain = ' '.join(f'{sd_dst}/{x}' for x in files) else: - exclude = ' '.join(f'--exclude={sd_dst}/{x}' for x in files) + excludes = [] + for x in files: + if x.startswith('/'): + excludes.append(f'--exclude={sd_dst}{x}') + else: + excludes.append(f'--exclude={x}') + exclude = ' '.join(excludes) tar_gz_file = f'{env.SPUG_VERSION}.tar.gz' helper.local(f'cd {sp_dir} && tar zcf {tar_gz_file} {exclude} {contain}') helper.send_info('local', '完成\r\n')