[pacman-dev] [PATCH] makepkg: replace basename emulation via sed with a bash substitution

Cedric Staniewski cedric at gmx.ca
Sat Oct 17 13:41:46 EDT 2009


Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
---
 scripts/makepkg.sh.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 24fddf6..ad8b6da 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -190,7 +190,7 @@ get_filename() {
 	# if a filename is specified, use it
 	local filename=$(echo $1 | sed 's|::.*||')
 	# if it is just an URL, we only keep the last component
-	echo "$filename" | sed 's|^.*://.*/||g'
+	echo "${filename##*/}"
 }
 
 # extract the URL from a source entry
@@ -282,7 +282,7 @@ in_array() {
 get_downloadclient() {
 	# $1 = URL with valid protocol prefix
 	local url=$1
-	local proto=$(echo "$url" | sed 's|://.*||')
+	local proto=$(echo ${url##*/})
 
 	# loop through DOWNLOAD_AGENTS variable looking for protocol
 	local i
-- 
1.6.5



More information about the pacman-dev mailing list