diff --git a/docs/manual/adding-packages-generic.txt b/docs/manual/adding-packages-generic.txt index fbe37f9ca9..299017f9d2 100644 --- a/docs/manual/adding-packages-generic.txt +++ b/docs/manual/adding-packages-generic.txt @@ -347,6 +347,12 @@ not and can not work as people would expect it should: Git LFS to store large files out of band. This is only available for packages downloaded with git (i.e. when +LIBFOO_SITE_METHOD=git+). ++ +LIBFOO_SVN_EXTERNAL+ can be set to +YES+ (the default) to specify + whether to retrieve the svn external references, or to +NO+ to avoid + retrieving those externals. Note that, contrary to other similar + options like +LIBFOO_GIT_SUBMODULES+ or +LIBFOO_GIT_LFS+, the default + here is to actually retrieve the externals; this is a legacy heritage. + * +LIBFOO_STRIP_COMPONENTS+ is the number of leading components (directories) that tar must strip from file names on extraction. The tarball for most packages has one leading component named diff --git a/package/pkg-download.mk b/package/pkg-download.mk index 0718f21aad..5a311a95c6 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -119,6 +119,7 @@ define DOWNLOAD -n '$($(2)_BASENAME_RAW)' \ -N '$($(2)_RAWNAME)' \ -o '$($(2)_DL_DIR)/$(notdir $(1))' \ + $(if $(filter YES,$($(2)_SVN_EXTERNALS)),-r) \ $(if $($(2)_GIT_SUBMODULES),-r) \ $(if $($(2)_GIT_LFS),-l) \ $(foreach uri,$(call DOWNLOAD_URIS,$(1),$(2)),-u $(uri)) \ diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 5d1c1da128..86b9c1f9d3 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -643,6 +643,16 @@ ifndef $(2)_GIT_SUBMODULES endif endif +ifndef $(2)_SVN_EXTERNALS + ifdef $(3)_SVN_EXTERNALS + $(2)_SVN_EXTERNALS = $$($(3)_SVN_EXTERNALS) + else + # Legacy: we used to always use externals by default + # Only set it when the package is actually hosted on svn + $(2)_SVN_EXTERNALS = $$(if $$(filter svn,$$($(2)_SITE_METHOD)),YES) + endif +endif + # Do not accept to download git submodule if not using the git method ifneq ($$($(2)_GIT_SUBMODULES),) ifneq ($$($(2)_SITE_METHOD),git) diff --git a/support/download/svn b/support/download/svn index 3e08a0ef36..1decb2310b 100755 --- a/support/download/svn +++ b/support/download/svn @@ -16,6 +16,7 @@ set -e # -u URI Checkout from repository at URI. # -c REV Use revision REV. # -n NAME Use basename NAME. +# -r Recursive, i.e. use externals # # Environment: # SVN : the svn command to call @@ -24,6 +25,7 @@ set -e . "${0%/*}/helpers" quiet= +externals=--ignore-externals while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do case "${OPT}" in q) quiet=-q;; @@ -31,6 +33,7 @@ while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do u) uri="${OPTARG}";; c) rev="${OPTARG}";; n) basename="${OPTARG}";; + r) externals=;; :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;; \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;; esac @@ -52,7 +55,8 @@ _plain_svn() { eval ${SVN} "${@}" } -_svn export --ignore-keywords ${quiet} "${@}" "'${uri}@${rev}'" "'${basename}'" +# shellcheck disable=SC2086 # externals and quiet may be empty +_svn export --ignore-keywords ${quiet} ${externals} "${@}" "'${uri}@${rev}'" "'${basename}'" # For 'svn info', we only need the credentials, if any; other options # would be invalid, as they are intended for 'svn export'.