[pacman-dev] [PATCH 2/2] Accept all bzr URLs in the source array

Dave Reisner d at falconindy.com
Tue Apr 9 08:30:40 EDT 2013


On Tue, Apr 9, 2013 at 5:28 AM, Maxime Gauduin <alucryd at gmail.com> wrote:

> From: Alucryd <alucryd at gmail.com>
>
> This check will run 'bzr info' on the distant URL provided in the source
> array and compare the branch root URL with the output of
> 'bzr config parent_location' run inside the local repo to make sure we
> are building from the right sources. Previously, the check was only run
> locally, as a result the local parent_location had to be used in the
> source array. makepkg will fallback to this behavior for offline builds.
>
> Signed-off-by: Maxime Gauduin <alucryd at gmail.com>
> ---
>  scripts/makepkg.sh.in | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index d5b9077..0ac4975 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -474,10 +474,21 @@ download_bzr() {
>                 fi
>         elif (( ! HOLDVER )); then
>                 # Make sure we are fetching the right repo
> -               if [[ "$url" != "$(bzr config parent_location -d $dir)"
>  ]] ; then
> -                       error "$(gettext "%s is not a branch of %s")"
> "$dir" "$url"
> -                       plain "$(gettext "Aborting...")"
> -                       exit 1
> +               local distant_url="$(bzr info "$url" 2> /dev/null | grep
> 'branch root' | sed 's|  branch root: ||')"
>

grep|sed is pretty much always redundant -- sed can do this match on its
own:

  sed -n '/branch root/ { s/  branch root: //p; q; }'

And, just nitpicking, but quoting isn't needed for simple variable
assignment.

+               local local_url="$(bzr config parent_location -d "$dir")


Same here.


> +               if [[ -n "$distant_url" ]]; then
>

Quoting isn't needed here either.


> +                       if [[ "$distant_url" != "$local_url" ]]; then
>

Or on the LHS here.


> +                               error "$(gettext "%s is not a branch of
> %s")" "$dir" "$url"
> +                               plain "$(gettext "Aborting...")"
> +                               exit 1
> +                       fi
> +               else
> +                       if [[ "$url" != "$local_url" ]] ; then
>

And same here.


> +                               error "$(gettext "%s is not a branch of
> %s")" "$dir" "$url"
> +                               error "$(gettext "The local URL is %s")"
> "$local_url"
> +                               plain "$(gettext "Aborting...")"
> +                               exit 1
> +                       fi
>                 fi
>                 msg2 "$(gettext "Pulling %s ...")" "${displaylocation}"
>                 cd_safe "$dir"
> --
> 1.8.2
>
>
>


More information about the pacman-dev mailing list