core/pkg-generic: allow packages to exclude files when extracting
authorYann E. MORIN <yann.morin.1998@free.fr>
Sat, 24 Oct 2015 12:48:53 +0000 (14:48 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 3 Nov 2015 21:20:30 +0000 (22:20 +0100)
Currently, packages that need to exclude parts of the archives when
extracting (e.g. to gain space), like gcc or toolchain-external, have to
provide custom extract commands, just for the sake of adding a bunch of
--exclude directives when calling tar.

Add a new variable that packages may set, to provide a space-separated
list of patterns to exclude.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
Reviewed-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
docs/manual/adding-packages-generic.txt
package/pkg-generic.mk

index 9d6401ff0275617d8d37bbec17e8d321d3e74999..a7143e428441512dd2c0262312752cddc3409abd 100644 (file)
@@ -314,6 +314,10 @@ information is (assuming the package name is +libfoo+) :
   that have more than one leading component to strip, set this
   variable with the value to be passed to tar. Default: 1.
 
+* +LIBFOO_EXCLUDES+ is a space-separated list of patterns to exclude
+  when extracting the archive. Each item from that list is passed as
+  a tar's +--exclude+ option. By default, empty.
+
 * +LIBFOO_DEPENDENCIES+ lists the dependencies (in terms of package
   name) that are required for the current target package to
   compile. These dependencies are guaranteed to be compiled and
index ffef4d3de1f77bb67b257bcf19d85e5801129367..8b189fed2c8e3c72fe372886623e6215891bad6d 100644 (file)
@@ -508,7 +508,10 @@ $(2)_TARGET_DIRCLEAN =             $$($(2)_DIR)/.stamp_dircleaned
 # default extract command
 $(2)_EXTRACT_CMDS ?= \
        $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $$(DL_DIR)/$$($(2)_SOURCE) | \
-       $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) -C $$($(2)_DIR) $$(TAR_OPTIONS) -)
+       $$(TAR) --strip-components=$$($(2)_STRIP_COMPONENTS) \
+               -C $$($(2)_DIR) \
+               $$(foreach x,$$($(2)_EXCLUDES),--exclude='$$(x)' ) \
+               $$(TAR_OPTIONS) -)
 
 # pre/post-steps hooks
 $(2)_PRE_DOWNLOAD_HOOKS         ?=