cbuildbot: handle whitespace in patch args
The extend action will append empty elements to the list if there are
spaces in the arguments which causes the patch processing logic to barf.
So have the post command processing step filter these out.
BUG=None
TEST=`./cbuildbot_unittest.py` passes
TEST=`cbuildbot -g ' 27507 1234 ' arm-generic-full` no longer errors
TEST=`cbuildbot -p ' chromiumos/chromite:bb chromiumos/chromite:bb '` no longer errors
Change-Id: I9225d8e2de2a93036a6524a20ddc8d6be66c22c3
Reviewed-on: https://gerrit.chromium.org/gerrit/27531
Reviewed-by: Ryan Cui <rcui@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 3e2e3c1..9807a91 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# Copyright (c) 2011-2012 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -724,7 +724,12 @@
def take_action(self, action, dest, opt, value, values, parser):
if action == 'extend':
- lvalue = value.split(' ')
+ # If there is extra spaces between each argument, we get '' which later
+ # code barfs on, so skip those. e.g. We see this with the forms:
+ # cbuildbot -p 'proj:branch ' ...
+ # cbuildbot -p ' proj:branch' ...
+ # cbuildbot -p 'proj:branch proj2:branch' ...
+ lvalue = value.split()
values.ensure_value(dest, []).extend(lvalue)
else:
optparse.Option.take_action(self, action, dest, opt, value, values,