blob: c81d5d948b7d909857cba45d482cebdf01128771 [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
9import sys
10import upload_to_x20
11import utils
12
13def 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 Adamsen03332992019-03-07 15:19:09 +010021 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-Jespersen54090862019-02-19 11:31:10 +010027
28 print 'Downloading all missing apps'
Christoffer Quist Adamsen03332992019-03-07 15:19:09 +010029 run_on_as_app.clone_repositories(quiet=False)
Morten Krogh-Jespersen54090862019-02-19 11:31:10 +010030
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 Adamsen03332992019-03-07 15:19:09 +010036 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-Jespersen54090862019-02-19 11:31:10 +010039 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-Jespersen271e75c2019-03-15 12:23:17 +010048 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-Jespersen54090862019-02-19 11:31:10 +010052
53if __name__ == '__main__':
54 sys.exit(main())