blob: 80d5ca266fbcedb672439469753ee619849573dc [file] [log] [blame]
Morten Krogh-Jespersen54090862019-02-19 11:31:10 +01001#!/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
6import os
7import run_on_as_app
8import shutil
Rico Windec283b52019-04-03 15:16:55 +02009import subprocess
Morten Krogh-Jespersen54090862019-02-19 11:31:10 +010010import sys
Morten Krogh-Jespersen54090862019-02-19 11:31:10 +010011import utils
12
13def main():
Morten Krogh-Jespersen54090862019-02-19 11:31:10 +010014 working_dir = run_on_as_app.WORKING_DIR
15
16 print 'Removing directories that do not match checked out revision'
Rico Windec283b52019-04-03 15:16:55 +020017 if not os.path.exists(working_dir):
18 os.makedirs(working_dir)
19 else:
Christoffer Quist Adamsen03332992019-03-07 15:19:09 +010020 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-Jespersen54090862019-02-19 11:31:10 +010026
27 print 'Downloading all missing apps'
Christoffer Quist Adamsen03332992019-03-07 15:19:09 +010028 run_on_as_app.clone_repositories(quiet=False)
Morten Krogh-Jespersen54090862019-02-19 11:31:10 +010029
Rico Windec283b52019-04-03 15:16:55 +020030 # 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-Jespersen54090862019-02-19 11:31:10 +010042
Morten Krogh-Jespersen271e75c2019-03-15 12:23:17 +010043 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-Jespersen54090862019-02-19 11:31:10 +010047
48if __name__ == '__main__':
49 sys.exit(main())