Repository: spack/spack

Issue:
Installation issue: mesa@21.0.0 fails to build
<!-- Thanks for taking the time to report this build failure. To proceed with the report please:

1. Title the issue "Installation issue: <name-of-the-package>".
2. Provide the information required below.

We encourage you to try, as much as possible, to reduce your problem to the minimal example that still reproduces the issue. That would help us a lot in fixing it quickly and effectively! -->
Building mesa@21.0.0 fails with an error, see below. The 20.3.4 version builds fine so something must have changed between mesa-20 and mesa-21.

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install mesa
...
==> Ran patch() for mesa
==> mesa: Executing phase: 'meson'
==> Error: ProcessError: Command exited with status 1:
    'meson' '/tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src' '--prefix=/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti' '--libdir=/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/lib' '--buildtype=release' '--strip' '-Dvulkan-drivers=' '-Dgallium-vdpau=disabled' '-Dgallium-xvmc=disabled' '-Dgallium-omx=disabled' '-Dgallium-va=disabled' '-Dgallium-xa=disabled' '-Dgallium-nine=false' '-Dgallium-opencl=disabled' '-Dbuild-tests=false' '-Dglvnd=false' '-Dosmesa=gallium' '-Dgallium=true' '-Dglx=gallium-xlib' '-Degl=disabled' '-Dgbm=disabled' '-Ddri3=disabled' '-Dopengl=true' '-Dgles1=disabled' '-Dgles2=disabled' '-Dshared-glapi=enabled' '-Dllvm=enabled' '-Dshared-llvm=disabled' '-Dswr-arches=avx,avx2' '-Dplatforms=x11' '-Dgallium-drivers=swrast,swr' '-Ddri-drivers='
See build log for details:
  /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-build-out.txt
```

```console
$ cat /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-build-out.txt
==> mesa: Executing phase: 'meson'
==> [2021-03-29-10:59:56.237431] 'meson' '/tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src' '--prefix=/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti' '--libdir=/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/lib' '--buildtype=release' '--strip' '-Dvulkan-drivers=' '-Dgallium-vdpau=disabled' '-Dgallium-xvmc=disabled' '-Dgallium-omx=disabled' '-Dgallium-va=disabled' '-Dgallium-xa=disabled' '-Dgallium-nine=false' '-Dgallium-opencl=disabled' '-Dbuild-tests=false' '-Dglvnd=false' '-Dosmesa=gallium' '-Dgallium=true' '-Dglx=gallium-xlib' '-Degl=disabled' '-Dgbm=disabled' '-Ddri3=disabled' '-Dopengl=true' '-Dgles1=disabled' '-Dgles2=disabled' '-Dshared-glapi=enabled' '-Dllvm=enabled' '-Dshared-llvm=disabled' '-Dswr-arches=avx,avx2' '-Dplatforms=x11' '-Dgallium-drivers=swrast,swr' '-Ddri-drivers='
The Meson build system
Version: 0.57.1
Source dir: /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src
Build dir: /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src/spack-build
Build type: native build
Program python found: YES (/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/python-3.8.8-ymiqtgvxhh3txoj3d3lqynvz2dkqdzqp/bin/python)

../meson.build:21:0: ERROR: Value gallium is not boolean (true or false).

A full log can be found at /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src/spack-build/meson-logs/meson-log.txt
```
```console
$ cat /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src/spack-build/meson-logs/meson-log.txt
Build started at 2021-03-29T10:59:56.576974
Main binary: /opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/python-3.8.8-ymiqtgvxhh3txoj3d3lqynvz2dkqdzqp/bin/python3.8
Build Options: -Dvulkan-drivers= -Dgallium-vdpau=disabled -Dgallium-xvmc=disabled -Dgallium-omx=disabled -Dgallium-va=disabled -Dgallium-xa=disabled -Dgallium-nine=false -Dgallium-opencl=disabled -Dbuild-tests=false -Dglvnd=false -Dosmesa=gallium -Dgallium=true -Dglx=gallium-xlib -Degl=disabled -Dgbm=disabled -Ddri3=disabled -Dopengl=true -Dgles1=disabled -Dgles2=disabled -Dshared-glapi=enabled -Dllvm=enabled -Dshared-llvm=disabled -Dswr-arches=avx,avx2 -Dplatforms=x11 -Dgallium-drivers=swrast,swr -Ddri-drivers= -Dprefix=/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti -Dlibdir=/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/lib -Dbuildtype=release -Dstrip=True
Python system: Linux
The Meson build system
Version: 0.57.1
Source dir: /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src
Build dir: /tmp/gpjohnsn/spack-stage/spack-stage-mesa-21.0.0-w7z67tkvsmm6tohz7dxk2aflfopqs6ti/spack-src/spack-build
Build type: native build
Program python found: YES (/opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/python-3.8.8-ymiqtgvxhh3txoj3d3lqynvz2dkqdzqp/bin/python)
Running command: /opt/packages/gpjohnsn/spack/opt/spack/linux-centos7-broadwell/gcc-8.4.0/python-3.8.8-ymiqtgvxhh3txoj3d3lqynvz2dkqdzqp/bin/python bin/meson_get_version.py
--- stdout ---
21.0.0
--- stderr ---



../meson.build:21:0: ERROR: Value gallium is not boolean (true or false).
```

### Information on your system

<!-- Please include the output of `spack debug report` -->
```console
$ spack debug report
* **Spack:** 0.16.1-1919-f59ac04
* **Python:** 3.6.8
* **Platform:** linux-centos7-broadwell
* **Concretizer:** original
```

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

<!-- Please upload the following files. They should be present in the stage directory of the failing build. Also upload any config.log or similar file if one exists. -->
<!-- * [spack-build-out.txt]()
* [spack-build-env.txt]() -->

<!-- Some packages have maintainers who have volunteered to debug build failures. Run `spack maintainers <name-of-the-package>` and @mention them here if they exist. -->
Maintainers: @chuckatkins @v-dobrev 
### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [x] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py
--- a/var/spack/repos/builtin/packages/mesa/package.py
+++ b/var/spack/repos/builtin/packages/mesa/package.py
@@ -123,11 +123,17 @@ def meson_args(self):
             args.append('-Dlibunwind=disabled')
 
         num_frontends = 0
+
+        if spec.satisfies('@:20.3'):
+            osmesa_enable, osmesa_disable = ('gallium', 'none')
+        else:
+            osmesa_enable, osmesa_disable = ('true', 'false')
+
         if '+osmesa' in spec:
             num_frontends += 1
-            args.append('-Dosmesa=gallium')
+            args.append('-Dosmesa={0}'.format(osmesa_enable))
         else:
-            args.append('-Dosmesa=none')
+            args.append('-Dosmesa={0}'.format(osmesa_disable))
 
         if '+glx' in spec:
             num_frontends += 1


Test patch: