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.
11 import buildbot_common
15 parser
= argparse
.ArgumentParser()
16 parser
.add_argument('--install-dir',
17 help='Install Directory',
20 parser
.add_argument('--tar-path',
23 default
='naclmono_%pepperrev%.bz2')
24 parser
.add_argument('--upload-path',
25 help='Upload path (nativeclient-mirror/nacl/nacl_sdk/XXX)',
28 parser
.add_argument('--pepper-revision',
29 help='Pepper revision',
30 dest
='pepper_revision',
32 parser
.add_argument('--skip-upload',
33 help='Skips upload step',
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')
50 buildbot_common
.RemoveFile(options
.tar_path
)
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
),
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:]))