Commit 547c64b1 authored by torne@chromium.org's avatar torne@chromium.org

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
parent 6cc97a1b
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment