aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins
diff options
context:
space:
mode:
authorspreis <spreis@yandex-team.com>2023-10-25 10:17:00 +0300
committerspreis <spreis@yandex-team.com>2023-10-25 10:36:47 +0300
commitb82ee322906e7eec3dc912025458347b871d4ab0 (patch)
treeb35e2c4dc97848fcdeb30581aa08e33d0a36c8af /build/plugins
parenta13962045e5307dc6ab38d061e75b1f518a8ae29 (diff)
downloadydb-b82ee322906e7eec3dc912025458347b871d4ab0.tar.gz
Dismantle FROM_EXTERNAL, process .external file in plugin
Diffstat (limited to 'build/plugins')
-rw-r--r--build/plugins/large_files.py30
-rw-r--r--build/plugins/ytest.py3
2 files changed, 27 insertions, 6 deletions
diff --git a/build/plugins/large_files.py b/build/plugins/large_files.py
index 568e294253..308dc82075 100644
--- a/build/plugins/large_files.py
+++ b/build/plugins/large_files.py
@@ -1,6 +1,7 @@
+import json
import os
import ymake
-from _common import strip_roots
+from _common import strip_roots, resolve_common_const
PLACEHOLDER_EXT = "external"
@@ -31,10 +32,27 @@ def onlarge_files(unit, *args):
unit.message(["warn", msg])
unit.oncopy_file([arg, arg])
else:
- out_file = strip_roots(os.path.join(unit.path(), arg))
external = "{}.{}".format(arg, PLACEHOLDER_EXT)
- from_external_cmd = [external, out_file, 'OUT_NOAUTO', arg]
+ rel_placeholder = resolve_common_const(unit.resolve_arc_path(external))
+ if not rel_placeholder.startswith("$S"):
+ ymake.report_configure_error('LARGE_FILES: neither actual data nor placeholder is found for "{}"'.format(arg))
+ return
+ try:
+ abs_placeholder = unit.resolve(rel_placeholder)
+ with open(abs_placeholder, "r") as f:
+ res_desc = json.load(f)
+ storage = res_desc["storage"]
+ res_id = res_desc["resource_id"]
+ except e:
+ ymake.report_configure_error('LARGE_FILES: error processing placeholder file "{}.": {}'.format(external, e))
+ return
+
+ from_cmd = ['FILE', '{}'.format(res_id), 'OUT_NOAUTO', arg, 'EXTERNAL_FILE', external]
if os.path.dirname(arg):
- from_external_cmd.extend(("RENAME", os.path.basename(arg)))
- unit.on_from_external(from_external_cmd)
- unit.onadd_check(['check.external', external])
+ from_cmd.extend(("RENAME", os.path.basename(arg)))
+
+ method = getattr(unit, 'onfrom_{}'.format(storage.lower()), None)
+ if method:
+ method(from_cmd)
+ else:
+ ymake.report_configure_error('LARGE_FILES: error processing placeholder file "{}.": unknown storage kind "{}"'.format(external, storage))
diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py
index 506466f355..9785684a49 100644
--- a/build/plugins/ytest.py
+++ b/build/plugins/ytest.py
@@ -624,6 +624,9 @@ def onadd_check(unit, *args):
if check_type in ("check.data", "check.resource") and unit.get('VALIDATE_DATA') == "no":
return
+ if check_type == "check.external" and (len(flat_args) == 1 or not flat_args[1]):
+ return
+
test_dir = _common.get_norm_unit_path(unit)
test_timeout = ''