Commit b9ce3c17 authored by Natanael Copa's avatar Natanael Copa
Browse files

implement is_remote(). fix up2date to deal with $SRCDEST properly.

parent c3408b76
...@@ -129,19 +129,24 @@ uri_fetch() { ...@@ -129,19 +129,24 @@ uri_fetch() {
&& mv "$SRCDEST/$d.part" "$SRCDEST/$d" && mv "$SRCDEST/$d.part" "$SRCDEST/$d"
} }
is_remote() {
case "$1" in
http://*|ftp://*)
return 0;;
esac
return 1
}
fetch() { fetch() {
local s local s
mkdir -p "$srcdir" mkdir -p "$srcdir"
for s in $source; do for s in $source; do
case "$s" in if is_remote "$s"; then
http://*|ftp://*) uri_fetch "$s" || return 1
uri_fetch "$s" || return 1 ln -sf "$SRCDEST/${s##*/}" "$srcdir"/
ln -sf "$SRCDEST/${s##*/}" "$srcdir"/ else
;; ln -sf "$startdir/$s" "$srcdir/"
*) fi
ln -sf "$startdir/$s" "$srcdir/"
;;
esac
done done
} }
...@@ -181,11 +186,10 @@ clean() { ...@@ -181,11 +186,10 @@ clean() {
cleancache() { cleancache() {
local s local s
for s in $source; do for s in $source; do
case "$s" in if is_remote "$s"; then
http://*|ftp://*) msg "Cleaning downloaded ${s##*/}..."
msg "Cleaning downloaded ${s##*/}..." rm -f "$SRCDEST/${s##*/}"
rm -f "$SRCDEST/${s##*/}";; fi
esac
done done
} }
...@@ -377,7 +381,12 @@ up2date() { ...@@ -377,7 +381,12 @@ up2date() {
cd "$startdir" cd "$startdir"
[ -f "$pkg" ] || return 1 [ -f "$pkg" ] || return 1
for i in $source APKBUILD; do for i in $source APKBUILD; do
local s="$SRCDEST/${i##*/}" # $(basename $i) local s
if is_remote "$i"; then
s="$SRCDEST/${i##*/}" # $(basename $i)
else
s="$startdir/${i##*/}"
fi
if [ "$s" -nt "$pkg" ]; then if [ "$s" -nt "$pkg" ]; then
return 1 return 1
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment