[pacman-dev] [PATCH v3] makepkg: Make VCS download functions use get_filename
Allan McRae
allan at archlinux.org
Sat Mar 9 17:17:45 EST 2013
On 10/03/13 02:50, Neer Sighted wrote:
> Make all VCS download functions uses get_filename to get the repo name.
> In addition, creating a working directory from a Bazaar repository now shows
> the short-name of the repository, not the full path on disk.
>
> I'm not sure if the name of the variable that holds the basename of the local
> clone should still be `repo`, but I have left the variable name for simplicity.
>
> Signed-off-by: Neer Sighted <neersighted at myopera.com>
> ---
> scripts/makepkg.sh.in | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index c9661e9..1658091 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -386,6 +386,10 @@ download_bzr() {
> url=${url##*bzr+}
> url=${url%%#*}
>
> + local dir=$(get_filepath "$netfile")
Why was that line moved? Otherwise patch is fine.
> +
> + local repo=$(get_filename "$netfile")
> +
> local fragment=${netfile#*#}
> if [[ $fragment = "$netfile" ]]; then
> unset fragment
> @@ -407,7 +411,6 @@ download_bzr() {
> esac
> fi
>
> - local dir=$(get_filepath "$netfile")
> [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
>
> if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
> @@ -432,12 +435,12 @@ download_bzr() {
> fi
> fi
>
> - msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr"
> + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "bzr"
> pushd "$srcdir" &>/dev/null
> rm -rf "${dir##*/}"
>
> if ! bzr checkout "$dir" --lightweight; then
> - error "$(gettext "Failure while creating working copy of %s %s repo")" "${dir}" "bzr"
> + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "bzr"
> plain "$(gettext "Aborting...")"
> exit 1
> fi
> @@ -456,9 +459,7 @@ download_git() {
> local dir=$(get_filepath "$netfile")
> [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
>
> - local repo=${netfile##*/}
> - repo=${repo%%#*}
> - repo=${repo%%.git*}
> + local repo=$(get_filename "$netfile")
>
> local url=$(get_url "$netfile")
> url=${url##*git+}
> @@ -536,8 +537,7 @@ download_hg() {
> local dir=$(get_filepath "$netfile")
> [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
>
> - local repo=${netfile##*/}
> - repo=${repo%%#*}
> + local repo=$(get_filename "$netfile")
>
> local url=$(get_url "$netfile")
> url=${url##*hg+}
> @@ -596,8 +596,7 @@ download_svn() {
> local dir=$(get_filepath "$netfile")
> [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")"
>
> - local repo=${netfile##*/}
> - repo=${repo%%#*}
> + local repo=$(get_filename "$netfile")
>
> local url=$(get_url "$netfile")
> if [[ $url != svn+ssh* ]]; then
>
More information about the pacman-dev
mailing list