1#!/usr/bin/env python 2# 3# Copyright 2018 Google LLC 4# 5# Use of this source code is governed by a BSD-style license that can be 6# found in the LICENSE file. 7 8 9"""Create the mesa driver. This defers to a Docker container 10 with the build_mesa.sh script.""" 11 12 13import argparse 14import subprocess 15 16DOCKER_IMAGE='gcr.io/skia-public/mesa-driver-builder:v1' 17BUILD_SCRIPT='/opt/build_mesa.sh' 18MESA_VERSION='18.1.7' 19 20 21def create_asset(target_dir): 22 """Create the asset.""" 23 cmd = [ 24 'docker', 'run', '--volume', '%s:/OUT' % target_dir, 25 '--env', 'MESA_VERSION=%s' % MESA_VERSION, 26 DOCKER_IMAGE, BUILD_SCRIPT 27 ] 28 print('Running docker cmd', cmd) 29 subprocess.check_output(cmd) 30 31 32def main(): 33 parser = argparse.ArgumentParser() 34 parser.add_argument('--target_dir', '-t', required=True) 35 args = parser.parse_args() 36 create_asset(args.target_dir) 37 38 39if __name__ == '__main__': 40 main() 41