Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / native_client_sdk / src / build_tools / nacl-mono-archive.py
bloba9dd46889ff338488fcb238e126ec7297305ef55
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 import argparse
7 import os
8 import sys
9 import tarfile
11 import buildbot_common
14 def main(args):
15 parser = argparse.ArgumentParser()
16 parser.add_argument('--install-dir',
17 help='Install Directory',
18 dest='install_dir',
19 default='naclmono')
20 parser.add_argument('--tar-path',
21 help='Tarfile path',
22 dest='tar_path',
23 default='naclmono_%pepperrev%.bz2')
24 parser.add_argument('--upload-path',
25 help='Upload path (nativeclient-mirror/nacl/nacl_sdk/XXX)',
26 dest='upload_path',
27 default=None)
28 parser.add_argument('--pepper-revision',
29 help='Pepper revision',
30 dest='pepper_revision',
31 default=None)
32 parser.add_argument('--skip-upload',
33 help='Skips upload step',
34 action="store_true",
35 dest='skip_upload')
36 options = parser.parse_args(args)
38 if not options.upload_path:
39 buildbot_common.ErrorExit('--upload-path is required')
40 if not options.pepper_revision:
41 buildbot_common.ErrorExit('--pepper-revision is required')
43 options.tar_path = options.tar_path.replace('%pepperrev%',
44 options.pepper_revision)
46 install_folders = ['bin', 'etc', 'include', 'lib', 'lib32', 'libarm', 'share']
48 buildbot_common.BuildStep('Archive Build')
49 tar_file = None
50 buildbot_common.RemoveFile(options.tar_path)
51 try:
52 tar_file = tarfile.open(options.tar_path, mode='w:bz2', dereference=True)
53 for subfolder in install_folders:
54 tar_file.add(os.path.join(options.install_dir, subfolder),
55 arcname=subfolder)
56 finally:
57 if tar_file:
58 tar_file.close()
60 if not options.skip_upload:
61 buildbot_common.Archive(os.path.basename(options.tar_path),
62 'nativeclient-mirror/nacl/nacl_sdk/%s' % options.upload_path,
63 cwd=os.path.dirname(os.path.abspath(options.tar_path)))
65 if __name__ == '__main__':
66 sys.exit(main(sys.argv[1:]))