[Buildroot] [PATCH 2/4] support/download/git: support download features

Vincent Fazio vfazio at xes-inc.com
Thu Jan 16 19:38:50 UTC 2020


Initial support is limited to submodules.

Signed-off-by: Vincent Fazio <vfazio at xes-inc.com>
---
 support/download/git | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/support/download/git b/support/download/git
index 075f665bbf..eb1778a2f9 100755
--- a/support/download/git
+++ b/support/download/git
@@ -43,8 +43,16 @@ _on_error() {
     exec "${myname}" "${OPTS[@]}" || exit ${ret}
 }
 
+feature_requested() {
+    local feature="${1}"
+    local features_requested="${2}"
+
+    grep -qow "${feature}" <<<"${features_requested}"
+}
+
 verbose=
 recurse=0
+features=
 while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
     case "${OPT}" in
     q)  verbose=-q; exec >/dev/null;;
@@ -54,6 +62,7 @@ while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
     c)  cset="${OPTARG}";;
     d)  dl_dir="${OPTARG}";;
     n)  basename="${OPTARG}";;
+    x)  features="${OPTARG}";;
     :)  printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
     \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
     esac
@@ -75,6 +84,9 @@ _git() {
     eval GIT_DIR="${git_cache}/.git" ${GIT} "${@}"
 }
 
+# check for requested features we support
+if feature_requested "submodules" "${features}"; then recurse=1; fi
+
 # Create a warning file, that the user should not use the git cache.
 # It's ours. Our precious.
 cat <<-_EOF_ >"${dl_dir}/git.readme"
-- 
2.25.0



More information about the buildroot mailing list