diff options
author | svidyuk <svidyuk@yandex-team.com> | 2024-06-21 20:03:31 +0300 |
---|---|---|
committer | svidyuk <svidyuk@yandex-team.com> | 2024-06-21 20:15:32 +0300 |
commit | 0315d1b8954957ef30b3f1a90a8db2b49bcd1a5a (patch) | |
tree | 876198cbfabfd417570f6edb378304fe1e98c233 /build/scripts | |
parent | 3cdeda6fa6a035965e143abf6c6972c912707bef (diff) | |
download | ydb-0315d1b8954957ef30b3f1a90a8db2b49bcd1a5a.tar.gz |
Move sbom_link script out of opensource synced paths
Conf part is internal and the script is never used in opensource
no need to publish it.
ded65be538ce345af34c8ca0ffe557bfeb7e3818
Diffstat (limited to 'build/scripts')
-rw-r--r-- | build/scripts/link_sbom.py | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/build/scripts/link_sbom.py b/build/scripts/link_sbom.py deleted file mode 100644 index 5084762d8a..0000000000 --- a/build/scripts/link_sbom.py +++ /dev/null @@ -1,68 +0,0 @@ -import argparse -import json -import os - - -def parse_kv_arr(val): - res = {} - for kv in val.split(';'): - k, v = kv.split('=') - res[k] = v - return res - - -def deduce_name(path): - name = os.path.basename(path) - for prefix in ['contrib/libs/', 'contrib/python/py2/', 'contrib/python/py3/', 'contrib/python/']: - if path.startswith(prefix): - name = path[len(prefix):].replace('/', '-') - break - return name - - -def parse_componenet(component): - props = parse_kv_arr(component) - path = props['path'] - ver = props['ver'] - - res = {} - res['type'] = 'library' - res['name'] = deduce_name(path) - res['version'] = ver - res["properties"] = [ - {'name': 'arcadia_module_subdir', 'value': path}, - {'name': 'language', 'value': props['lang']} - ] - return res - - -def main(): - parser = argparse.ArgumentParser(description='Generate SBOM data from used contribs info') - parser.add_argument('-o', '--output', type=argparse.FileType('w', encoding='UTF-8'), help='resulting SBOM file', required=True) - parser.add_argument('--vcs-info', type=argparse.FileType('r', encoding='UTF-8'), help='VCS information file', required=True) - parser.add_argument('--mod-path', type=str, help='Path to module in arcadia', required=True) - parser.add_argument('libinfo', metavar='N', type=str, nargs='*', help='libraries info for components section') - - args = parser.parse_args() - - vcs = json.load(args.vcs_info) - - res = {} - res['$schema'] = "http://cyclonedx.org/schema/bom-1.5.schema.json" - res["bomFormat"] = "CycloneDX" - res["specVersion"] = "1.5" - res["version"] = 1 - res["components"] = [parse_componenet(lib) for lib in args.libinfo] - res["properties"] = [ - {'name': 'commit_hash', 'value': vcs['ARCADIA_SOURCE_HG_HASH']}, - {'name': 'arcadia_module_subdir', 'value': args.mod_path} - ] - if vcs.get('DIRTY', '') == 'dirty': - res["properties"].append({'name': 'has_uncommited_changes', 'value': True}) - - json.dump(res, args.output) - args.output.close() - - -if __name__ == '__main__': - main() |