[PATCH STABLE] docker: match more version of 'hg docker version' (issue4967)

Anton Shestakov engored at ya.ru
Wed Nov 25 06:38:50 CST 2015


25.11.2015, 10:17, "Pierre-Yves David" <pierre-yves.david at ens-lyon.org>:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1448417605 28800
> # Tue Nov 24 18:13:25 2015 -0800
> # Branch stable
> # Node ID 05635441f955acbdab243156af39e79addda1c34
> # Parent 6979fe2a6d75105affcacd9e298262a92641cb98
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> # hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 05635441f955
> docker: match more version of 'hg docker version' (issue4967)
>
> My version of docker (1.8.3) have a different formating for 'docker version'
> that broke the build script. We make the version matching more generic in to
> work with both version.
>
> diff --git a/contrib/dockerlib.sh b/contrib/dockerlib.sh
> --- a/contrib/dockerlib.sh
> +++ b/contrib/dockerlib.sh
> @@ -12,12 +12,12 @@ function checkdocker() {
>      echo "Error: docker must be installed"
>      exit 1
>    fi
>
>    $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; }
> - $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
> - $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }
> + $DOCKER version | grep -Eq "^(Client version|Client):" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
> + $DOCKER version | grep -Eq "^(Server version|Server):" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }

A couple of tiny nitpicks:

- The regex could be just '^Client( version)?:'.
- I'm not sure how applicable https://www.mercurial-scm.org/wiki/WritingTests#grep is to dockerlib.sh (i.e. to platforms with good docker host support), but it recommends using egrep instead of grep -E for portability.


More information about the Mercurial-devel mailing list