summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-29 04:08:33 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-29 04:08:33 -0400
commitb1c46c1e5a498919a6fa8cd0884e46271e5d6371 (patch)
tree6b3bc48b8a284a7798320032fa419e5c7f93ab6e
parent0580290eca9424a1be5d694a2f2c68739c170e28 (diff)
fix things
-rw-r--r--Makefile30
-rwxr-xr-xutils/file2url2
-rwxr-xr-xutils/spec2file7
3 files changed, 21 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index a24b818..9205e78 100644
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,6 @@ top := $(shell pwd)
export MAVEN_LOCAL_REPO_INSTALL = $(shell cat conf/maven.local.repo.txt)
export MAVEN_LOCAL_REPO_SEARCH = $(top)/build/packages/dest/$(MAVEN_LOCAL_REPO_INSTALL)
-export PATH := $(top)/utils:$(PATH)
-
all: package
packages := $(filter-out _%,$(shell sed "s/[\# ].*//" conf/sources.mk))
include conf/sources.mk
@@ -17,26 +15,26 @@ build/download/git/%: .tokens/network
if [ -d '$@' ]; then \
cd '$@' && git fetch --all -p; \
else \
- mkdir -p '$(@D)' && git clone --mirror "$$(file2url 'git/$*')" '$@'; \
+ mkdir -p '$(@D)' && git clone --mirror '$(shell utils/file2url 'git/$*')' '$@'; \
fi
touch '$@'
build/download/svn/%: .tokens/network
- if ! [ -d "$$(file2base 'svn/$*')" ]; then \
+ if ! [ -d '$(shell utils/file2base 'svn/$*')' ]; then \
rm -rf '$@' && \
mkdir -p build/download/svn && \
svn checkout --depth=empty \
- "$$(file2url 'svn/$*')" \
- build/download/"$$(file2base 'svn/$*')" && \
- cd build/download/"$$(file2base 'svn/$*')"; \
+ '$(shell utils/file2url 'svn/$*')' \
+ build/download/'$(shell utils/file2base 'svn/$*')' && \
+ cd build/download/'$(shell utils/file2base 'svn/$*')'; \
else \
- cd build/download/"$$(file2base 'svn/$*')" && \
+ cd build/download/'$(shell utils/file2base 'svn/$*')' && \
svn update; \
fi && \
- svn update --parents "$$(file2extra 'svn/$*')"
+ svn update --parents '$(shell utils/file2extra 'svn/$*')'
touch '$@'
build/download/tar/%: .tokens/network
mkdir -p '$(@D)'
- wget -c -O '$@' "$$(file2url tar/$*)"
+ wget -c -O '$@' '$(shell utils/file2url 'tar/$*')'
touch '$@'
# extract ######################################################################
@@ -44,12 +42,12 @@ build/download/tar/%: .tokens/network
extract: PHONY $(foreach package,$(packages),build/extract/$(shell utils/spec2file '$($(package))'))
build/extract/git/%:
- gitref="$$(file2extra 'git/$*'|cut -d/ -f1)" && \
- gitdir=build/extract/"$$(file2base 'git/$*')/$${gitref}" && \
+ gitref='$(shell utils/file2extra 'git/$*'|cut -d/ -f1)' && \
+ gitdir=build/extract/'$(shell utils/file2base 'git/$*')'/$${gitref} && \
rm -rf "$$gitdir" && \
{ \
mkdir -p "$$(dirname "$$gitdir")" && \
- git clone build/download/"$$(file2base 'git/$*')" "$$gitdir" && \
+ git clone build/download/'$(shell utils/file2base 'git/$*')' "$$gitdir" && \
( cd "$$gitdir" && git checkout "$$gitref" ); \
} || rm -rf "$$gitdir"
touch '$@'
@@ -64,9 +62,9 @@ build/extract/svn/%: build/download/svn/%
cp -a '$<' '$@'
build/extract/tar/%: build/download/tar/%
rm -rf '$@'
- mkdir -p '$(@D)'
- cd '$(@D)' && tar xaf '$(top)/$<'
- cd '$@' && git init && git add . && git commit -q -m "extracted $$(file2url 'tar/$*')" # XXX
+ mkdir -p '$@'
+ cd '$@' && bsdtar --strip-components 1 -xf '$(top)/$<'
+ cd '$@' && git init && git add . && git commit -q -m 'extracted $(shell utils/file2url 'tar/$*')' # XXX
# place ########################################################################
diff --git a/utils/file2url b/utils/file2url
index 868f94f..83f1360 100755
--- a/utils/file2url
+++ b/utils/file2url
@@ -3,7 +3,7 @@
IFS=/ read -r type url extra <<<"$*"
case "$type" in
git|svn) url=${url//^2F//};;
- tar) :;;
+ tar) [[ -z $extra ]] || url=$url/$extra;;
esac
url=${url//^3A/:}
url=${url//^5E/^}
diff --git a/utils/spec2file b/utils/spec2file
index 3b5e883..2fb1168 100755
--- a/utils/spec2file
+++ b/utils/spec2file
@@ -7,4 +7,9 @@ case "$type" in
git|svn) url=${url//\//^2F};;
tar) :;;
esac
-echo "${type}/${url}/${extra}"
+
+if [[ -z $extra ]]; then
+ echo "${type}/${url}"
+else
+ echo "${type}/${url}/${extra}"
+fi