[pacman-dev] [PATCH] makepkg: replace basename emulation via sed with a bash substitution
Allan McRae
allan at archlinux.org
Sun Oct 18 01:26:32 EDT 2009
Cedric Staniewski wrote:
> 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|::.*||')
>
We could also use bash substitution for that line.
> # 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
>
and about two lines below here...
> @@ -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
>
More information about the pacman-dev
mailing list