Repository: spack/spack

Issue:
Installation issue: cryptsetup
<!-- 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! -->

### Steps to reproduce the issue

Requires  #18696 to get to this point.

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install cryptsetup
==> autoconf@2.69 : externally installed in /usr
[+] /usr
==> automake@1.15.1 : externally installed in /usr
[+] /usr
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/libiconv-1.16-tuvv3joeq4p25zx4tt4jnwyewlkcwc42
==> pkg-config@0.29.1 : externally installed in /usr
[+] /usr
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/xz-5.2.5-u54yufbm5c2vrjli6u5edrsffxie3t6e
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/zlib-1.2.11-xbygh7hzzhob3mreuofzktyf37hog64k
==> libtool@2.4.6 : externally installed in /usr
[+] /usr
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/libuuid-1.0.3-j4w7yefrbvcwiqowyq3p7xdhoed723xq
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/libaio-0.3.110-uj5i5sa3kgbhw3awpxlnjr3pluohuhfh
==> m4@1.4.18 : externally installed in /usr
[+] /usr
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/popt-1.16-2krbdfjetohzc7qxvsizavjgxvwd2bq2
==> python@3.6.9 : externally installed in /usr
[+] /usr
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/json-c-0.13.1-6ouz555pxnf3jxm5wqm63gtx2mc54tpw
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/diffutils-3.7-645bye6yyxj7kailirsc4tu4cmw4o7em
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/tar-1.32-k672mrtykft5guxfwju4yetgdlfilykr
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/ncurses-6.2-olidfo2tjyze4ahnjsjolqx4oc2psntk
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/libxml2-2.9.10-egj3irbp7af5xviijyqhl7mwh27tuby3
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/lvm2-2.03.05-eb5m2cqqmnxpfci6o2m72niewar62hkq
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/util-linux-2.35.1-2qmqfd6eatsfsbi4xeijs5qgukdrrnpb
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/bzip2-1.0.8-vsf34nkpmra2fjjregukoegoklpcgzmg
[+] /home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/gettext-0.21-mvdlgf2ydg7qglh6ffqlqrt7ksoujl4l
==> Installing cryptsetup
==> No binary for cryptsetup found: installing from source
==> Using cached archive: /home/rblake/spack/var/spack/cache/_source-cache/archive/92/92aba4d559a2cf7043faed92e0f22c5addea36bd63f8c039ba5a8f3a159fe7d2.tar.xz
==> cryptsetup: Executing phase: 'autoreconf'
==> cryptsetup: Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 1:
    '/tmp/rblake/spack-stage/spack-stage-cryptsetup-2.3.1-brxyprna5vokly7txkxbkredhtdzcbms/spack-src/configure' '--prefix=/home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/cryptsetup-2.3.1-brxyprna5vokly7txkxbkredhtdzcbms' 'systemd_tmpfilesdir=/home/rblake/spack/opt/spack/linux-ubuntu18.04-ivybridge/gcc-8.4.0/cryptsetup-2.3.1-brxyprna5vokly7txkxbkredhtdzcbms/tmpfiles.d'

1 error found in build log:
     194    checking whether json_object_object_add_ex is declared... yes
     195    checking whether json_object_deep_copy is declared... yes
     196    checking linux/if_alg.h usability... yes
     197    checking linux/if_alg.h presence... yes
     198    checking for linux/if_alg.h... yes
     199    checking for OPENSSL... no
  >> 200    configure: error: You need openssl library.

See build log for details:
  /tmp/rblake/spack-stage/spack-stage-cryptsetup-2.3.1-brxyprna5vokly7txkxbkredhtdzcbms/spack-build-out.txt


```

### Information on your system

<!-- Please include the output of `spack debug report` -->
* **Spack:** 0.15.4-1005-0d5c06567
* **Python:** 3.6.9
* **Platform:** linux-ubuntu18.04-ivybridge

<!-- 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](https://github.com/spack/spack/files/5233487/spack-build-out.txt)
* [spack-build-env.txt](https://github.com/spack/spack/files/5233490/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. -->

### 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/cryptsetup/package.py b/var/spack/repos/builtin/packages/cryptsetup/package.py
--- a/var/spack/repos/builtin/packages/cryptsetup/package.py
+++ b/var/spack/repos/builtin/packages/cryptsetup/package.py
@@ -35,6 +35,7 @@ class Cryptsetup(AutotoolsPackage):
     depends_on('m4',       type='build')
 
     depends_on('automake@:1.16.1', when='@2.2.1', type='build')
+    depends_on('openssl')
 
     # Upstream includes support for discovering the location of the libintl
     # library but is missing the bit in the Makefile.ac that includes it in
@@ -49,7 +50,8 @@ def url_for_version(self, version):
 
     def configure_args(self):
         args = [
-            'systemd_tmpfilesdir={0}/tmpfiles.d'.format(self.prefix)
+            'systemd_tmpfilesdir={0}/tmpfiles.d'.format(self.prefix),
+            '--with-crypto_backend=openssl',
         ]
         return args
 
diff --git a/var/spack/repos/builtin/packages/util-linux/package.py b/var/spack/repos/builtin/packages/util-linux/package.py
--- a/var/spack/repos/builtin/packages/util-linux/package.py
+++ b/var/spack/repos/builtin/packages/util-linux/package.py
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 
 from spack import *
+import os
 
 
 class UtilLinux(AutotoolsPackage):
@@ -28,6 +29,9 @@ class UtilLinux(AutotoolsPackage):
     # Make it possible to disable util-linux's libuuid so that you may
     # reliably depend_on(`libuuid`).
     variant('libuuid', default=True, description='Build libuuid')
+    variant('bash', default=False, description='Install bash completion scripts')
+
+    depends_on('bash', when="+bash", type='run')
 
     def url_for_version(self, version):
         url = "https://www.kernel.org/pub/linux/utils/util-linux/v{0}/util-linux-{1}.tar.gz"
@@ -37,7 +41,16 @@ def configure_args(self):
         config_args = [
             '--disable-use-tty-group',
             '--disable-makeinstall-chown',
-            '--without-systemd'
+            '--without-systemd',
         ]
+        if "+bash" in self.spec:
+            config_args.extend(
+                ['--enable-bash-completion',
+                 '--with-bashcompletiondir=' + os.path.join(
+                     self.spec['bash'].prefix,
+                     "share", "bash-completion", "completions")])
+        else:
+            config_args.append('--disable-bash-completion')
         config_args.extend(self.enable_or_disable('libuuid'))
+
         return config_args


Test patch: