Avi Drissman | ea1be23 | 2022-09-14 23:29:06 | [diff] [blame] | 1 | # Copyright 2020 The Chromium Authors |
Eugene But | bc28b560 | 2020-04-09 17:29:18 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import argparse |
| 6 | import os |
| 7 | import shutil |
Eugene But | ff2b5387b | 2020-05-11 16:14:20 | [diff] [blame] | 8 | import subprocess |
Eugene But | bc28b560 | 2020-04-09 17:29:18 | [diff] [blame] | 9 | import sys |
| 10 | |
| 11 | |
| 12 | def main(): |
| 13 | description = 'Packages WebKit build for Clusterfuzz.' |
| 14 | parser = argparse.ArgumentParser(description=description) |
| 15 | parser.add_argument('--output', |
Ali Juma | 83b50a34 | 2020-05-14 21:48:30 | [diff] [blame] | 16 | help='Name of the output file.') |
Eugene But | bc28b560 | 2020-04-09 17:29:18 | [diff] [blame] | 17 | parser.add_argument('--webkit_build', |
| 18 | help='WebKit build directory to copy.') |
| 19 | parser.add_argument('--clusterfuzz_script', |
| 20 | help='Clusterfuzz script to copy.') |
Ali Juma | 83b50a34 | 2020-05-14 21:48:30 | [diff] [blame] | 21 | parser.add_argument('--clang_asan_library', |
| 22 | help='Clang ASan library to copy.') |
Eugene But | bc28b560 | 2020-04-09 17:29:18 | [diff] [blame] | 23 | |
| 24 | opts = parser.parse_args() |
| 25 | |
| 26 | if os.path.exists(opts.output): |
| 27 | shutil.rmtree(opts.output) |
| 28 | |
| 29 | shutil.copytree(opts.webkit_build, opts.output, symlinks=True) |
| 30 | shutil.copyfile( |
| 31 | opts.clusterfuzz_script, |
| 32 | os.path.join(opts.output, |
| 33 | os.path.basename(opts.clusterfuzz_script))) |
Ali Juma | 83b50a34 | 2020-05-14 21:48:30 | [diff] [blame] | 34 | shutil.copyfile( |
| 35 | opts.clang_asan_library, |
| 36 | os.path.join(opts.output, |
| 37 | os.path.basename(opts.clang_asan_library))) |
Eugene But | bc28b560 | 2020-04-09 17:29:18 | [diff] [blame] | 38 | |
Eugene But | ff2b5387b | 2020-05-11 16:14:20 | [diff] [blame] | 39 | zip_command = ['zip', '--symlinks', '-r', os.extsep.join([opts.output, 'zip']), opts.output] |
| 40 | proc = subprocess.Popen(zip_command) |
| 41 | proc.communicate() |
| 42 | return proc.returncode |
| 43 | |
Eugene But | bc28b560 | 2020-04-09 17:29:18 | [diff] [blame] | 44 | |
| 45 | if __name__ == '__main__': |
| 46 | sys.exit(main()) |