diff options
author | Allan McRae <allan@archlinux.org> | 2012-06-04 03:39:15 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2012-08-03 16:16:38 +0200 |
commit | aa6fe1160b39cd364a6595b7c9f56acb1cea3432 (patch) | |
tree | c927e09bb34a8e9e38b6a49775718cfe0bd44235 | |
parent | 682c9af846718cd387da058c39967550b7eeb01f (diff) | |
download | pacman-aa6fe1160b39cd364a6595b7c9f56acb1cea3432.tar.gz pacman-aa6fe1160b39cd364a6595b7c9f56acb1cea3432.tar.xz |
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 <allan@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 31 |
1 files changed, 23 insertions, 8 deletions
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 |