debian-setup: fix GnuTLS installation for Ubuntu 14.04
authorPeter Wu <peter@lekensteyn.nl>
Mon, 11 Jun 2018 11:31:42 +0000 (13:31 +0200)
committerDario Lombardo <lomato@gmail.com>
Mon, 11 Jun 2018 15:03:01 +0000 (15:03 +0000)
Ubuntu 14.04 ships with gnutls28 3.2.11 which might be
license-incompatible with GPL 2.0 and should thus not be used. Fallback
to the older gnutls-dev package in that case.

Change-Id: I39824a5aee08de1df3790a1a8ff84c9769afd158
Reviewed-on: https://code.wireshark.org/review/28200
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
tools/debian-setup.sh

index 53ae9113e24528d15156aa175d5cedca90a0e5a4..001be5a1fe35fcd822a224bd9d379981f4d9e899 100755 (executable)
@@ -71,12 +71,20 @@ ADDITIONAL_LIST="libnl-3-dev \
        doxygen \
        xsltproc"
 
-# Adds package $2 to list variable $1 if the package is found
+# Adds package $2 to list variable $1 if the package is found.
+# If $3 is given, then this version requirement must be satisfied.
 add_package() {
-       local list="$1" pkgname="$2"
+       local list="$1" pkgname="$2" versionreq="$3" version
 
+       version=$(apt-cache show "$pkgname" 2>/dev/null |
+               awk '/^Version:/{ print $2; exit}')
        # fail if the package is not known
-       [ -n "$(apt-cache show "$pkgname" 2>/dev/null)" ] || return 1
+       if [ -z "$version" ]; then
+               return 1
+       elif [ -n "$versionreq" ]; then
+               # Require minimum version or fail.
+               dpkg --compare-versions $version $versionreq || return 1
+       fi
 
        # package is found, append it to list
        eval "${list}=\"\${${list}} \${pkgname}\""
@@ -99,7 +107,7 @@ echo "libssh-gcrypt-dev and libssh-dev are unavailable" >&2
 
 # libgnutls-dev: Debian <= jessie, Ubuntu <= 16.04
 # libgnutls28-dev: Debian >= wheezy-backports, Ubuntu >= 12.04
-add_package ADDITIONAL_LIST libgnutls28-dev ||
+add_package ADDITIONAL_LIST libgnutls28-dev ">= 3.2.14-1" ||
 add_package ADDITIONAL_LIST libgnutls-dev ||
 echo "libgnutls28-dev and libgnutls-dev are unavailable" >&2