Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-06-04 12:02:36 +1000
committerAllan McRae <allan@archlinux.org>2012-08-04 00:16:38 +1000
commitcca9849fc25012845b08ce877f9450e45c9d207d (patch)
tree5ec9a1b6660ca42de2f833b9817cb0c9787366cd
parentaa6fe1160b39cd364a6595b7c9f56acb1cea3432 (diff)
makepkg: modify get_filepath to handle VCS sources
With VCS sources, get_filepath should return the directory of the checkout. This allows backing up of the VCS checkout when using --allsource. Fixes FS#21098. Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in40
1 files changed, 23 insertions, 17 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8f163d32..d6f314ac 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -193,19 +193,30 @@ enter_fakeroot() {
# 2) "http://path/to/file"
# Return the absolute filename of a source entry
-#
-# This function accepts a source entry or the already extracted filename of a
-# source entry as input
get_filepath() {
local file="$(get_filename "$1")"
+ local proto="$(get_protocol "$1")"
- if [[ -f "$startdir/$file" ]]; then
- file="$startdir/$file"
- elif [[ -f "$SRCDEST/$file" ]]; then
- file="$SRCDEST/$file"
- else
- return 1
- fi
+ case $proto in
+ git*)
+ if [[ -d "$startdir/$file" ]]; then
+ file="$startdir/$file"
+ elif [[ -d "$SRCDEST/$file" ]]; then
+ file="$SRCDEST/$file"
+ else
+ return 1
+ fi
+ ;;
+ *)
+ if [[ -f "$startdir/$file" ]]; then
+ file="$startdir/$file"
+ elif [[ -f "$SRCDEST/$file" ]]; then
+ file="$SRCDEST/$file"
+ else
+ return 1
+ fi
+ ;;
+ esac
printf "%s\n" "$file"
}
@@ -369,18 +380,13 @@ download_git() {
unset fragment
fi
- local dir=$(get_filename "$netfile")
+ local dir=$(get_filepath "$netfile")
+ [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
local repo=${netfile##*/}
repo=${repo%%#*}
repo=${repo%%.git*}
- if [[ ! -d "$startdir"/$dir ]]; then
- dir="$SRCDEST"/$dir
- else
- dir="$startdir"/$dir
- fi
-
local url=$(get_url "$netfile")
url=${url##*git+}
url=${url%%#*}