summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-30 16:31:19 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-30 16:31:19 -0400
commitaf3e24f7ddbadac2bc17b73a4b3199ada5b97f92 (patch)
tree67cd3492c6f22faf07987e952aa3d4d73c5f710b
parent4a951bd1d646789bb383370566adda876372ca21 (diff)
fix bug in tar subdirectory extract code
-rw-r--r--Makefile17
-rwxr-xr-xutils/spec2file7
2 files changed, 11 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 72c4355..5b2ba57 100644
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ extract: PHONY $(foreach package,$(packages),build/extract/$(shell utils/spec2fi
# possibilities. `svn` doesn't have this issue, because, unlike `git`
# and `tar`, it's `extra` component is present in `build/download`.
-build/extract/git/%: # magic for loop
+build/extract/git/%: # magic foreach loop
gitref='$(shell utils/file2extra 'git/$*'|cut -d/ -f1)' && \
gitdir=build/extract/'$(shell utils/file2base 'git/$*')'/$${gitref} && \
rm -rf "$$gitdir" && \
@@ -67,12 +67,13 @@ build/extract/svn/%: build/download/svn/%
mkdir -p '$(@D)'
cp -a '$<' '$@'
-build/extract/tar/%: # magic for loop
- rm -rf '$@'
- mkdir -p '$@'
- cd '$@' && bsdtar --strip-components 1 -xf '$(top)/$<'
- cd '$@' && git init && git add . && git commit -q -m 'extracted $(shell utils/file2url 'tar/$*')' # XXX
-
+build/extract/tar/%: # magic foreach loop
+ basedir='build/extract/$(shell utils/file2base 'tar/$*')' && \
+ rm -rf "$$basedir" && \
+ { \
+ mkdir -p "$$basedir" && \
+ ( cd "$$basedir" && bsdtar --strip-components 1 -xf '$(top)/$<' ); \
+ } || rm -rf "$$basedir"
$(foreach package,$(packages),$(if $(filter-out svn|%,$($(package))),$(eval \
build/extract/$(shell utils/spec2file '$($(package))'): \
@@ -83,7 +84,7 @@ $(foreach package,$(packages),$(if $(filter-out svn|%,$($(package))),$(eval \
place: PHONY $(addprefix,build/compile/,$(packages))
-build/compile/%: $(call dep_optdir,patches/%) $(wild_optdir,delete/%.txt)
+build/compile/%:
rm -rf '$@'
mkdir -p '$(@D)'
cp -a '$<' '$@'
diff --git a/utils/spec2file b/utils/spec2file
index e59c5f2..f7eb6b5 100755
--- a/utils/spec2file
+++ b/utils/spec2file
@@ -6,8 +6,5 @@ url=${url//^/^5E}
url=${url//:/^3A}
url=${url//\//^2F}
-if [[ -z $extra ]]; then
- echo "${type}/${url}"
-else
- echo "${type}/${url}/${extra}"
-fi
+ret=${type}/${url}/${extra}
+echo "${ret%/}"