diff options
Diffstat (limited to 'infra/bots/assets/linux_vulkan_sdk')
-rw-r--r-- | infra/bots/assets/linux_vulkan_sdk/README.md | 8 | ||||
-rw-r--r-- | infra/bots/assets/linux_vulkan_sdk/VERSION | 1 | ||||
-rwxr-xr-x | infra/bots/assets/linux_vulkan_sdk/common.py | 26 | ||||
-rwxr-xr-x | infra/bots/assets/linux_vulkan_sdk/create.py | 36 | ||||
-rwxr-xr-x | infra/bots/assets/linux_vulkan_sdk/create_and_upload.py | 50 | ||||
-rwxr-xr-x | infra/bots/assets/linux_vulkan_sdk/download.py | 16 | ||||
-rwxr-xr-x | infra/bots/assets/linux_vulkan_sdk/upload.py | 16 |
7 files changed, 153 insertions, 0 deletions
diff --git a/infra/bots/assets/linux_vulkan_sdk/README.md b/infra/bots/assets/linux_vulkan_sdk/README.md new file mode 100644 index 0000000000..2a266b6c83 --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/README.md @@ -0,0 +1,8 @@ +To create the vulkan sdk asset: + +Install the vulkan sdk from https://vulkan.lunarg.com/signin on a linux machine + +The default install dir is in the same directory as the .run file is (e.g. ~/Downloads). +Call the install directory $VULKAN_SDK. + +When uploading the CIPD asset, use -s $VULKAN_SDK/VERSION/x86_64 diff --git a/infra/bots/assets/linux_vulkan_sdk/VERSION b/infra/bots/assets/linux_vulkan_sdk/VERSION new file mode 100644 index 0000000000..c227083464 --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/VERSION @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/infra/bots/assets/linux_vulkan_sdk/common.py b/infra/bots/assets/linux_vulkan_sdk/common.py new file mode 100755 index 0000000000..4920c9b4fb --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/common.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Common vars used by scripts in this directory.""" + + +import os +import sys + +FILE_DIR = os.path.dirname(os.path.abspath(__file__)) +INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) + +sys.path.insert(0, INFRA_BOTS_DIR) +from assets import assets + +ASSET_NAME = os.path.basename(FILE_DIR) + + +def run(cmd): + """Run a command, eg. "upload" or "download". """ + assets.main([cmd, ASSET_NAME] + sys.argv[1:]) diff --git a/infra/bots/assets/linux_vulkan_sdk/create.py b/infra/bots/assets/linux_vulkan_sdk/create.py new file mode 100755 index 0000000000..21c1ee7f37 --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/create.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset.""" + + +import argparse +import shutil +import sys +import os + + + +def create_asset(target_dir, sdk_path): + """Create the asset.""" + shutil.copytree(sdk_path, target_dir) + + +def main(): + if 'linux' not in sys.platform: + print >> sys.stderr, 'This script only runs on Linux.' + sys.exit(1) + parser = argparse.ArgumentParser() + parser.add_argument('--target_dir', '-t', required=True) + parser.add_argument('--sdk_path', '-s', required=True) + args = parser.parse_args() + create_asset(args.target_dir, args.sdk_path) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/linux_vulkan_sdk/create_and_upload.py b/infra/bots/assets/linux_vulkan_sdk/create_and_upload.py new file mode 100755 index 0000000000..22226d70b1 --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/create_and_upload.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset and upload it.""" + + +import argparse +import common +import os +import subprocess +import sys +import utils + + +def main(): + if 'linux' not in sys.platform: + print >> sys.stderr, 'This script only runs on Linux.' + sys.exit(1) + parser = argparse.ArgumentParser() + parser.add_argument('--gsutil') + parser.add_argument('--sdk_path', '-s', required=True) + args = parser.parse_args() + + with utils.tmp_dir(): + cwd = os.getcwd() + create_script = os.path.join(common.FILE_DIR, 'create.py') + upload_script = os.path.join(common.FILE_DIR, 'upload.py') + + try: + cwd = os.path.join(cwd, 'sdk') + cmd = ['python', create_script, + '-t', cwd, + '--sdk_path', args.sdk_path] + subprocess.check_call(cmd) + cmd = ['python', upload_script, '-t', cwd] + if args.gsutil: + cmd.extend(['--gsutil', args.gsutil]) + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + # Trap exceptions to avoid printing two stacktraces. + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/linux_vulkan_sdk/download.py b/infra/bots/assets/linux_vulkan_sdk/download.py new file mode 100755 index 0000000000..96cc87d43f --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/download.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Download the current version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('download') diff --git a/infra/bots/assets/linux_vulkan_sdk/upload.py b/infra/bots/assets/linux_vulkan_sdk/upload.py new file mode 100755 index 0000000000..ba7fc8b6a1 --- /dev/null +++ b/infra/bots/assets/linux_vulkan_sdk/upload.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Upload a new version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('upload') |