From 547c64b1fd52d3b511a12bb8164aca16b361619e Mon Sep 17 00:00:00 2001 From: "torne@chromium.org" Date: Fri, 12 Apr 2013 10:06:47 +0000 Subject: [PATCH] Allow multiple OSes to be checked out with git submodules. Allow target.os to be a multivalue config option, which will cause submodules required by any of the listed OSes to be checked out. You can add additional OSes to the list with "git config --add target.os". BUG= Review URL: https://chromiumcodereview.appspot.com/13831004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@193901 0039d316-1c4b-4281-b951-d872f2087c98 --- crup-runner.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crup-runner.sh b/crup-runner.sh index 7c7947c13..4765a2f51 100755 --- a/crup-runner.sh +++ b/crup-runner.sh @@ -18,7 +18,7 @@ update_toplevel () { set_target_os () { # Get the os we're building for. On first run, this will be unset. - target_os=$(git config target.os 2>/dev/null) + target_os=$(git config --get-all target.os 2>/dev/null) if [ -z "$target_os" ]; then case $(uname -s) in Linux) target_os=unix ;; @@ -55,14 +55,19 @@ process_submodule () { update_policy=$(git config --get "submodule.$1.update") if [ -z "$update_policy" ]; then submod_os=$(git config -f .gitmodules --get "submodule.$1.os") - if [ -n "$submod_os" -a \ - "$submod_os" != "all" -a \ - "${submod_os/${target_os}/}" = "${submod_os}" ]; then + if [ -n "$submod_os" -a "$submod_os" != "all" ]; then update_policy=none + for os in $target_os; do + if [ "${submod_os/${os}/}" != "${submod_os}" ]; then + update_policy=checkout + fi + done else - git submodule --quiet init "$1" update_policy=checkout fi + if [ "$update_policy" != "none" ]; then + git submodule --quiet init "$1" + fi git config "submodule.$1.update" $update_policy fi ignore_policy=$(git config --get "submodule.$1.ignore")