OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Automates running BuildPackageLists, BuildSysroot, and | 6 """Automates running BuildPackageLists, BuildSysroot, and |
7 UploadSysroot for each supported arch of each sysroot creator. | 7 UploadSysroot for each supported arch of each sysroot creator. |
8 """ | 8 """ |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 27 matching lines...) Expand all Loading... |
38 # TODO(thomasanderson): Find out which revision 'git-cl upload' uses to | 38 # TODO(thomasanderson): Find out which revision 'git-cl upload' uses to |
39 # calculate the diff against and use that instead of HEAD. | 39 # calculate the diff against and use that instead of HEAD. |
40 script_dir = os.path.dirname(os.path.realpath(__file__)) | 40 script_dir = os.path.dirname(os.path.realpath(__file__)) |
41 revision = get_proc_output(['git', '-C', script_dir, 'rev-parse', 'HEAD']) | 41 revision = get_proc_output(['git', '-C', script_dir, 'rev-parse', 'HEAD']) |
42 | 42 |
43 run_script([script_path, 'UpdatePackageLists%s' % arch]) | 43 run_script([script_path, 'UpdatePackageLists%s' % arch]) |
44 run_script([script_path, 'BuildSysroot%s' % arch]) | 44 run_script([script_path, 'BuildSysroot%s' % arch]) |
45 run_script([script_path, 'UploadSysroot%s' % arch, revision]) | 45 run_script([script_path, 'UploadSysroot%s' % arch, revision]) |
46 | 46 |
47 tarball = '%s_%s_%s_sysroot.tgz' % (distro, release, arch.lower()) | 47 tarball = '%s_%s_%s_sysroot.tgz' % (distro, release, arch.lower()) |
48 tgz_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), | 48 tgz_path = os.path.join(script_dir, "..", "..", "..", "out", "sysroot-build", |
49 "..", "..", "..", "out", "sysroot-build", | |
50 release, tarball) | 49 release, tarball) |
51 sha1sum = sha1sumfile(tgz_path) | 50 sha1sum = sha1sumfile(tgz_path) |
52 sysroot_dir = '%s_%s_%s-sysroot' % (distro, release, arch.lower()) | 51 sysroot_dir = '%s_%s_%s-sysroot' % (distro, release, arch.lower()) |
53 | 52 |
54 sysroot_metadata = { | 53 sysroot_metadata = { |
55 'Revision': revision, | 54 'Revision': revision, |
56 'Tarball': tarball, | 55 'Tarball': tarball, |
57 'Sha1Sum': sha1sum, | 56 'Sha1Sum': sha1sum, |
58 'SysrootDir': sysroot_dir | 57 'SysrootDir': sysroot_dir |
59 } | 58 } |
60 with lock: | 59 with lock: |
61 with open('sysroots.json', 'rw+') as f: | 60 with open(os.path.join(script_dir, 'sysroots.json'), 'rw+') as f: |
62 sysroots = json.load(f) | 61 sysroots = json.load(f) |
63 sysroots["%s_%s" % (release, arch.lower())] = sysroot_metadata | 62 sysroots["%s_%s" % (release, arch.lower())] = sysroot_metadata |
64 f.seek(0) | 63 f.seek(0) |
65 f.truncate() | 64 f.truncate() |
66 f.write(json.dumps(sysroots, sort_keys=True, indent=4, | 65 f.write(json.dumps(sysroots, sort_keys=True, indent=4, |
67 separators=(',', ': '))) | 66 separators=(',', ': '))) |
68 f.write('\n') | 67 f.write('\n') |
69 | 68 |
70 def main(): | 69 def main(): |
71 script_dir = os.path.dirname(os.path.realpath(__file__)) | 70 script_dir = os.path.dirname(os.path.realpath(__file__)) |
(...skipping 17 matching lines...) Expand all Loading... |
89 failures = 0 | 88 failures = 0 |
90 for name, proc in procs: | 89 for name, proc in procs: |
91 if proc.exitcode: | 90 if proc.exitcode: |
92 failures += 1 | 91 failures += 1 |
93 status = "FAILURE" if proc.exitcode else "SUCCESS" | 92 status = "FAILURE" if proc.exitcode else "SUCCESS" |
94 print "%s sysroot creation\t%s" % (name, status) | 93 print "%s sysroot creation\t%s" % (name, status) |
95 return failures | 94 return failures |
96 | 95 |
97 if __name__ == '__main__': | 96 if __name__ == '__main__': |
98 sys.exit(main()) | 97 sys.exit(main()) |
OLD | NEW |