strip_package: Strip multiple packages in one run.

This script uses builder.UpdateGmergeBinhost(), which does some
potentially heavyweight operations: load the Portage trees, filter
packages, and populate a binhost database. There are tools (e.g. cros
deploy) that call it multiple times, each time with an individual
package argument. To make things more efficient, this allows passing
multiple package arguments and processing them all in one run.

BUG=brillo:1132
TEST=strip_package --board link shill update_engine works as expected.

Change-Id: I53643e32a94b6ff85d8d0fa53cc179c09c38f0e6
Reviewed-on: https://chromium-review.googlesource.com/275723
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/strip_package.py b/strip_package.py
index a3f3170..5542eaa 100755
--- a/strip_package.py
+++ b/strip_package.py
@@ -3,7 +3,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-"""Strip package and place it in <sysroot>/stripped-packages."""
+"""Strip packages and place them in <sysroot>/stripped-packages."""
 
 from __future__ import print_function
 
@@ -17,20 +17,20 @@
   parser = argparse.ArgumentParser()
   target = parser.add_mutually_exclusive_group(required=True)
   target.add_argument('--board',
-                      help=('The board that the package being processed '
-                            'belongs to'))
+                      help='The board that processed packages belong to.')
   target.add_argument('--sysroot',
-                      help=('Sysroot that the package being processed belongs '
-                            'to. This is incompatible with --board.'))
+                      help=('Sysroot that processed packages belong to. '
+                            'This is incompatible with --board.'))
   parser.add_argument('--deep', action='store_true',
-                      help='Also strip dependencies of package.')
-  parser.add_argument('package', help='Package to strip.')
+                      help='Also strip dependencies of packages.')
+  parser.add_argument('packages', nargs='+', metavar='package',
+                      help='Package to strip.')
 
   options = parser.parse_args()
   sysroot = options.sysroot or '/build/%s' % options.board
 
-  # Check if package was installed.
-  if not builder.UpdateGmergeBinhost(sysroot, options.package, options.deep):
+  # Check if packages were installed.
+  if not builder.UpdateGmergeBinhost(sysroot, options.packages, options.deep):
     sys.exit(1)