From aa6fe1160b39cd364a6595b7c9f56acb1cea3432 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 4 Jun 2012 11:39:15 +1000 Subject: makepkg: modify get_filename to handle VCS sources Modify get_filename to return the name of the folder with VCS sources. This fixes output issues in checksum checking. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 55ec353d..8f163d32 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -212,10 +212,28 @@ get_filepath() { # extract the filename from a source entry get_filename() { + local netfile=$1 + # if a filename is specified, use it - local filename="${1%%::*}" - # if it is just an URL, we only keep the last component - printf "%s\n" "${filename##*/}" + if [[ $netfile = *::* ]]; then + printf "%s\n" ${netfile%%::*} + return + fi + + local proto=$(get_protocol "$netfile") + + case $proto in + git*) + filename=${netfile##*/} + filename=${filename%%#*} + filename=${filename%%.git*} + ;; + *) + # if it is just an URL, we only keep the last component + filename="${netfile##*/}" + ;; + esac + printf "%s\n" "${filename}" } # extract the URL from a source entry @@ -351,15 +369,12 @@ download_git() { unset fragment fi - local dir=${netfile%%::*} + local dir=$(get_filename "$netfile") + local repo=${netfile##*/} repo=${repo%%#*} repo=${repo%%.git*} - if [[ $dir = "$netfile" ]]; then - dir="${repo}" - fi - if [[ ! -d "$startdir"/$dir ]]; then dir="$SRCDEST"/$dir else -- cgit v1.2.3-70-g09d2