Răsfoiți Sursa

core/pkg-infra: download git submodules if the package wants them

Add a new package variable that packages can set to specify that they
need git submodules.

Only accept this option if the download method is git, as we can not get
submodules via an http download (via wget).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Aleksandar Simeonov <aleksandar@barix.com>
Tested-by: Matt Weber <matt@thewebers.ws>
Reviewed-by: Matt Weber <matt@thewebers.ws>
Tested-By: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Yann E. MORIN 9 ani în urmă
părinte
comite
ec3e057f79
3 a modificat fișierele cu 13 adăugiri și 3 ștergeri
  1. 1 0
      package/pkg-download.mk
  2. 8 0
      package/pkg-generic.mk
  3. 4 3
      support/download/dl-wrapper

+ 1 - 0
package/pkg-download.mk

@@ -76,6 +76,7 @@ export BR_NO_CHECK_HASH_FOR =
 define DOWNLOAD_GIT
 define DOWNLOAD_GIT
 	$(EXTRA_ENV) $(DL_WRAPPER) -b git \
 	$(EXTRA_ENV) $(DL_WRAPPER) -b git \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
 		-o $(DL_DIR)/$($(PKG)_SOURCE) \
+		$(if $($(PKG)_GIT_SUBMODULES),-r) \
 		$(QUIET) \
 		$(QUIET) \
 		-- \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_SITE) \

+ 8 - 0
package/pkg-generic.mk

@@ -468,6 +468,14 @@ ifndef $(2)_SITE_METHOD
  endif
  endif
 endif
 endif
 
 
+# Do not accept to download git submodule if not using the git method
+ifneq ($$($(2)_GIT_SUBMODULES),)
+ ifneq ($$($(2)_SITE_METHOD),git)
+  $$(error $(2) declares having git sub-modules, but does not use the \
+	   'git' method (uses '$$($(2)_SITE_METHOD)' instead))
+ endif
+endif
+
 ifeq ($$($(2)_SITE_METHOD),local)
 ifeq ($$($(2)_SITE_METHOD),local)
 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
 ifeq ($$($(2)_OVERRIDE_SRCDIR),)
 $(2)_OVERRIDE_SRCDIR = $$($(2)_SITE)
 $(2)_OVERRIDE_SRCDIR = $$($(2)_SITE)

+ 4 - 3
support/download/dl-wrapper

@@ -21,15 +21,16 @@ set -e
 
 
 main() {
 main() {
     local OPT OPTARG
     local OPT OPTARG
-    local backend output hfile quiet
+    local backend output hfile recurse quiet
 
 
     # Parse our options; anything after '--' is for the backend
     # Parse our options; anything after '--' is for the backend
-    while getopts :hb:o:H:q OPT; do
+    while getopts :hb:o:H:rq OPT; do
         case "${OPT}" in
         case "${OPT}" in
         h)  help; exit 0;;
         h)  help; exit 0;;
         b)  backend="${OPTARG}";;
         b)  backend="${OPTARG}";;
         o)  output="${OPTARG}";;
         o)  output="${OPTARG}";;
         H)  hfile="${OPTARG}";;
         H)  hfile="${OPTARG}";;
+        r)  recurse="-r";;
         q)  quiet="-q";;
         q)  quiet="-q";;
         :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
         :)  error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
         \?) error "unknown option '%s'\n" "${OPTARG}";;
         \?) error "unknown option '%s'\n" "${OPTARG}";;
@@ -82,7 +83,7 @@ main() {
     # If the backend fails, we can just remove the temporary directory to
     # If the backend fails, we can just remove the temporary directory to
     # remove all the cruft it may have left behind. Then we just exit in
     # remove all the cruft it may have left behind. Then we just exit in
     # error too.
     # error too.
-    if ! "${OLDPWD}/support/download/${backend}" ${quiet} "${tmpf}" "${@}"; then
+    if ! "${OLDPWD}/support/download/${backend}" ${quiet} ${recurse} "${tmpf}" "${@}"; then
         rm -rf "${tmpd}"
         rm -rf "${tmpd}"
         exit 1
         exit 1
     fi
     fi