summaryrefslogtreecommitdiffstats
path: root/build/install-build-deps.sh
diff options
context:
space:
mode:
authortorne <torne@chromium.org>2015-11-05 04:43:08 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-05 12:43:59 +0000
commit8a6eb6958e85d742f70a8cc4c85a24c5efa93cee (patch)
tree5201cb7e68aef12a5f8f86d6a8202b2ae8f0543b /build/install-build-deps.sh
parentfcdad2be07cb19e9f58b451599d14d2ff0b7b235 (diff)
downloadchromium_src-8a6eb6958e85d742f70a8cc4c85a24c5efa93cee.zip
chromium_src-8a6eb6958e85d742f70a8cc4c85a24c5efa93cee.tar.gz
chromium_src-8a6eb6958e85d742f70a8cc4c85a24c5efa93cee.tar.bz2
Improve install-build-deps mesa handling.
Instead of hardcoding a list of which LTS variants of mesa might be installed, just query for any package that matches the expected pattern and if exactly one is installed, use that. If zero are installed, use the base package. There shouldn't be more than one as these packages conflict with each other, so just abort if that happens. This avoids needing to extend the loop in this script every time a new Ubuntu backport package is added. BUG= Review URL: https://codereview.chromium.org/1434453002 Cr-Commit-Position: refs/heads/master@{#358039}
Diffstat (limited to 'build/install-build-deps.sh')
-rwxr-xr-xbuild/install-build-deps.sh29
1 files changed, 19 insertions, 10 deletions
diff --git a/build/install-build-deps.sh b/build/install-build-deps.sh
index 4b34981..1fcd851 100755
--- a/build/install-build-deps.sh
+++ b/build/install-build-deps.sh
@@ -174,16 +174,25 @@ nacl_list="g++-mingw-w64-i686 lib32z1-dev
libxrandr2:i386 libxss1:i386 libxtst6:i386 texinfo xvfb
${naclports_list}"
-# Find the proper version of libgbm-dev. We can't just install libgbm-dev as
-# it depends on mesa, and only one version of mesa can exists on the system.
-# Hence we must match the same version or this entire script will fail.
-mesa_variant=""
-for variant in "-lts-trusty" "-lts-utopic"; do
- if $(dpkg-query -Wf'${Status}' libgl1-mesa-glx${variant} 2>/dev/null | \
- grep -q " ok installed"); then
- mesa_variant="${variant}"
- fi
-done
+# Find the proper version of packages that depend on mesa. Only one -lts variant
+# of mesa can be installed and everything that depends on it must match.
+
+# Query for the name and status of all mesa LTS variants, filter for only
+# installed packages, extract just the name, and eliminate duplicates (there can
+# be more than one with the same name in the case of multiarch). Expand into an
+# array.
+mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \
+ libgl1-mesa-glx-lts-\* | \
+ grep " ok installed" | cut -d " " -f 1 | sort -u))
+if [ "${#mesa_packages[@]}" -eq 0 ]; then
+ mesa_variant=""
+elif [ "${#mesa_packages[@]}" -eq 1 ]; then
+ # Strip the base package name and leave just "-lts-whatever"
+ mesa_variant="${mesa_packages[0]#libgl1-mesa-glx}"
+else
+ echo "ERROR: unable to determine which libgl1-mesa-glx variant is installed."
+ exit 1
+fi
dev_list="${dev_list} libgbm-dev${mesa_variant}
libgles2-mesa-dev${mesa_variant} libgl1-mesa-dev${mesa_variant}
mesa-common-dev${mesa_variant}"