Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file |
| 3 | # for details. All rights reserved. Use of this source code is governed by a |
| 4 | # BSD-style license that can be found in the LICENSE file. |
| 5 | |
| 6 | import os |
| 7 | import run_on_as_app |
| 8 | import shutil |
Rico Wind | ec283b5 | 2019-04-03 15:16:55 +0200 | [diff] [blame] | 9 | import subprocess |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 10 | import sys |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 11 | import utils |
| 12 | |
| 13 | def main(): |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 14 | working_dir = run_on_as_app.WORKING_DIR |
| 15 | |
| 16 | print 'Removing directories that do not match checked out revision' |
Rico Wind | ec283b5 | 2019-04-03 15:16:55 +0200 | [diff] [blame] | 17 | if not os.path.exists(working_dir): |
| 18 | os.makedirs(working_dir) |
| 19 | else: |
Christoffer Quist Adamsen | 0333299 | 2019-03-07 15:19:09 +0100 | [diff] [blame] | 20 | for repo in run_on_as_app.APP_REPOSITORIES: |
| 21 | repo_dir = os.path.join(working_dir, repo.name) |
| 22 | if os.path.exists(repo_dir) \ |
| 23 | and utils.get_HEAD_sha1_for_checkout(repo_dir) != repo.revision: |
| 24 | print 'Removing %s' % repo_dir |
| 25 | shutil.rmtree(repo_dir) |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 26 | |
| 27 | print 'Downloading all missing apps' |
Christoffer Quist Adamsen | 0333299 | 2019-03-07 15:19:09 +0100 | [diff] [blame] | 28 | run_on_as_app.clone_repositories(quiet=False) |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 29 | |
Rico Wind | ec283b5 | 2019-04-03 15:16:55 +0200 | [diff] [blame] | 30 | # Package all files as cloud dependency |
| 31 | print 'Creating archive for opensource_apps (this may take some time)' |
| 32 | if os.path.exists(utils.OPENSOURCE_APPS_FOLDER): |
| 33 | shutil.rmtree(utils.OPENSOURCE_APPS_FOLDER) |
| 34 | for repo in run_on_as_app.APP_REPOSITORIES: |
| 35 | repo_dir = os.path.join(working_dir, repo.name) |
| 36 | dst = os.path.join(utils.OPENSOURCE_APPS_FOLDER, repo.name) |
| 37 | shutil.copytree(repo_dir, dst) |
| 38 | |
| 39 | with utils.ChangedWorkingDirectory(utils.THIRD_PARTY): |
| 40 | subprocess.check_call(['upload_to_google_storage.py', '-a', '--bucket', |
| 41 | 'r8-deps', 'opensource_apps']) |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 42 | |
Morten Krogh-Jespersen | 271e75c | 2019-03-15 12:23:17 +0100 | [diff] [blame] | 43 | print 'To have apps benchmarked on Golem, the updated apps have to be ' \ |
| 44 | 'downloaded to the runners by ssh\'ing into each runner and do:\n' \ |
| 45 | 'cd ../golem\n' \ |
| 46 | 'update_dependencies.sh\n' |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 47 | |
| 48 | if __name__ == '__main__': |
| 49 | sys.exit(main()) |