mirror of https://github.com/google/oss-fuzz.git
[infra] --nopull option for helper.py (#219)
The options is useful when changing base-images.
This commit is contained in:
parent
64f8b6593d
commit
0bbedbda65
|
@ -33,17 +33,23 @@ OSSFUZZ_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|||
BUILD_DIR = os.path.join(OSSFUZZ_DIR, 'build')
|
||||
|
||||
|
||||
GLOBAL_ARGS = None
|
||||
|
||||
def main():
|
||||
os.chdir(OSSFUZZ_DIR)
|
||||
if not os.path.exists(BUILD_DIR):
|
||||
os.mkdir(BUILD_DIR)
|
||||
|
||||
parser = argparse.ArgumentParser('helper.py', description='oss-fuzz helpers')
|
||||
parser.add_argument(
|
||||
'--nopull', default=False, action='store_const', const=True,
|
||||
help='do not specify --pull while building an image')
|
||||
parser.add_argument(
|
||||
'command',
|
||||
help='One of: generate, build_image, build_fuzzers, run_fuzzer, coverage, shell',
|
||||
nargs=argparse.REMAINDER)
|
||||
args = parser.parse_args()
|
||||
global GLOBAL_ARGS
|
||||
GLOBAL_ARGS = args = parser.parse_args()
|
||||
|
||||
if not args.command:
|
||||
parser.print_help()
|
||||
|
@ -110,10 +116,13 @@ def _build_image(image_name):
|
|||
|
||||
dockerfile_dir = os.path.join('projects', image_name)
|
||||
|
||||
command = [
|
||||
'docker', 'build', '--pull', '-t', 'ossfuzz/' + image_name,
|
||||
dockerfile_dir,
|
||||
]
|
||||
|
||||
build_args = []
|
||||
if not GLOBAL_ARGS.nopull:
|
||||
build_args += ['--pull']
|
||||
build_args += ['-t', 'ossfuzz/' + image_name, dockerfile_dir ]
|
||||
|
||||
command = [ 'docker', 'build' ] + build_args
|
||||
print('Running:', _get_command_string(command))
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue