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 |
| 9 | import sys |
| 10 | import upload_to_x20 |
| 11 | import utils |
| 12 | |
| 13 | def main(): |
| 14 | # We need prodaccess to upload to x20 |
| 15 | utils.check_prodacces() |
| 16 | |
| 17 | working_dir = run_on_as_app.WORKING_DIR |
| 18 | |
| 19 | print 'Removing directories that do not match checked out revision' |
| 20 | with utils.ChangedWorkingDirectory(working_dir): |
Christoffer Quist Adamsen | 0333299 | 2019-03-07 15:19:09 +0100 | [diff] [blame] | 21 | for repo in run_on_as_app.APP_REPOSITORIES: |
| 22 | repo_dir = os.path.join(working_dir, repo.name) |
| 23 | if os.path.exists(repo_dir) \ |
| 24 | and utils.get_HEAD_sha1_for_checkout(repo_dir) != repo.revision: |
| 25 | print 'Removing %s' % repo_dir |
| 26 | shutil.rmtree(repo_dir) |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 27 | |
| 28 | print 'Downloading all missing apps' |
Christoffer Quist Adamsen | 0333299 | 2019-03-07 15:19:09 +0100 | [diff] [blame] | 29 | run_on_as_app.clone_repositories(quiet=False) |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 30 | |
| 31 | # Package all files as x20 dependency |
| 32 | parent_dir = os.path.dirname(working_dir) |
| 33 | with utils.ChangedWorkingDirectory(parent_dir): |
| 34 | print 'Creating archive for opensource_apps (this may take some time)' |
| 35 | working_dir_name = os.path.basename(working_dir) |
Christoffer Quist Adamsen | 0333299 | 2019-03-07 15:19:09 +0100 | [diff] [blame] | 36 | repo_dirs = [working_dir_name + '/' + repo.name |
| 37 | for repo in run_on_as_app.APP_REPOSITORIES] |
| 38 | filename = utils.create_archive("opensource_apps", repo_dirs) |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 39 | sha1 = utils.get_sha1(filename) |
| 40 | dest = os.path.join(upload_to_x20.GMSCORE_DEPS, sha1) |
| 41 | upload_to_x20.uploadFile(filename, dest) |
| 42 | sha1_file = '%s.sha1' % filename |
| 43 | with open(sha1_file, 'w') as output: |
| 44 | output.write(sha1) |
| 45 | shutil.move(sha1_file, |
| 46 | os.path.join(utils.THIRD_PARTY, 'opensource_apps.tar.gz.sha1')) |
| 47 | |
Morten Krogh-Jespersen | 271e75c | 2019-03-15 12:23:17 +0100 | [diff] [blame] | 48 | print 'To have apps benchmarked on Golem, the updated apps have to be ' \ |
| 49 | 'downloaded to the runners by ssh\'ing into each runner and do:\n' \ |
| 50 | 'cd ../golem\n' \ |
| 51 | 'update_dependencies.sh\n' |
Morten Krogh-Jespersen | 5409086 | 2019-02-19 11:31:10 +0100 | [diff] [blame] | 52 | |
| 53 | if __name__ == '__main__': |
| 54 | sys.exit(main()) |