diff mbox series

[v2,for,3.0,16/16] docker: ignore distro versioning of debootstrap

Message ID 20180713121741.19262-17-alex.bennee@linaro.org
State New
Headers show
Series various docker fixes | expand

Commit Message

Alex Bennée July 13, 2018, 12:17 p.m. UTC
We do a minimum version check for the debootstrap but if the distro
has added their own minor version tick it would fail and fall-back to
the SCM version. This is sub-optimal as the latest/greatest version
may be broken at any one particular time. We fix that with a little
sed magic on the version string before passing to our ugly shell
versioning check.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/dockerfiles/debian-bootstrap.pre | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé July 17, 2018, 3:52 p.m. UTC | #1
On 07/13/2018 09:17 AM, Alex Bennée wrote:
> We do a minimum version check for the debootstrap but if the distro
> has added their own minor version tick it would fail and fall-back to
> the SCM version. This is sub-optimal as the latest/greatest version
> may be broken at any one particular time. We fix that with a little
> sed magic on the version string before passing to our ugly shell
> versioning check.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tests/docker/dockerfiles/debian-bootstrap.pre | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/docker/dockerfiles/debian-bootstrap.pre b/tests/docker/dockerfiles/debian-bootstrap.pre
> index ea324d6e4a..3b0ef95374 100755
> --- a/tests/docker/dockerfiles/debian-bootstrap.pre
> +++ b/tests/docker/dockerfiles/debian-bootstrap.pre
> @@ -56,10 +56,13 @@ if [ -z $DEBOOTSTRAP_DIR ]; then
>      if [ -z $DEBOOTSTRAP ]; then
>          echo "No debootstrap installed, attempting to install from SCM"
>          NEED_DEBOOTSTRAP=true
> -    elif ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; "${DEBOOTSTRAP}" --version \
> -            | cut -d ' ' -f 2) | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -c &>/dev/null; then
> -        echo "debootstrap too old, attempting to install from SCM"
> -        NEED_DEBOOTSTRAP=true
> +    else
> +        INSTALLED_VERSION=$(${DEBOOTSTRAP} --version | sed 's/debootstrap \([0-9\.]*\)[^0-9\.]*.*/\1/')
> +        if ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; echo "${INSTALLED_VERSION}") \
> +                | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -C ; then
> +            echo "debootstrap too old, attempting to install from SCM"
> +            NEED_DEBOOTSTRAP=true
> +        fi
>      fi
>      if $NEED_DEBOOTSTRAP; then
>          DEBOOTSTRAP_SOURCE=https://salsa.debian.org/installer-team/debootstrap.git
>
diff mbox series

Patch

diff --git a/tests/docker/dockerfiles/debian-bootstrap.pre b/tests/docker/dockerfiles/debian-bootstrap.pre
index ea324d6e4a..3b0ef95374 100755
--- a/tests/docker/dockerfiles/debian-bootstrap.pre
+++ b/tests/docker/dockerfiles/debian-bootstrap.pre
@@ -56,10 +56,13 @@  if [ -z $DEBOOTSTRAP_DIR ]; then
     if [ -z $DEBOOTSTRAP ]; then
         echo "No debootstrap installed, attempting to install from SCM"
         NEED_DEBOOTSTRAP=true
-    elif ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; "${DEBOOTSTRAP}" --version \
-            | cut -d ' ' -f 2) | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -c &>/dev/null; then
-        echo "debootstrap too old, attempting to install from SCM"
-        NEED_DEBOOTSTRAP=true
+    else
+        INSTALLED_VERSION=$(${DEBOOTSTRAP} --version | sed 's/debootstrap \([0-9\.]*\)[^0-9\.]*.*/\1/')
+        if ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; echo "${INSTALLED_VERSION}") \
+                | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -C ; then
+            echo "debootstrap too old, attempting to install from SCM"
+            NEED_DEBOOTSTRAP=true
+        fi
     fi
     if $NEED_DEBOOTSTRAP; then
         DEBOOTSTRAP_SOURCE=https://salsa.debian.org/installer-team/debootstrap.git