mirror of https://github.com/openspug/spug
U 优化文件过滤排除规则
parent
bdcf789ff8
commit
9aea33b52d
|
@ -90,7 +90,13 @@ def _ext1_deploy(req, helper, env):
|
||||||
files = helper.parse_filter_rule(filter_rule['data'])
|
files = helper.parse_filter_rule(filter_rule['data'])
|
||||||
if files:
|
if files:
|
||||||
if filter_rule['type'] == 'exclude':
|
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:
|
else:
|
||||||
contain = ' '.join(f'{env.SPUG_VERSION}/{x}' for x in files)
|
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}')
|
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':
|
if action['mode'] == '1':
|
||||||
contain = ' '.join(f'{sd_dst}/{x}' for x in files)
|
contain = ' '.join(f'{sd_dst}/{x}' for x in files)
|
||||||
else:
|
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'
|
tar_gz_file = f'{env.SPUG_VERSION}.tar.gz'
|
||||||
helper.local(f'cd {sp_dir} && tar zcf {tar_gz_file} {exclude} {contain}')
|
helper.local(f'cd {sp_dir} && tar zcf {tar_gz_file} {exclude} {contain}')
|
||||||
helper.send_info('local', '完成\r\n')
|
helper.send_info('local', '完成\r\n')
|
||||||
|
|
Loading…
Reference in New Issue