summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-15 01:36:41 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-15 01:36:41 -0400
commit80b378afd5e641809c373f55653b2049054510a2 (patch)
tree06e42c730d43ade6bf563dc6391ba93d7d1b9e9e /Makefile
parent00151d2bcdbe117adb4af0238fb3d8e54e43fa58 (diff)
Makefile: generalize tarbomb protection
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 6 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index d009939..3defb78 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ include conf/sources.mk
include conf/dependencies.mk
export MAVEN_LOCAL_REPO := $(shell $(CAT) conf/maven.local.repo.txt)
export JAR_DIR := $(shell $(CAT) conf/jardir.txt)
+tarbombs := $(foreach spec,$(_tarbombs),build/extract/$(shell utils/file2base "$$(utils/spec2file '$(spec)')"))
# download #####################################################################
@@ -86,26 +87,19 @@ build/extract/svn/%: build/download/svn/%
$(CP) -a '$<' '$@'
$(TOUCH) '$@'
+basedir=build/extract/$(shell utils/file2base 'tar/$*')
build/extract/tar/%: # magic foreach loop
- basedir='build/extract/$(shell utils/file2base 'tar/$*')' && \
- $(RM) -r "$$basedir" && \
+ $(RM) -r '$(basedir)' && \
{ \
- $(MKDIRS) "$$basedir" && \
- ( cd "$$basedir" && $(TAR) -m --strip-components 1 -xf '$(top)/$<' ); \
- } || { $(RM) -r "$$basedir"; $(FAIL); }
+ $(MKDIRS) '$(basedir)' && \
+ ( cd '$(basedir)' && $(TAR) -m $(if $(filter $(basedir),$(tarbombs)),,--strip-components 1) -xf '$(top)/$<' ); \
+ } || { $(RM) -r '$(basedir)'; $(FAIL); }
$(foreach package,$(packages),$(if $(filter-out svn|%,$($(package))),$(eval \
build/extract/$(shell utils/spec2file '$($(package))'): \
build/download/$(shell utils/file2base "$$(utils/spec2file '$($(package))')") \
)))
-build/extract/tar/http^3A^2F^2Fdownload.forge.objectweb.org^2Fmonolog^2Fow_util_ant_tasks_1.3.2.zip: build/extract/tar/%: build/download/tar/%
- $(RM) -r '$@' && \
- { \
- $(MKDIRS) '$@' && \
- ( cd '$@' && $(TAR) -m -xf '$(top)/$<' ); \
- } || { $(RM) -r '$@'; $(FAIL); }
-
# place (patch) ################################################################
place: PHONY $(addprefix build/workdir/,$(packages))