0 Star 0 Fork 27

Liquor/cloud-init

forked from src-openEuler/cloud-init 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
add-variable-to-forbid-tmp-dir.patch 2.05 KB
一键复制 编辑 原始数据 按行查看 历史
Liquor 提交于 2020-07-31 15:06 . update to 19.4
From 224da46b2331b582577b86c3eb707f67d57800fb Mon Sep 17 00:00:00 2001
From: chengquan <chengquan3@huawei.com>
Date: Thu, 8 Aug 2019 16:15:31 +0800
Subject: [PATCH] cloud-init: add variable to forbid tmp dir
reason: add variable to forbid temporary directory
Signed-off-by: chengquan <chengquan3@huawei.com>
---
cloud-init-19.4/setup.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff -Nur a/setup.py b/setup.py
--- a/setup.py 2019-04-12 19:00:20.782000000 +0800
+++ b/setup.py 2019-04-12 19:48:04.246000000 +0800
@@ -91,6 +91,8 @@
(deps, _e) = tiny_p(cmd)
return str(deps).splitlines()
+# add variable to forbid tmp dir
+num = 0
def render_tmpl(template, mode=None):
"""render template into a tmpdir under same dir as setup.py
@@ -112,7 +114,10 @@
return template
topdir = os.path.dirname(sys.argv[0])
- tmpd = tempfile.mkdtemp(dir=topdir, prefix=RENDERED_TMPD_PREFIX)
+ global num
+ os.mkdir(topdir + str(num))
+ tmpd = os.path.abspath(topdir + str(num))
+ num = num + 1
atexit.register(shutil.rmtree, tmpd)
bname = os.path.basename(template).rstrip(tmpl_ext)
fpath = os.path.join(tmpd, bname)
@@ -126,6 +131,10 @@
# return path relative to setup.py
return os.path.join(os.path.basename(tmpd), bname)
+def sort_files(file_list):
+ file_list.sort()
+ return file_list
+
# User can set the variant for template rendering
if '--distro' in sys.argv:
idx = sys.argv.index('--distro')
@@ -140,9 +149,9 @@
'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)],
'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)],
'systemd': [render_tmpl(f)
- for f in (glob('systemd/*.tmpl') +
+ for f in sort_files((glob('systemd/*.tmpl') +
glob('systemd/*.service') +
- glob('systemd/*.target'))
+ glob('systemd/*.target')))
if (is_f(f) and not is_generator(f))],
'systemd.generators': [
render_tmpl(f, mode=0o755)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liquor1/cloud-init.git
git@gitee.com:liquor1/cloud-init.git
liquor1
cloud-init
cloud-init
master

搜索帮助