summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-11-25 11:00:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-11-25 11:00:29 +0000
commitb9ce3c170a98058e71eef08205e37a2a22933277 (patch)
tree8a1999b7d830a9c01ba5375e3a2d2799245b926a
parentc3408b76fee1198cce04cd026c3a50da88d386ce (diff)
downloadabuild-b9ce3c170a98058e71eef08205e37a2a22933277.tar.gz
abuild-b9ce3c170a98058e71eef08205e37a2a22933277.tar.bz2
abuild-b9ce3c170a98058e71eef08205e37a2a22933277.tar.xz
abuild-b9ce3c170a98058e71eef08205e37a2a22933277.zip
implement is_remote(). fix up2date to deal with $SRCDEST properly.
-rwxr-xr-xabuild41
1 files changed, 25 insertions, 16 deletions
diff --git a/abuild b/abuild
index e465427..fcc8128 100755
--- a/abuild
+++ b/abuild
@@ -129,19 +129,24 @@ uri_fetch() {
&& mv "$SRCDEST/$d.part" "$SRCDEST/$d"
}
+is_remote() {
+ case "$1" in
+ http://*|ftp://*)
+ return 0;;
+ esac
+ return 1
+}
+
fetch() {
local s
mkdir -p "$srcdir"
- for s in $source; do
- case "$s" in
- http://*|ftp://*)
- uri_fetch "$s" || return 1
- ln -sf "$SRCDEST/${s##*/}" "$srcdir"/
- ;;
- *)
- ln -sf "$startdir/$s" "$srcdir/"
- ;;
- esac
+ for s in $source; do
+ if is_remote "$s"; then
+ uri_fetch "$s" || return 1
+ ln -sf "$SRCDEST/${s##*/}" "$srcdir"/
+ else
+ ln -sf "$startdir/$s" "$srcdir/"
+ fi
done
}
@@ -181,11 +186,10 @@ clean() {
cleancache() {
local s
for s in $source; do
- case "$s" in
- http://*|ftp://*)
- msg "Cleaning downloaded ${s##*/}..."
- rm -f "$SRCDEST/${s##*/}";;
- esac
+ if is_remote "$s"; then
+ msg "Cleaning downloaded ${s##*/}..."
+ rm -f "$SRCDEST/${s##*/}"
+ fi
done
}
@@ -377,7 +381,12 @@ up2date() {
cd "$startdir"
[ -f "$pkg" ] || return 1
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
return 1
fi