1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-08-03 08:22:37 +03:00

build: preserve correct mode when generating files via jinja2

When using "capture : true" in custom_target()s the mode of the source
file is not preserved when the generated file is not installed and so
needs to be tweaked manually. Switch from output capture to creating the
target file and copy the permissions from the input file.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner
2021-11-05 14:29:53 +01:00
committed by Luca Boccassi
parent bf47f71c1c
commit a6d1760024
20 changed files with 26 additions and 41 deletions

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
import ast
import os
import re
import sys
@ -27,4 +28,8 @@ def render(filename, defines):
if __name__ == '__main__':
defines = parse_config_h(sys.argv[1])
print(render(sys.argv[2], defines))
output = render(sys.argv[2], defines)
with open(sys.argv[3], 'w') as f:
f.write(output)
info = os.stat(sys.argv[2])
os.chmod(sys.argv[3], info.st_mode)