diff options
author | kakabba <kakabba@yandex-team.ru> | 2022-02-10 16:46:04 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:04 +0300 |
commit | 9c914f41ba5e9f9365f404e892197553ac23809e (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /build/scripts | |
parent | c8e3995898c443e78266f7420aac5fb3da15d413 (diff) | |
download | ydb-9c914f41ba5e9f9365f404e892197553ac23809e.tar.gz |
Restoring authorship annotation for <kakabba@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/scripts')
-rw-r--r-- | build/scripts/_check_compiler.cpp | 2 | ||||
-rwxr-xr-x | build/scripts/build_mn.py | 54 | ||||
-rw-r--r-- | build/scripts/c_templates/svn_interface.c | 18 | ||||
-rw-r--r-- | build/scripts/c_templates/svnversion.h | 2 | ||||
-rwxr-xr-x | build/scripts/cat.py | 4 | ||||
-rw-r--r-- | build/scripts/copy_to_dir.py | 42 | ||||
-rw-r--r-- | build/scripts/link_dyn_lib.py | 6 | ||||
-rw-r--r-- | build/scripts/link_fat_obj.py | 16 | ||||
-rw-r--r-- | build/scripts/link_lib.py | 108 | ||||
-rw-r--r-- | build/scripts/run_llvm_dsymutil.py | 12 | ||||
-rw-r--r-- | build/scripts/run_msvc_wine.py | 60 | ||||
-rwxr-xr-x | build/scripts/run_tool.py | 2 | ||||
-rw-r--r-- | build/scripts/vcs_info.py | 6 |
13 files changed, 166 insertions, 166 deletions
diff --git a/build/scripts/_check_compiler.cpp b/build/scripts/_check_compiler.cpp index dd9dd73067..53c5fdf179 100644 --- a/build/scripts/_check_compiler.cpp +++ b/build/scripts/_check_compiler.cpp @@ -1 +1 @@ -#include <stdio.h> +#include <stdio.h> diff --git a/build/scripts/build_mn.py b/build/scripts/build_mn.py index b0cc12ed3a..5bb03c247c 100755 --- a/build/scripts/build_mn.py +++ b/build/scripts/build_mn.py @@ -5,7 +5,7 @@ import sys import os import shutil import re -import subprocess +import subprocess def get_value(val): @@ -78,30 +78,30 @@ class BuildMnBase(object): class BuildMn(BuildMnBase): def Run(self, argv): - if len(argv) < 6: - print >>sys.stderr, "BuildMn.Run(<ARCADIA_ROOT> <archiver> <mninfo> <mnname> <mnrankingSuffix> <cppOutput> [params...])" + if len(argv) < 6: + print >>sys.stderr, "BuildMn.Run(<ARCADIA_ROOT> <archiver> <mninfo> <mnname> <mnrankingSuffix> <cppOutput> [params...])" sys.exit(1) self.SrcRoot = argv[0] self.archiver = argv[1] - mninfo = argv[2] - mnname = argv[3] - mnrankingSuffix = argv[4] - mncppPath = argv[5] + mninfo = argv[2] + mnname = argv[3] + mnrankingSuffix = argv[4] + mncppPath = argv[5] check = False ptr = False multi = False - self.fml_unused_tool = '' - for param in argv[6:]: + self.fml_unused_tool = '' + for param in argv[6:]: if param == "CHECK": check = True elif param == "PTR": ptr = True elif param == "MULTI": multi = True - elif param.startswith('fml_tool='): - self.fml_unused_tool = get_value(param) + elif param.startswith('fml_tool='): + self.fml_unused_tool = get_value(param) else: print >>sys.stdout, "Unknown param: {0}".format(param) super(BuildMn, self).Run(mninfo, mnname, mnrankingSuffix, mncppPath, check=check, ptr=ptr, multi=multi) @@ -122,29 +122,29 @@ class BuildMns(BuildMnBase): self.mnmultilist = "const {0} {1}".format(mnmultilisttype, self.mnmultilistname) def InitForAll(self, argv): - if len(argv) < 8: - print >>sys.stderr, "BuildMns.InitForAll(<ARCADIA_ROOT> <BINDIR> <archiver> <listname> <mnranking_suffix> <hdrfile> <srcfile> <mninfos> [fml_tool=<fml_unused_tool> CHECK])" + if len(argv) < 8: + print >>sys.stderr, "BuildMns.InitForAll(<ARCADIA_ROOT> <BINDIR> <archiver> <listname> <mnranking_suffix> <hdrfile> <srcfile> <mninfos> [fml_tool=<fml_unused_tool> CHECK])" sys.exit(1) bmns_args = [] self.check = False - self.fml_unused_tool = '' + self.fml_unused_tool = '' for arg in argv: if arg == "CHECK": self.check = True - elif arg.startswith('fml_tool='): - self.fml_unused_tool = get_value(arg) + elif arg.startswith('fml_tool='): + self.fml_unused_tool = get_value(arg) else: bmns_args.append(arg) self.SrcRoot = bmns_args[0] self.BINDIR = bmns_args[1] self.archiver = bmns_args[2] - self.listname = bmns_args[3] - self.mnrankingSuffix = get_value(bmns_args[4]) - self.hdrfile = bmns_args[5] - self.srcfile = bmns_args[6] - self.mninfos = bmns_args[7:] + self.listname = bmns_args[3] + self.mnrankingSuffix = get_value(bmns_args[4]) + self.hdrfile = bmns_args[5] + self.srcfile = bmns_args[6] + self.mninfos = bmns_args[7:] self.InitBase(self.listname, self.mnrankingSuffix) @@ -180,21 +180,21 @@ class BuildMns(BuildMnBase): bmns_args = [] self.check = False - self.fml_unused_tool = '' + self.fml_unused_tool = '' for arg in argv: if arg == "CHECK": self.check = True - elif arg.startswith('fml_tool='): - self.fml_unused_tool = get_value(arg) + elif arg.startswith('fml_tool='): + self.fml_unused_tool = get_value(arg) else: bmns_args.append(arg) self.SrcRoot = bmns_args[0] self.BINDIR = bmns_args[1] self.archiver = bmns_args[2] - self.listname = bmns_args[3] - self.mnrankingSuffix = get_value(bmns_args[4]) - self.mninfos = bmns_args[5:] + self.listname = bmns_args[3] + self.mnrankingSuffix = get_value(bmns_args[4]) + self.mninfos = bmns_args[5:] def BuildMnsHeader(self): if self.mninfos: diff --git a/build/scripts/c_templates/svn_interface.c b/build/scripts/c_templates/svn_interface.c index af08627865..d8bdd1a70d 100644 --- a/build/scripts/c_templates/svn_interface.c +++ b/build/scripts/c_templates/svn_interface.c @@ -142,15 +142,15 @@ const char* GetProgramBuildDate() { #endif } -int GetProgramBuildTimestamp() { -#if defined(BUILD_TIMESTAMP) - return BUILD_TIMESTAMP; -#else - return 0; -#endif -} - - +int GetProgramBuildTimestamp() { +#if defined(BUILD_TIMESTAMP) + return BUILD_TIMESTAMP; +#else + return 0; +#endif +} + + const char* GetVCS() { #if defined(VCS) return VCS; diff --git a/build/scripts/c_templates/svnversion.h b/build/scripts/c_templates/svnversion.h index 71a950125f..7aece931aa 100644 --- a/build/scripts/c_templates/svnversion.h +++ b/build/scripts/c_templates/svnversion.h @@ -32,7 +32,7 @@ const char* GetProgramShortVersionData() Y_HIDDEN; const char* GetProgramBuildUser() Y_HIDDEN; const char* GetProgramBuildHost() Y_HIDDEN; const char* GetProgramBuildDate() Y_HIDDEN; -int GetProgramBuildTimestamp() Y_HIDDEN; +int GetProgramBuildTimestamp() Y_HIDDEN; const char* GetVCS() Y_HIDDEN; const char* GetBranch() Y_HIDDEN; const char* GetTag() Y_HIDDEN; diff --git a/build/scripts/cat.py b/build/scripts/cat.py index 8d83194263..0c3f73d96f 100755 --- a/build/scripts/cat.py +++ b/build/scripts/cat.py @@ -1,13 +1,13 @@ #!/usr/bin/env python import sys from shutil import copyfileobj as copy -import os.path +import os.path if __name__ == '__main__': for filename in sys.argv[1:] or ["-"]: if filename == "-": copy(sys.stdin, sys.stdout) - else: + else: if os.path.exists(filename): with open(filename, 'rb') as file: copy(file, sys.stdout) diff --git a/build/scripts/copy_to_dir.py b/build/scripts/copy_to_dir.py index de2e420c6a..9baeb5ffac 100644 --- a/build/scripts/copy_to_dir.py +++ b/build/scripts/copy_to_dir.py @@ -1,11 +1,11 @@ -import errno -import sys -import os -import shutil +import errno +import sys +import os +import shutil import optparse import tarfile - - + + def parse_args(): parser = optparse.OptionParser() parser.add_option('--build-root') @@ -15,15 +15,15 @@ def parse_args(): def ensure_dir_exists(path): - try: - os.makedirs(path) - except OSError as e: - if e.errno == errno.EEXIST and os.path.isdir(path): - pass - else: - raise - - + try: + os.makedirs(path) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(path): + pass + else: + raise + + def hardlink_or_copy(src, dst): if os.name == 'nt': shutil.copy(src, dst) @@ -40,7 +40,7 @@ def hardlink_or_copy(src, dst): raise -def main(): +def main(): opts, args = parse_args() assert opts.build_root assert opts.dest_dir @@ -56,13 +56,13 @@ def main(): raise Exception('Unsopported archive type for {}. Use one of: tar, tar.gz, tgz.'.format(os.path.basename(opts.dest_arch))) for arg in args: - dst = arg + dst = arg if dst.startswith(opts.build_root): dst = dst[len(opts.build_root) + 1:] - + if dest_arch and not arg.endswith('.pkg.fake'): dest_arch.add(arg, arcname=dst) - + dst = os.path.join(opts.dest_dir, dst) ensure_dir_exists(os.path.dirname(dst)) hardlink_or_copy(arg, dst) @@ -71,5 +71,5 @@ def main(): dest_arch.close() -if __name__ == '__main__': - sys.exit(main()) +if __name__ == '__main__': + sys.exit(main()) diff --git a/build/scripts/link_dyn_lib.py b/build/scripts/link_dyn_lib.py index 58f054b37e..23487f5c1e 100644 --- a/build/scripts/link_dyn_lib.py +++ b/build/scripts/link_dyn_lib.py @@ -1,6 +1,6 @@ import sys import os -import subprocess +import subprocess import tempfile import collections import optparse @@ -170,8 +170,8 @@ def parse_args(): parser.add_option('--whole-archive-peers', action='append') parser.add_option('--whole-archive-libs', action='append') return parser.parse_args() - - + + if __name__ == '__main__': opts, args = parse_args() diff --git a/build/scripts/link_fat_obj.py b/build/scripts/link_fat_obj.py index 2700aa4395..c189668b9e 100644 --- a/build/scripts/link_fat_obj.py +++ b/build/scripts/link_fat_obj.py @@ -1,7 +1,7 @@ -import argparse -import subprocess -import sys - +import argparse +import subprocess +import sys + from process_whole_archive_option import ProcessWholeArchiveOption YA_ARG_PREFIX = '-Ya,' @@ -16,7 +16,7 @@ def get_args(): parser.add_argument('--build-root', default=None) parser.add_argument('--with-own-obj', action='store_true', default=False) parser.add_argument('--with-global-srcs', action='store_true', default=False) - + groups = {} args_list = groups.setdefault('default', []) for arg in sys.argv[1:]: @@ -68,17 +68,17 @@ def main(): do_archive += auto_input if args.with_global_srcs: do_archive += global_srcs - + def call(c): proc = subprocess.Popen(c, shell=False, stderr=sys.stderr, stdout=sys.stdout, cwd=args.build_root) proc.communicate() return proc.returncode - + if obj_output: link_res = call(do_link) if link_res: sys.exit(link_res) - + if do_globals: glob_res = call(do_globals) if glob_res: diff --git a/build/scripts/link_lib.py b/build/scripts/link_lib.py index 7d4cf84c5e..344d50d4eb 100644 --- a/build/scripts/link_lib.py +++ b/build/scripts/link_lib.py @@ -1,85 +1,85 @@ -import sys -import subprocess -import tempfile -import os - - -class Opts(object): - def __init__(self, args): - self.archiver = args[0] - self.arch_type = args[1] +import sys +import subprocess +import tempfile +import os + + +class Opts(object): + def __init__(self, args): + self.archiver = args[0] + self.arch_type = args[1] self.llvm_ar_format = args[2] self.build_root = args[3] self.plugin = args[4] self.output = args[5] auto_input = args[6:] - + if self.arch_type == 'GNU_AR': - self.create_flags = ['rcs'] - self.modify_flags = ['-M'] + self.create_flags = ['rcs'] + self.modify_flags = ['-M'] elif self.arch_type == 'LLVM_AR': self.create_flags = ['rcs', '-format=%s' % self.llvm_ar_format] self.modify_flags = ['-M'] - elif self.arch_type == 'LIBTOOL': - self.create_flags = ['-static', '-o'] - self.modify_flags = [] - + elif self.arch_type == 'LIBTOOL': + self.create_flags = ['-static', '-o'] + self.modify_flags = [] + need_modify = self.arch_type != 'LIBTOOL' and any(item.endswith('.a') for item in auto_input) - if need_modify: - self.objs = filter(lambda x: x.endswith('.o'), auto_input) - self.libs = filter(lambda x: x.endswith('.a'), auto_input) - else: - self.objs = auto_input - self.libs = [] - + if need_modify: + self.objs = filter(lambda x: x.endswith('.o'), auto_input) + self.libs = filter(lambda x: x.endswith('.a'), auto_input) + else: + self.objs = auto_input + self.libs = [] + self.plugin_flags = ['--plugin', self.plugin] if self.plugin != 'None' else [] - -def get_opts(args): - return Opts(args) - - -if __name__ == "__main__": - opts = get_opts(sys.argv[1:]) - + +def get_opts(args): + return Opts(args) + + +if __name__ == "__main__": + opts = get_opts(sys.argv[1:]) + # There is a bug in llvm-ar. Some files with size slightly greater 2^32 # still have GNU format instead of GNU64 and cause link problems. # Workaround just lowers llvm-ar's GNU64 threshold to 2^31. if opts.arch_type == 'LLVM_AR': os.environ['SYM64_THRESHOLD'] = '31' - def call(): + def call(): try: p = subprocess.Popen(cmd, stdin=stdin, cwd=opts.build_root) rc = p.wait() return rc except OSError as e: raise Exception('while running %s: %s' % (' '.join(cmd), e)) - + try: os.unlink(opts.output) except OSError: pass - if not opts.libs: + if not opts.libs: cmd = [opts.archiver] + opts.create_flags + opts.plugin_flags + [opts.output] + opts.objs - stdin = None - exit_code = call() - else: - temp = tempfile.NamedTemporaryFile(dir=os.path.dirname(opts.output), delete=False) - - with open(temp.name, 'w') as tmp: - tmp.write('CREATE {0}\n'.format(opts.output)) - for lib in opts.libs: - tmp.write('ADDLIB {0}\n'.format(lib)) - for obj in opts.objs: - tmp.write('ADDMOD {0}\n'.format(obj)) - tmp.write('SAVE\n') - tmp.write('END\n') + stdin = None + exit_code = call() + else: + temp = tempfile.NamedTemporaryFile(dir=os.path.dirname(opts.output), delete=False) + + with open(temp.name, 'w') as tmp: + tmp.write('CREATE {0}\n'.format(opts.output)) + for lib in opts.libs: + tmp.write('ADDLIB {0}\n'.format(lib)) + for obj in opts.objs: + tmp.write('ADDMOD {0}\n'.format(obj)) + tmp.write('SAVE\n') + tmp.write('END\n') cmd = [opts.archiver] + opts.modify_flags + opts.plugin_flags - stdin = open(temp.name) - exit_code = call() - os.remove(temp.name) - - if exit_code != 0: - raise Exception('{0} returned non-zero exit code {1}. Stop.'.format(' '.join(cmd), exit_code)) + stdin = open(temp.name) + exit_code = call() + os.remove(temp.name) + + if exit_code != 0: + raise Exception('{0} returned non-zero exit code {1}. Stop.'.format(' '.join(cmd), exit_code)) diff --git a/build/scripts/run_llvm_dsymutil.py b/build/scripts/run_llvm_dsymutil.py index 88e94306c3..4f43362ad9 100644 --- a/build/scripts/run_llvm_dsymutil.py +++ b/build/scripts/run_llvm_dsymutil.py @@ -1,11 +1,11 @@ -import os -import sys -import subprocess - - +import os +import sys +import subprocess + + if __name__ == '__main__': with open(os.devnull, 'w') as fnull: p = subprocess.Popen(sys.argv[1:], shell=False, stderr=fnull, stdout=sys.stdout) - + p.communicate() sys.exit(p.returncode) diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py index a54b906e3f..439d1f8831 100644 --- a/build/scripts/run_msvc_wine.py +++ b/build/scripts/run_msvc_wine.py @@ -5,7 +5,7 @@ import subprocess import signal import time import json -import argparse +import argparse import errno import process_command_files as pcf @@ -52,7 +52,7 @@ def subst_path(l): return l -def call_wine_cmd_once(wine, cmd, env, mode): +def call_wine_cmd_once(wine, cmd, env, mode): p = run_subprocess(wine + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, close_fds=True, shell=False) output = find_cmd_out(cmd) @@ -76,14 +76,14 @@ def call_wine_cmd_once(wine, cmd, env, mode): return_code = p.returncode if not stdout_and_stderr: if return_code != 0: - raise Exception('wine did something strange') + raise Exception('wine did something strange') return return_code elif ' : fatal error ' in stdout_and_stderr: return_code = 1 elif ' : error ' in stdout_and_stderr: return_code = 2 - + lines = [x.strip() for x in stdout_and_stderr.split('\n')] prefixes = [ @@ -155,8 +155,8 @@ def prepare_vc(fr, to): def run_slave(): - args = json.loads(sys.argv[3]) - wine = sys.argv[1] + args = json.loads(sys.argv[3]) + wine = sys.argv[1] signal.signal(signal.SIGTERM, sig_term) @@ -168,7 +168,7 @@ def run_slave(): while True: try: - return call_wine_cmd_once([wine], args['cmd'], args['env'], args['mode']) + return call_wine_cmd_once([wine], args['cmd'], args['env'], args['mode']) except Exception as e: print >>sys.stderr, '%s, will retry in %s' % (str(e), tout) @@ -409,51 +409,51 @@ def process_free_args(args, wine, bld_root, mode): return pwa.ProcessWholeArchiveOption('WINDOWS', wa_peers, wa_libs).construct_cmd(result) def run_main(): - parser = argparse.ArgumentParser() - parser.add_argument('wine', action='store') - parser.add_argument('-v', action='store', dest='version', default='120') - parser.add_argument('-I', action='append', dest='incl_paths') - parser.add_argument('mode', action='store') + parser = argparse.ArgumentParser() + parser.add_argument('wine', action='store') + parser.add_argument('-v', action='store', dest='version', default='120') + parser.add_argument('-I', action='append', dest='incl_paths') + parser.add_argument('mode', action='store') parser.add_argument('arcadia_root', action='store') parser.add_argument('arcadia_build_root', action='store') - parser.add_argument('binary', action='store') - parser.add_argument('free_args', nargs=argparse.REMAINDER) + parser.add_argument('binary', action='store') + parser.add_argument('free_args', nargs=argparse.REMAINDER) # By now just unpack. Ideally we should fix path and pack arguments back into command file args = parser.parse_args() - - wine = args.wine - mode = args.mode - binary = args.binary - version = args.version - incl_paths = args.incl_paths + + wine = args.wine + mode = args.mode + binary = args.binary + version = args.version + incl_paths = args.incl_paths bld_root = args.arcadia_build_root free_args = args.free_args - + wine_dir = os.path.dirname(os.path.dirname(wine)) bin_dir = os.path.dirname(binary) - tc_dir = os.path.dirname(os.path.dirname(os.path.dirname(bin_dir))) - if not incl_paths: - incl_paths = [tc_dir + '/VC/include', tc_dir + '/include'] + tc_dir = os.path.dirname(os.path.dirname(os.path.dirname(bin_dir))) + if not incl_paths: + incl_paths = [tc_dir + '/VC/include', tc_dir + '/include'] cmd_out = find_cmd_out(free_args) - + env = os.environ.copy() env.pop('DISPLAY', None) - env['WINEDLLOVERRIDES'] = 'msvcr{}=n'.format(version) + env['WINEDLLOVERRIDES'] = 'msvcr{}=n'.format(version) env['WINEDEBUG'] = 'fixme-all' env['INCLUDE'] = ';'.join(fix_path(p) for p in incl_paths) env['VSINSTALLDIR'] = fix_path(tc_dir) env['VCINSTALLDIR'] = fix_path(tc_dir + '/VC') env['WindowsSdkDir'] = fix_path(tc_dir) - env['LIBPATH'] = fix_path(tc_dir + '/VC/lib/amd64') - env['LIB'] = fix_path(tc_dir + '/VC/lib/amd64') + env['LIBPATH'] = fix_path(tc_dir + '/VC/lib/amd64') + env['LIB'] = fix_path(tc_dir + '/VC/lib/amd64') env['LD_LIBRARY_PATH'] = ':'.join(wine_dir + d for d in ['/lib', '/lib64', '/lib64/wine']) cmd = [binary] + process_free_args(free_args, wine, bld_root, mode) - for x in ('/NOLOGO', '/nologo', '/FD'): + for x in ('/NOLOGO', '/nologo', '/FD'): try: cmd.remove(x) except ValueError: @@ -490,7 +490,7 @@ def run_main(): if rc in (-signal.SIGALRM, signal.SIGALRM): print_err_log(out) print >>sys.stderr, '##append_tag##time out' - elif out and ' stack overflow ' in out: + elif out and ' stack overflow ' in out: print >>sys.stderr, '##append_tag##stack overflow' elif out and 'recvmsg: Connection reset by peer' in out: print >>sys.stderr, '##append_tag##wine gone' diff --git a/build/scripts/run_tool.py b/build/scripts/run_tool.py index 681e213978..00e3ff6f1e 100755 --- a/build/scripts/run_tool.py +++ b/build/scripts/run_tool.py @@ -1,6 +1,6 @@ import sys import subprocess -import os +import os if __name__ == '__main__': diff --git a/build/scripts/vcs_info.py b/build/scripts/vcs_info.py index fff4f7e2d0..319d1b4631 100644 --- a/build/scripts/vcs_info.py +++ b/build/scripts/vcs_info.py @@ -76,7 +76,7 @@ def get_default_json(): "ARCADIA_SOURCE_URL": "", "BRANCH": "unknown-vcs-branch", "BUILD_DATE": "", - "BUILD_TIMESTAMP": 0, + "BUILD_TIMESTAMP": 0, "BUILD_HOST": "localhost", "BUILD_USER": "nobody", "PROGRAM_VERSION": "Arc info:\\n Branch: unknown-vcs-branch\\n Commit: 0000000000000000000000000000000000000000\\n Author: <UNKNOWN>\\n Summary: No VCS\\n\\n", @@ -233,8 +233,8 @@ def print_java_mf(info): lines += wrap('SVN-Arcroot: ', info['SVN_ARCROOT']) lines += wrap('SVN-Time: ', info['SVN_TIME']) lines += wrap('Build-Date: ', info['BUILD_DATE']) - if 'BUILD_TIMESTAMP' in info: - lines += wrap('Build-Timestamp: ', str(info['BUILD_TIMESTAMP'])) + if 'BUILD_TIMESTAMP' in info: + lines += wrap('Build-Timestamp: ', str(info['BUILD_TIMESTAMP'])) return lines, names |