blob: a3f317073f7c195f16d6c32937e63ebb6bfc57e2 [file] [log] [blame]
Bertrand SIMONNET2dddf4f2015-04-30 17:23:26 -07001#!/usr/bin/python2
2# Copyright (c) 2009-2015 The Chromium OS Authors. All rights reserved.
Ryan Cui0af7a912012-06-18 18:00:47 -07003# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Bertrand SIMONNET2dddf4f2015-04-30 17:23:26 -07006"""Strip package and place it in <sysroot>/stripped-packages."""
Ryan Cui0af7a912012-06-18 18:00:47 -07007
Bertrand SIMONNET2dddf4f2015-04-30 17:23:26 -07008from __future__ import print_function
9
10import argparse
Yu-Ju Honge2b3f742013-11-08 11:33:09 -080011import sys
Ryan Cui0af7a912012-06-18 18:00:47 -070012
Gilad Arnoldabb352e2012-09-23 01:24:27 -070013import builder
14
Ryan Cui0af7a912012-06-18 18:00:47 -070015
16def main():
Bertrand SIMONNET2dddf4f2015-04-30 17:23:26 -070017 parser = argparse.ArgumentParser()
18 target = parser.add_mutually_exclusive_group(required=True)
19 target.add_argument('--board',
20 help=('The board that the package being processed '
21 'belongs to'))
22 target.add_argument('--sysroot',
23 help=('Sysroot that the package being processed belongs '
24 'to. This is incompatible with --board.'))
25 parser.add_argument('--deep', action='store_true',
26 help='Also strip dependencies of package.')
27 parser.add_argument('package', help='Package to strip.')
Ryan Cui0af7a912012-06-18 18:00:47 -070028
Bertrand SIMONNET2dddf4f2015-04-30 17:23:26 -070029 options = parser.parse_args()
30 sysroot = options.sysroot or '/build/%s' % options.board
Ryan Cui0af7a912012-06-18 18:00:47 -070031
Yu-Ju Honge2b3f742013-11-08 11:33:09 -080032 # Check if package was installed.
Bertrand SIMONNET2dddf4f2015-04-30 17:23:26 -070033 if not builder.UpdateGmergeBinhost(sysroot, options.package, options.deep):
Yu-Ju Honge2b3f742013-11-08 11:33:09 -080034 sys.exit(1)
Ryan Cui0af7a912012-06-18 18:00:47 -070035
36
37if __name__ == '__main__':
38 main()