1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

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>
This commit is contained in:
Allan McRae 2012-06-04 11:39:15 +10:00
parent 682c9af846
commit aa6fe1160b

View File

@ -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