Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1050)

Unified Diff: common.sh

Issue 6371008: Add common function to determin board and variant values. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common.sh
diff --git a/common.sh b/common.sh
index 291c112f7730652164e5cf65abb51218831df300..f368e0d6bef0e83fe67945d0865d47fb1694cb32 100644
--- a/common.sh
+++ b/common.sh
@@ -562,3 +562,23 @@ chroot_hacks_from_outside() {
sudo bash -c "echo root ALL=\(ALL\) ALL >> \"${chroot_dir}/etc/sudoers\""
fi
}
+
+# The board and variant command line options can be used in a number of ways
+# to specify the board and variant. The board can encode both pieces of
+# information separated by underscores. Or the variant can be passed using
+# the separate variant option. This function extracts the canonical board and
+# variant information and provides it in the BOARD, VARIANT and BOARD_VARIANT
+# variables.
+get_board_and_variant() {
+ local flags_board="${1}"
+ local flags_variant="${2}"
kwwaters_gmail.com 2011/01/24 22:49:59 These variables are unused.
robotboy 2011/01/24 23:17:00 Ooops, fixed.
+
+ BOARD=$(echo "$FLAGS_board" |cut -d '_' -f 1)
kwwaters_gmail.com 2011/01/24 22:49:59 Spaces around "|".
robotboy 2011/01/24 23:17:00 Done.
+ VARIANT=${FLAGS_variant:-$(echo "$FLAGS_board" |cut -s -d '_' -f 2)}
kwwaters_gmail.com 2011/01/24 22:49:59 Should this be "cut -s -d _ -f 2-" I'm not sure,
robotboy 2011/01/24 23:17:00 Nope, we ensure that the variant and board names d
+
+ if [ -n "$VARIANT" ] ; then
kwwaters_gmail.com 2011/01/24 22:49:59 Drop space between "]" and ";".
robotboy 2011/01/24 23:17:00 Done.
+ BOARD_VARIANT="${BOARD}_${VARIANT}"
+ else
+ BOARD_VARIANT="${BOARD}"
+ fi
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698