We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
hwloc: added missing ncurses dependency


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `var/spack/repos/builtin/packages/hwloc/package.py`
Content:
```
1 # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
2 # Spack Project Developers. See the top-level COPYRIGHT file for details.
3 #
4 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
5 import sys
6 
7 
8 class Hwloc(AutotoolsPackage):
9     """The Hardware Locality (hwloc) software project.
10 
11     The Portable Hardware Locality (hwloc) software package
12     provides a portable abstraction (across OS, versions,
13     architectures, ...) of the hierarchical topology of modern
14     architectures, including NUMA memory nodes, sockets, shared
15     caches, cores and simultaneous multithreading. It also gathers
16     various system attributes such as cache and memory information
17     as well as the locality of I/O devices such as network
18     interfaces, InfiniBand HCAs or GPUs. It primarily aims at
19     helping applications with gathering information about modern
20     computing hardware so as to exploit it accordingly and
21     efficiently.
22     """
23 
24     homepage = "http://www.open-mpi.org/projects/hwloc/"
25     url      = "https://download.open-mpi.org/release/hwloc/v2.0/hwloc-2.0.2.tar.gz"
26     list_url = "http://www.open-mpi.org/software/hwloc/"
27     list_depth = 2
28     git = 'https://github.com/open-mpi/hwloc.git'
29 
30     maintainers = ['bgoglin']
31 
32     version('master', branch='master')
33     version('2.4.1', sha256='4267fe1193a8989f3ab7563a7499e047e77e33fed8f4dec16822a7aebcf78459')
34     version('2.4.0', sha256='30404065dc1d6872b0181269d0bb2424fbbc6e3b0a80491aa373109554006544')
35     version('2.3.0', sha256='155480620c98b43ddf9ca66a6c318b363ca24acb5ff0683af9d25d9324f59836')
36     version('2.2.0', sha256='2defba03ddd91761b858cbbdc2e3a6e27b44e94696dbfa21380191328485a433')
37     version('2.1.0',  sha256='1fb8cc1438de548e16ec3bb9e4b2abb9f7ce5656f71c0906583819fcfa8c2031')
38     version('2.0.2',  sha256='27dcfe42e3fb3422b72ce48b48bf601c0a3e46e850ee72d9bdd17b5863b6e42c')
39     version('2.0.1',  sha256='f1156df22fc2365a31a3dc5f752c53aad49e34a5e22d75ed231cd97eaa437f9d')
40     version('2.0.0',  sha256='a0d425a0fc7c7e3f2c92a272ffaffbd913005556b4443e1887d2e1718d902887')
41     version('1.11.13', sha256='a8f781ae4d347708a07d95e7549039887f151ed7f92263238527dfb0a3709b9d')
42     version('1.11.12', sha256='f1d49433e605dd653a77e1478a78cee095787d554a94afe40d1376bca6708ca5')
43     version('1.11.11', sha256='74329da3be1b25de8e98a712adb28b14e561889244bf3a8138afe91ab18e0b3a')
44     version('1.11.10', sha256='0a2530b739d9ebf60c4c1e86adb5451a20d9e78f7798cf78d0147cc6df328aac')
45     version('1.11.9', sha256='85b978995b67db0b1a12dd1a73b09ef3d39f8e3cb09f8b9c60cf04633acce46c')
46     version('1.11.8', sha256='8af89b1164a330e36d18210360ea9bb305e19f9773d1c882855d261a13054ea8')
47     version('1.11.7', sha256='ac16bed9cdd3c63bca1fe1ac3de522a1376b1487c4fc85b7b19592e28fd98e26')
48     version('1.11.6', sha256='67963f15197e6b551539c4ed95a4f8882be9a16cf336300902004361cf89bdee')
49     version('1.11.5', sha256='da2c780fce9b5440a1a7d1caf78f637feff9181a9d1ca090278cae4bea71b3df')
50     version('1.11.4', sha256='1b6a58049c31ce36aff162cf4332998fd468486bd08fdfe0249a47437311512d')
51     version('1.11.3', sha256='03a1cc63f23fed7e17e4d4369a75dc77d5c145111b8578b70e0964a12712dea0')
52     version('1.11.2', sha256='d11f091ed54c56c325ffca1083113a405fcd8a25d5888af64f5cd6cf587b7b0a')
53     version('1.11.1', sha256='b41f877d79b6026640943d57ef25311299378450f2995d507a5e633da711be61')
54     version('1.9',    sha256='9fb572daef35a1c8608d1a6232a4a9f56846bab2854c50562dfb9a7be294f4e8')
55 
56     variant('nvml', default=False, description="Support NVML device discovery")
57     variant('gl', default=False, description="Support GL device discovery")
58     variant('cuda', default=False, description="Support CUDA devices")
59     variant('libxml2', default=True, description="Build with libxml2")
60     variant('libudev', default=False, description="Build with libudev")
61     variant('pci', default=(sys.platform != 'darwin'),
62             description="Support analyzing devices on PCI bus")
63     variant('shared', default=True, description="Build shared libraries")
64     variant(
65         'cairo',
66         default=False,
67         description='Enable the Cairo back-end of hwloc\'s lstopo command'
68     )
69     variant(
70         'netloc',
71         default=False,
72         description="Enable netloc [requires MPI]"
73     )
74 
75     # netloc isn't available until version 2.0.0
76     conflicts('+netloc', when="@:1.99.99")
77 
78     # libudev isn't available until version 1.11.0
79     conflicts('+libudev', when="@:1.10")
80 
81     depends_on('pkgconfig', type='build')
82     depends_on('m4', type='build', when='@master')
83     depends_on('autoconf', type='build', when='@master')
84     depends_on('automake', type='build', when='@master')
85     depends_on('libtool', type='build', when='@master')
86     depends_on('cuda', when='+nvml')
87     depends_on('cuda', when='+cuda')
88     depends_on('gl', when='+gl')
89     depends_on('libpciaccess', when='+pci')
90     depends_on('libxml2', when='+libxml2')
91     depends_on('cairo', when='+cairo')
92     depends_on('numactl', when='@:1.11.11 platform=linux')
93 
94     # When mpi=openmpi, this introduces an unresolvable dependency.
95     # See https://github.com/spack/spack/issues/15836 for details
96     depends_on('mpi', when='+netloc')
97 
98     def url_for_version(self, version):
99         return "http://www.open-mpi.org/software/hwloc/v%s/downloads/hwloc-%s.tar.gz" % (version.up_to(2), version)
100 
101     def configure_args(self):
102         args = [
103             # Disable OpenCL, since hwloc might pick up an OpenCL
104             # library at build time that is then not found at run time
105             # (Alternatively, we could require OpenCL as dependency.)
106             "--disable-opencl",
107         ]
108         if '+netloc' in self.spec:
109             args.append('--enable-netloc')
110 
111         args.extend(self.enable_or_disable('cairo'))
112         args.extend(self.enable_or_disable('nvml'))
113         args.extend(self.enable_or_disable('gl'))
114         args.extend(self.enable_or_disable('cuda'))
115         args.extend(self.enable_or_disable('libxml2'))
116         args.extend(self.enable_or_disable('libudev'))
117         args.extend(self.enable_or_disable('pci'))
118         args.extend(self.enable_or_disable('shared'))
119 
120         return args
121
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/var/spack/repos/builtin/packages/hwloc/package.py b/var/spack/repos/builtin/packages/hwloc/package.py
--- a/var/spack/repos/builtin/packages/hwloc/package.py
+++ b/var/spack/repos/builtin/packages/hwloc/package.py
@@ -91,6 +91,10 @@
     depends_on('cairo', when='+cairo')
     depends_on('numactl', when='@:1.11.11 platform=linux')
 
+    # see https://github.com/open-mpi/hwloc/pull/417
+    depends_on('ncurses ~termlib', when='@:2.2')
+    depends_on('ncurses')
+
     # When mpi=openmpi, this introduces an unresolvable dependency.
     # See https://github.com/spack/spack/issues/15836 for details
     depends_on('mpi', when='+netloc')

{"golden_diff": "diff --git a/var/spack/repos/builtin/packages/hwloc/package.py b/var/spack/repos/builtin/packages/hwloc/package.py\n--- a/var/spack/repos/builtin/packages/hwloc/package.py\n+++ b/var/spack/repos/builtin/packages/hwloc/package.py\n@@ -91,6 +91,10 @@\n     depends_on('cairo', when='+cairo')\n     depends_on('numactl', when='@:1.11.11 platform=linux')\n \n+    # see https://github.com/open-mpi/hwloc/pull/417\n+    depends_on('ncurses ~termlib', when='@:2.2')\n+    depends_on('ncurses')\n+\n     # When mpi=openmpi, this introduces an unresolvable dependency.\n     # See https://github.com/spack/spack/issues/15836 for details\n     depends_on('mpi', when='+netloc')\n", "issue": "hwloc: added missing ncurses dependency\n\n", "before_files": [{"content": "# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\nimport sys\n\n\nclass Hwloc(AutotoolsPackage):\n    \"\"\"The Hardware Locality (hwloc) software project.\n\n    The Portable Hardware Locality (hwloc) software package\n    provides a portable abstraction (across OS, versions,\n    architectures, ...) of the hierarchical topology of modern\n    architectures, including NUMA memory nodes, sockets, shared\n    caches, cores and simultaneous multithreading. It also gathers\n    various system attributes such as cache and memory information\n    as well as the locality of I/O devices such as network\n    interfaces, InfiniBand HCAs or GPUs. It primarily aims at\n    helping applications with gathering information about modern\n    computing hardware so as to exploit it accordingly and\n    efficiently.\n    \"\"\"\n\n    homepage = \"http://www.open-mpi.org/projects/hwloc/\"\n    url      = \"https://download.open-mpi.org/release/hwloc/v2.0/hwloc-2.0.2.tar.gz\"\n    list_url = \"http://www.open-mpi.org/software/hwloc/\"\n    list_depth = 2\n    git = 'https://github.com/open-mpi/hwloc.git'\n\n    maintainers = ['bgoglin']\n\n    version('master', branch='master')\n    version('2.4.1', sha256='4267fe1193a8989f3ab7563a7499e047e77e33fed8f4dec16822a7aebcf78459')\n    version('2.4.0', sha256='30404065dc1d6872b0181269d0bb2424fbbc6e3b0a80491aa373109554006544')\n    version('2.3.0', sha256='155480620c98b43ddf9ca66a6c318b363ca24acb5ff0683af9d25d9324f59836')\n    version('2.2.0', sha256='2defba03ddd91761b858cbbdc2e3a6e27b44e94696dbfa21380191328485a433')\n    version('2.1.0',  sha256='1fb8cc1438de548e16ec3bb9e4b2abb9f7ce5656f71c0906583819fcfa8c2031')\n    version('2.0.2',  sha256='27dcfe42e3fb3422b72ce48b48bf601c0a3e46e850ee72d9bdd17b5863b6e42c')\n    version('2.0.1',  sha256='f1156df22fc2365a31a3dc5f752c53aad49e34a5e22d75ed231cd97eaa437f9d')\n    version('2.0.0',  sha256='a0d425a0fc7c7e3f2c92a272ffaffbd913005556b4443e1887d2e1718d902887')\n    version('1.11.13', sha256='a8f781ae4d347708a07d95e7549039887f151ed7f92263238527dfb0a3709b9d')\n    version('1.11.12', sha256='f1d49433e605dd653a77e1478a78cee095787d554a94afe40d1376bca6708ca5')\n    version('1.11.11', sha256='74329da3be1b25de8e98a712adb28b14e561889244bf3a8138afe91ab18e0b3a')\n    version('1.11.10', sha256='0a2530b739d9ebf60c4c1e86adb5451a20d9e78f7798cf78d0147cc6df328aac')\n    version('1.11.9', sha256='85b978995b67db0b1a12dd1a73b09ef3d39f8e3cb09f8b9c60cf04633acce46c')\n    version('1.11.8', sha256='8af89b1164a330e36d18210360ea9bb305e19f9773d1c882855d261a13054ea8')\n    version('1.11.7', sha256='ac16bed9cdd3c63bca1fe1ac3de522a1376b1487c4fc85b7b19592e28fd98e26')\n    version('1.11.6', sha256='67963f15197e6b551539c4ed95a4f8882be9a16cf336300902004361cf89bdee')\n    version('1.11.5', sha256='da2c780fce9b5440a1a7d1caf78f637feff9181a9d1ca090278cae4bea71b3df')\n    version('1.11.4', sha256='1b6a58049c31ce36aff162cf4332998fd468486bd08fdfe0249a47437311512d')\n    version('1.11.3', sha256='03a1cc63f23fed7e17e4d4369a75dc77d5c145111b8578b70e0964a12712dea0')\n    version('1.11.2', sha256='d11f091ed54c56c325ffca1083113a405fcd8a25d5888af64f5cd6cf587b7b0a')\n    version('1.11.1', sha256='b41f877d79b6026640943d57ef25311299378450f2995d507a5e633da711be61')\n    version('1.9',    sha256='9fb572daef35a1c8608d1a6232a4a9f56846bab2854c50562dfb9a7be294f4e8')\n\n    variant('nvml', default=False, description=\"Support NVML device discovery\")\n    variant('gl', default=False, description=\"Support GL device discovery\")\n    variant('cuda', default=False, description=\"Support CUDA devices\")\n    variant('libxml2', default=True, description=\"Build with libxml2\")\n    variant('libudev', default=False, description=\"Build with libudev\")\n    variant('pci', default=(sys.platform != 'darwin'),\n            description=\"Support analyzing devices on PCI bus\")\n    variant('shared', default=True, description=\"Build shared libraries\")\n    variant(\n        'cairo',\n        default=False,\n        description='Enable the Cairo back-end of hwloc\\'s lstopo command'\n    )\n    variant(\n        'netloc',\n        default=False,\n        description=\"Enable netloc [requires MPI]\"\n    )\n\n    # netloc isn't available until version 2.0.0\n    conflicts('+netloc', when=\"@:1.99.99\")\n\n    # libudev isn't available until version 1.11.0\n    conflicts('+libudev', when=\"@:1.10\")\n\n    depends_on('pkgconfig', type='build')\n    depends_on('m4', type='build', when='@master')\n    depends_on('autoconf', type='build', when='@master')\n    depends_on('automake', type='build', when='@master')\n    depends_on('libtool', type='build', when='@master')\n    depends_on('cuda', when='+nvml')\n    depends_on('cuda', when='+cuda')\n    depends_on('gl', when='+gl')\n    depends_on('libpciaccess', when='+pci')\n    depends_on('libxml2', when='+libxml2')\n    depends_on('cairo', when='+cairo')\n    depends_on('numactl', when='@:1.11.11 platform=linux')\n\n    # When mpi=openmpi, this introduces an unresolvable dependency.\n    # See https://github.com/spack/spack/issues/15836 for details\n    depends_on('mpi', when='+netloc')\n\n    def url_for_version(self, version):\n        return \"http://www.open-mpi.org/software/hwloc/v%s/downloads/hwloc-%s.tar.gz\" % (version.up_to(2), version)\n\n    def configure_args(self):\n        args = [\n            # Disable OpenCL, since hwloc might pick up an OpenCL\n            # library at build time that is then not found at run time\n            # (Alternatively, we could require OpenCL as dependency.)\n            \"--disable-opencl\",\n        ]\n        if '+netloc' in self.spec:\n            args.append('--enable-netloc')\n\n        args.extend(self.enable_or_disable('cairo'))\n        args.extend(self.enable_or_disable('nvml'))\n        args.extend(self.enable_or_disable('gl'))\n        args.extend(self.enable_or_disable('cuda'))\n        args.extend(self.enable_or_disable('libxml2'))\n        args.extend(self.enable_or_disable('libudev'))\n        args.extend(self.enable_or_disable('pci'))\n        args.extend(self.enable_or_disable('shared'))\n\n        return args\n", "path": "var/spack/repos/builtin/packages/hwloc/package.py"}], "after_files": [{"content": "# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\nimport sys\n\n\nclass Hwloc(AutotoolsPackage):\n    \"\"\"The Hardware Locality (hwloc) software project.\n\n    The Portable Hardware Locality (hwloc) software package\n    provides a portable abstraction (across OS, versions,\n    architectures, ...) of the hierarchical topology of modern\n    architectures, including NUMA memory nodes, sockets, shared\n    caches, cores and simultaneous multithreading. It also gathers\n    various system attributes such as cache and memory information\n    as well as the locality of I/O devices such as network\n    interfaces, InfiniBand HCAs or GPUs. It primarily aims at\n    helping applications with gathering information about modern\n    computing hardware so as to exploit it accordingly and\n    efficiently.\n    \"\"\"\n\n    homepage = \"http://www.open-mpi.org/projects/hwloc/\"\n    url      = \"https://download.open-mpi.org/release/hwloc/v2.0/hwloc-2.0.2.tar.gz\"\n    list_url = \"http://www.open-mpi.org/software/hwloc/\"\n    list_depth = 2\n    git = 'https://github.com/open-mpi/hwloc.git'\n\n    maintainers = ['bgoglin']\n\n    version('master', branch='master')\n    version('2.4.1', sha256='4267fe1193a8989f3ab7563a7499e047e77e33fed8f4dec16822a7aebcf78459')\n    version('2.4.0', sha256='30404065dc1d6872b0181269d0bb2424fbbc6e3b0a80491aa373109554006544')\n    version('2.3.0', sha256='155480620c98b43ddf9ca66a6c318b363ca24acb5ff0683af9d25d9324f59836')\n    version('2.2.0', sha256='2defba03ddd91761b858cbbdc2e3a6e27b44e94696dbfa21380191328485a433')\n    version('2.1.0',  sha256='1fb8cc1438de548e16ec3bb9e4b2abb9f7ce5656f71c0906583819fcfa8c2031')\n    version('2.0.2',  sha256='27dcfe42e3fb3422b72ce48b48bf601c0a3e46e850ee72d9bdd17b5863b6e42c')\n    version('2.0.1',  sha256='f1156df22fc2365a31a3dc5f752c53aad49e34a5e22d75ed231cd97eaa437f9d')\n    version('2.0.0',  sha256='a0d425a0fc7c7e3f2c92a272ffaffbd913005556b4443e1887d2e1718d902887')\n    version('1.11.13', sha256='a8f781ae4d347708a07d95e7549039887f151ed7f92263238527dfb0a3709b9d')\n    version('1.11.12', sha256='f1d49433e605dd653a77e1478a78cee095787d554a94afe40d1376bca6708ca5')\n    version('1.11.11', sha256='74329da3be1b25de8e98a712adb28b14e561889244bf3a8138afe91ab18e0b3a')\n    version('1.11.10', sha256='0a2530b739d9ebf60c4c1e86adb5451a20d9e78f7798cf78d0147cc6df328aac')\n    version('1.11.9', sha256='85b978995b67db0b1a12dd1a73b09ef3d39f8e3cb09f8b9c60cf04633acce46c')\n    version('1.11.8', sha256='8af89b1164a330e36d18210360ea9bb305e19f9773d1c882855d261a13054ea8')\n    version('1.11.7', sha256='ac16bed9cdd3c63bca1fe1ac3de522a1376b1487c4fc85b7b19592e28fd98e26')\n    version('1.11.6', sha256='67963f15197e6b551539c4ed95a4f8882be9a16cf336300902004361cf89bdee')\n    version('1.11.5', sha256='da2c780fce9b5440a1a7d1caf78f637feff9181a9d1ca090278cae4bea71b3df')\n    version('1.11.4', sha256='1b6a58049c31ce36aff162cf4332998fd468486bd08fdfe0249a47437311512d')\n    version('1.11.3', sha256='03a1cc63f23fed7e17e4d4369a75dc77d5c145111b8578b70e0964a12712dea0')\n    version('1.11.2', sha256='d11f091ed54c56c325ffca1083113a405fcd8a25d5888af64f5cd6cf587b7b0a')\n    version('1.11.1', sha256='b41f877d79b6026640943d57ef25311299378450f2995d507a5e633da711be61')\n    version('1.9',    sha256='9fb572daef35a1c8608d1a6232a4a9f56846bab2854c50562dfb9a7be294f4e8')\n\n    variant('nvml', default=False, description=\"Support NVML device discovery\")\n    variant('gl', default=False, description=\"Support GL device discovery\")\n    variant('cuda', default=False, description=\"Support CUDA devices\")\n    variant('libxml2', default=True, description=\"Build with libxml2\")\n    variant('libudev', default=False, description=\"Build with libudev\")\n    variant('pci', default=(sys.platform != 'darwin'),\n            description=\"Support analyzing devices on PCI bus\")\n    variant('shared', default=True, description=\"Build shared libraries\")\n    variant(\n        'cairo',\n        default=False,\n        description='Enable the Cairo back-end of hwloc\\'s lstopo command'\n    )\n    variant(\n        'netloc',\n        default=False,\n        description=\"Enable netloc [requires MPI]\"\n    )\n\n    # netloc isn't available until version 2.0.0\n    conflicts('+netloc', when=\"@:1.99.99\")\n\n    # libudev isn't available until version 1.11.0\n    conflicts('+libudev', when=\"@:1.10\")\n\n    depends_on('pkgconfig', type='build')\n    depends_on('m4', type='build', when='@master')\n    depends_on('autoconf', type='build', when='@master')\n    depends_on('automake', type='build', when='@master')\n    depends_on('libtool', type='build', when='@master')\n    depends_on('cuda', when='+nvml')\n    depends_on('cuda', when='+cuda')\n    depends_on('gl', when='+gl')\n    depends_on('libpciaccess', when='+pci')\n    depends_on('libxml2', when='+libxml2')\n    depends_on('cairo', when='+cairo')\n    depends_on('numactl', when='@:1.11.11 platform=linux')\n\n    # see https://github.com/open-mpi/hwloc/pull/417\n    depends_on('ncurses ~termlib', when='@:2.2')\n    depends_on('ncurses')\n\n    # When mpi=openmpi, this introduces an unresolvable dependency.\n    # See https://github.com/spack/spack/issues/15836 for details\n    depends_on('mpi', when='+netloc')\n\n    def url_for_version(self, version):\n        return \"http://www.open-mpi.org/software/hwloc/v%s/downloads/hwloc-%s.tar.gz\" % (version.up_to(2), version)\n\n    def configure_args(self):\n        args = [\n            # Disable OpenCL, since hwloc might pick up an OpenCL\n            # library at build time that is then not found at run time\n            # (Alternatively, we could require OpenCL as dependency.)\n            \"--disable-opencl\",\n        ]\n        if '+netloc' in self.spec:\n            args.append('--enable-netloc')\n\n        args.extend(self.enable_or_disable('cairo'))\n        args.extend(self.enable_or_disable('nvml'))\n        args.extend(self.enable_or_disable('gl'))\n        args.extend(self.enable_or_disable('cuda'))\n        args.extend(self.enable_or_disable('libxml2'))\n        args.extend(self.enable_or_disable('libudev'))\n        args.extend(self.enable_or_disable('pci'))\n        args.extend(self.enable_or_disable('shared'))\n\n        return args\n", "path": "var/spack/repos/builtin/packages/hwloc/package.py"}]}