aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins/yabs_generate_conf.py
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-03-15 19:59:12 +0300
committeralexv-smirnov <alex@ydb.tech>2023-03-15 19:59:12 +0300
commit056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch)
tree4740980126f32e3af7937ba0ca5f83e59baa4ab0 /build/plugins/yabs_generate_conf.py
parent269126dcced1cc8b53eb4398b4a33e5142f10290 (diff)
downloadydb-056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11.tar.gz
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'build/plugins/yabs_generate_conf.py')
-rw-r--r--build/plugins/yabs_generate_conf.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/build/plugins/yabs_generate_conf.py b/build/plugins/yabs_generate_conf.py
new file mode 100644
index 0000000000..49e0982fdb
--- /dev/null
+++ b/build/plugins/yabs_generate_conf.py
@@ -0,0 +1,61 @@
+from _common import sort_by_keywords
+
+
+def get_or_default(kv, name, default):
+ if name in kv:
+ return kv[name][0]
+ return default
+
+
+def onyabs_generate_conf(unit, *args):
+ flat, kv = sort_by_keywords(
+ {'MODE': 1, 'SCRIPT': 1, 'SRC': 1, 'TOOL': 1, 'CONF_DIR': 1, 'DEST': 1}, args
+ )
+ src = get_or_default(kv, 'SRC', 'yabs/server/phantom')
+ mode = get_or_default(kv, 'MODE', 'production')
+
+ script = src + "/" + get_or_default(kv, 'SCRIPT', 'mkconf.py')
+ conf = src + "/" + get_or_default(kv, 'CONF_DIR', 'conf-tmpl')
+ tool = src + "/" + get_or_default(kv, 'TOOL', 'yabs_conf')
+
+ for name in flat:
+ filename = "/".join([conf, name])
+ unit.onpython([
+ script,
+ "--cluster-conf-binary", tool,
+ "--mode", mode,
+ "--dest-dir", "${BINDIR}",
+ filename,
+ "IN", filename,
+ "OUT_NOAUTO", "${BINDIR}/%s" % name,
+ "TOOL", tool
+ ])
+
+
+def onyabs_generate_phantom_conf_patch(unit, *args):
+ flat, kv = sort_by_keywords(
+ {'SRC': 1, 'DST': 1}, args
+ )
+ src = '${ARCADIA_BUILD_ROOT}/' + get_or_default(kv, 'SRC', 'yabs/server/phantom/conf')
+ dst = '${ARCADIA_BUILD_ROOT}/' + get_or_default(kv, 'DST', 'yabs/server/phantom/conf-test')
+ for f in flat:
+ lhs = src + '/' + f
+ rhs = dst + '/' + f
+ unit.onpython([
+ 'mkdiff.py',
+ lhs, rhs,
+ 'IN', lhs,
+ 'IN', rhs,
+ 'STDOUT', f + ".patch"
+ ])
+
+
+def onyabs_generate_phantom_conf_test_check(unit, *args):
+ yabs_path = args[0]
+ for name in args[1:]:
+ unit.onpython("""
+ build/scripts/wrapper.py mkcheckconf.sh ${{ARCADIA_BUILD_ROOT}}/{yabs_path}/phantom/conf-test/yabs-{role}.conf yabs-check-{role}.conf
+ IN mkcheckconf.sh ${{ARCADIA_BUILD_ROOT}}/{yabs_path}/phantom/conf-test/yabs-{role}.conf
+ OUT yabs-check-{role}.conf
+""".format(yabs_path=yabs_path, role=name).split() # noqa
+ )