[pacman-dev] [PATCH 08/11] makepkg: modify get_filename to handle VCS sources
Allan McRae
allan at archlinux.org
Tue Jun 26 18:58:14 EDT 2012
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 at archlinux.org>
---
scripts/makepkg.sh.in | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f8d46f1..6884272 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -210,10 +210,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
@@ -349,15 +367,12 @@ download_git() {
unset fragment
fi
- local folder=${netfile%%::*}
+ local folder=$(get_filename "$netfile")
+
local repo=${netfile##*/}
repo=${repo%%#*}
repo=${repo%%.git*}
- if [[ $folder = "$netfile" ]]; then
- folder="${repo}"
- fi
-
if [[ ! -d "$startdir"/$folder && -d "$SRCDEST"/$folder ]]; then
folder="$SRCDEST"/$folder
else
--
1.7.11.1
More information about the pacman-dev
mailing list