diff --git a/Fix-Spinx-configuration-to-avoid-throwing-errors.patch b/Fix-Spinx-configuration-to-avoid-throwing-errors.patch
index 88e0e8d..0c2cd3e 100644
--- a/Fix-Spinx-configuration-to-avoid-throwing-errors.patch
+++ b/Fix-Spinx-configuration-to-avoid-throwing-errors.patch
@@ -1,10 +1,7 @@
+From 66bdd2b54c5e6d1ddc9a3970b120dda2ac69e52e Mon Sep 17 00:00:00 2001
 From: Egbert Eich <eich@suse.com>
-Date: Wed Nov 10 16:30:14 2021 +0100
-Subject: Fix Spinx configuration to avoid throwing errors
-Patch-mainline: Not yet
-Git-repo: https://github.com/spack/spack
-Git-commit: f8be4e346441f8d33b760ddfdc5fad360edf055d
-References: 
+Date: Wed, 10 Nov 2021 16:30:14 +0100
+Subject: [PATCH] Fix Spinx configuration to avoid throwing errors
 
 - Ignore certain variables
 - Don't attempt downloading ntersphinx inventory
@@ -12,45 +9,28 @@ References:
 Signed-off-by: Egbert Eich <eich@suse.com>
 Signed-off-by: Egbert Eich <eich@suse.de>
 ---
- lib/spack/docs/conf.py | 24 +++++++++++++++++++++++-
- 1 file changed, 23 insertions(+), 1 deletion(-)
+ lib/spack/docs/conf.py | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
 diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py
-index 2b58223e1d..95888cf5d4 100644
+index 4fc321c72d..d31c2fe980 100644
 --- a/lib/spack/docs/conf.py
 +++ b/lib/spack/docs/conf.py
-@@ -179,6 +179,28 @@ def setup(sphinx):
-     ('py:class', '_frozen_importlib_external.SourceFileLoader'),
-     # Spack classes that are private and we don't want to expose
-     ('py:class', 'spack.provider_index._IndexBase'),
-+    ('py:class', 'datetime.datetime'),
-+    ('py:class', 'argparse.ArgumentParser'),
-+    ('py:class', 'argparse.RawTextHelpFormatter'),
-+    ('py:class', 'argparse.Namespace'),
-+    ('py:class', 'argparse.Action'),
-+    ('py:class', 'ast.NodeVisitor'),
-+    ('py:class', 'ast.NodeTransformer'),
-+    ('py:class', 'ast.AST'),
-+    ('py:class', 'collections.abc.MutableMapping'),
-+    ('py:class', 'collections.abc.Sequence'),
-+    ('py:class', 'collections.abc.Mapping'),
-+    ('py:class', 'html.parser.HTMLParser'),
-+    ('py:class', 'typing.IO'),
-+    ('py:class', 'urllib.request.HTTPSHandler'),
-+    ('py:obj', 'typing.Callable'),
-+    ('py:obj', 'typing.IO'),
-+    ('py:obj', 'bool'),
-+    ('py:obj', 'dict'),
-+    ('py:obj', 'int'),
-+    ('py:obj', 'list'),
-+    ('py:obj', 're'),
-+    ('py:obj', 'str')
+@@ -130,7 +130,6 @@ def setup(sphinx):
+     "sphinx.ext.napoleon",
+     "sphinx.ext.todo",
+     "sphinx.ext.viewcode",
+-    "sphinx_design",
+     "sphinxcontrib.programoutput",
  ]
  
- # The reST default role (used for this markup: `text`) to use for all documents.
-@@ -381,5 +403,5 @@ class SpackStyle(DefaultStyle):
+@@ -415,5 +414,5 @@ class SpackStyle(DefaultStyle):
  
  # sphinx.ext.intersphinx
  intersphinx_mapping = {
 -    "python": ("https://docs.python.org/3", None),
 +    "python": ("https://docs.python.org/3", "objects.inv"),
  }
+-- 
+2.35.3
+
diff --git a/Fix-error-during-documentation-build-due-to-recursive-module-inclusion.patch b/Fix-error-during-documentation-build-due-to-recursive-module-inclusion.patch
index efd0d04..51582d7 100644
--- a/Fix-error-during-documentation-build-due-to-recursive-module-inclusion.patch
+++ b/Fix-error-during-documentation-build-due-to-recursive-module-inclusion.patch
@@ -1,43 +1,23 @@
+From dc83f5aa199bd7a393f32f53611e069d7475ccfc Mon Sep 17 00:00:00 2001
 From: Egbert Eich <eich@suse.com>
-Date: Thu Apr 7 20:25:46 2022 +0200
-Subject: Fix error during documentation build due to recursive module inclusion
-Patch-mainline: Not yet
-Git-commit: 7000c074119ebc3354b18a3b2aa27d431f906840
-References: 
+Date: Thu, 7 Apr 2022 20:25:46 +0200
+Subject: [PATCH] Fix error during documentation build due to recursive module
+ inclusion
 
 Signed-off-by: Egbert Eich <eich@suse.com>
 Signed-off-by: Egbert Eich <eich@suse.de>
 ---
- lib/spack/spack/cmd/__init__.py            | 5 ++++-
- lib/spack/spack/environment/environment.py | 5 ++++-
- lib/spack/spack/installer.py               | 5 ++++-
- lib/spack/spack/main.py                    | 5 ++++-
- 4 files changed, 16 insertions(+), 4 deletions(-)
-diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py
-index 0b0451c..cbedb9a 100644
---- a/lib/spack/spack/cmd/__init__.py
-+++ b/lib/spack/spack/cmd/__init__.py
-@@ -21,7 +21,10 @@
- from llnl.util.tty.color import colorize
- 
- import spack.config
--import spack.environment as ev
-+try:
-+    import spack.environment as ev
-+except AttributeError:
-+    pass
- import spack.error
- import spack.extensions
- import spack.paths
+ lib/spack/spack/environment/environment.py | 4 ++++
+ 1 file changed, 4 insertions(+)
+
 diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py
-index 3114f55..059b057 100644
+index f0598e5a83..76f50ff69c 100644
 --- a/lib/spack/spack/environment/environment.py
 +++ b/lib/spack/spack/environment/environment.py
-@@ -32,7 +32,10 @@
- import spack.stage
- import spack.store
+@@ -36,6 +36,10 @@
  import spack.subprocess_context
--import spack.user_environment as uenv
+ import spack.traverse
+ import spack.user_environment as uenv
 +try:
 +    import spack.user_environment as uenv
 +except AttributeError:
@@ -45,35 +25,6 @@ index 3114f55..059b057 100644
  import spack.util.cpus
  import spack.util.environment
  import spack.util.hash
-diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py
-index df1d704..ef0bda2 100644
---- a/lib/spack/spack/installer.py
-+++ b/lib/spack/spack/installer.py
-@@ -45,7 +45,10 @@
- from llnl.util.tty.color import colorize
- from llnl.util.tty.log import log_output
- 
--import spack.binary_distribution as binary_distribution
-+try:
-+    import spack.binary_distribution as binary_distribution
-+except AttributeError:
-+    pass
- import spack.compilers
- import spack.error
- import spack.hooks
-diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
-index f41423f..bb6c909 100644
---- a/lib/spack/spack/main.py
-+++ b/lib/spack/spack/main.py
-@@ -36,7 +36,10 @@
- import spack
- import spack.cmd
- import spack.config
--import spack.environment as ev
-+try:
-+    import spack.environment as ev
-+except AttributeError:
-+    pass
- import spack.modules
- import spack.paths
- import spack.platforms
+-- 
+2.35.3
+
diff --git a/Make-spack-paths-compliant-to-distro-installation.patch b/Make-spack-paths-compliant-to-distro-installation.patch
index 1b60ed6..81fc2f3 100644
--- a/Make-spack-paths-compliant-to-distro-installation.patch
+++ b/Make-spack-paths-compliant-to-distro-installation.patch
@@ -1,10 +1,7 @@
+From e7bbc251529786e68297c8aac700358ab1fb5c14 Mon Sep 17 00:00:00 2001
 From: Egbert Eich <eich@suse.com>
-Date: Wed Nov 10 09:40:07 2021 +0100
-Subject: Make spack paths compliant to distro installation
-Patch-mainline: Not yet
-Git-repo: https://github.com/spack/spack
-Git-commit: f91da8159ac285f41d215f0bf7d3a15461e63324
-References: 
+Date: Wed, 10 Nov 2021 09:40:07 +0100
+Subject: [PATCH] Make spack paths compliant to distro installation
 
 Spack is particular about the choice of 'prefix' which will
 replace $spack. 'prefix' is the 4th ancestor of paths.py, so
@@ -18,25 +15,29 @@ Signed-off-by: Egbert Eich <eich@suse.de>
 ---
  lib/spack/spack/paths.py | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
+
 diff --git a/lib/spack/spack/paths.py b/lib/spack/spack/paths.py
-index 6b3543406b..bb16e14145 100644
+index fc617342e8..c733da2286 100644
 --- a/lib/spack/spack/paths.py
 +++ b/lib/spack/spack/paths.py
 @@ -41,7 +41,7 @@
- operating_system_path = os.path.join(module_path, 'operating_systems')
- test_path             = os.path.join(module_path, "test")
- hooks_path            = os.path.join(module_path, "hooks")
--opt_path              = os.path.join(prefix, "opt")
-+opt_path              = os.path.join("/", "opt")
- share_path            = os.path.join(prefix, "share", "spack")
- etc_path              = os.path.join(prefix, "etc")
+ operating_system_path = os.path.join(module_path, "operating_systems")
+ test_path = os.path.join(module_path, "test")
+ hooks_path = os.path.join(module_path, "hooks")
+-opt_path = os.path.join(prefix, "opt")
++opt_path = os.path.join("/", "opt")
+ share_path = os.path.join(prefix, "share", "spack")
+ etc_path = os.path.join(prefix, "etc", "spack")
  
-@@ -49,7 +49,7 @@
+@@ -53,7 +53,7 @@
  #
  # Things in $spack/var/spack
  #
--var_path              = os.path.join(prefix, "var", "spack")
-+var_path              = os.path.join("/", "var", "lib", "spack")
+-var_path = os.path.join(prefix, "var", "spack")
++var_path = os.path.join("/", "var", "spack")
  
  # read-only things in $spack/var/spack
- repos_path            = os.path.join(var_path, "repos")
+ repos_path = os.path.join(var_path, "repos")
+-- 
+2.35.3
+
diff --git a/Set-modules-default-to-lmod.patch b/Set-modules-default-to-lmod.patch
index eff6608..2dac422 100644
--- a/Set-modules-default-to-lmod.patch
+++ b/Set-modules-default-to-lmod.patch
@@ -1,26 +1,27 @@
+From ff6db56de20859436a1bfff30d22910bad0557d9 Mon Sep 17 00:00:00 2001
 From: Egbert Eich <eich@suse.com>
-Date: Wed Nov 10 20:28:29 2021 +0100
-Subject: Set modules default to lmod
-Patch-mainline: Not yet
-Git-repo: https://github.com/spack/spack
-Git-commit: fc190d74554d93e1907a6d56aeaeb35d328c4e22
-References: 
+Date: Wed, 10 Nov 2021 20:28:29 +0100
+Subject: [PATCH] Set modules default to lmod
 
 Signed-off-by: Egbert Eich <eich@suse.com>
 Signed-off-by: Egbert Eich <eich@suse.de>
 ---
  etc/spack/defaults/modules.yaml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
+
 diff --git a/etc/spack/defaults/modules.yaml b/etc/spack/defaults/modules.yaml
-index 27b7c45f66..09e572067b 100644
+index 27450b4259..9b476b7c69 100644
 --- a/etc/spack/defaults/modules.yaml
 +++ b/etc/spack/defaults/modules.yaml
-@@ -44,7 +44,7 @@ modules:
-     #  lmod:   $spack/share/spack/lmod
+@@ -42,7 +42,7 @@ modules:
+      lmod:   $spack/share/spack/lmod
      # What type of modules to use
      enable:
 -      - tcl
 +      - lmod
  
-     # Default configurations if lmod is enabled
-     lmod:
+     tcl:
+       all:
+-- 
+2.35.3
+
diff --git a/added-target-and-os-calls-to-output-of-spack-spec-co.patch b/added-target-and-os-calls-to-output-of-spack-spec-co.patch
index c8f4d82..3f1f082 100644
--- a/added-target-and-os-calls-to-output-of-spack-spec-co.patch
+++ b/added-target-and-os-calls-to-output-of-spack-spec-co.patch
@@ -1,21 +1,19 @@
-From 239be0609302d296e6d4d275e800e505466011ab Mon Sep 17 00:00:00 2001
+From a80d5cd883263271650925926dfd734f488bb731 Mon Sep 17 00:00:00 2001
 From: Christian Goll <cgoll@suse.de>
 Date: Fri, 11 Dec 2020 15:37:48 +0100
-Subject: [PATCH 2/2] added target and os calls to output of spack spec
- commands
+Subject: [PATCH] added target and os calls to output of spack spec commands
 
 ---
  lib/spack/docs/developer_guide.rst | 2 +-
  lib/spack/docs/getting_started.rst | 2 +-
  lib/spack/docs/packaging_guide.rst | 6 +++---
- lib/spack/docs/workflows.rst       | 2 +-
- 4 files changed, 6 insertions(+), 6 deletions(-)
+ 3 files changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/lib/spack/docs/developer_guide.rst b/lib/spack/docs/developer_guide.rst
-index 7fd4d1ec6..e2c7689ad 100644
+index 6b67ef9f77..695e3a84bc 100644
 --- a/lib/spack/docs/developer_guide.rst
 +++ b/lib/spack/docs/developer_guide.rst
-@@ -488,7 +488,7 @@ supply ``--profile`` to Spack on the command line, before any subcommands.
+@@ -761,7 +761,7 @@ supply ``--profile`` to Spack on the command line, before any subcommands.
  
  ``spack --profile`` output looks like this:
  
@@ -25,10 +23,10 @@ index 7fd4d1ec6..e2c7689ad 100644
  
  The bottom of the output shows the top most time consuming functions,
 diff --git a/lib/spack/docs/getting_started.rst b/lib/spack/docs/getting_started.rst
-index f1df0343b..b32d82c37 100644
+index 1bf99e09b3..6b01bf4950 100644
 --- a/lib/spack/docs/getting_started.rst
 +++ b/lib/spack/docs/getting_started.rst
-@@ -83,7 +83,7 @@ Check Installation
+@@ -206,7 +206,7 @@ Check Installation
  With Spack installed, you should be able to run some basic Spack
  commands.  For example:
  
@@ -38,10 +36,10 @@ index f1df0343b..b32d82c37 100644
  In theory, Spack doesn't need any additional installation; just
  download and run!  But in real life, additional steps are usually
 diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst
-index 66caddeb0..20bffef35 100644
+index 5b0e556b34..600f0fb72e 100644
 --- a/lib/spack/docs/packaging_guide.rst
 +++ b/lib/spack/docs/packaging_guide.rst
-@@ -4540,13 +4540,13 @@ Spack provides the ``spack graph`` command for graphing dependencies.
+@@ -6099,13 +6099,13 @@ Spack provides the ``spack graph`` command for graphing dependencies.
  The command by default generates an ASCII rendering of a spec's
  dependency graph.  For example:
  
@@ -57,7 +55,7 @@ index 66caddeb0..20bffef35 100644
  
  The ``deptype`` argument tells Spack what types of dependencies to graph.
  By default it includes link and run dependencies but not build
-@@ -4561,7 +4561,7 @@ dependencies.  The default is ``--deptype=all``, which is equivalent to
+@@ -6120,7 +6120,7 @@ dependencies.  The default is ``--deptype=all``, which is equivalent to
  You can also use ``spack graph`` to generate graphs in the widely used
  `Dot <http://www.graphviz.org/doc/info/lang.html>`_ format.  For example:
  
@@ -66,19 +64,6 @@ index 66caddeb0..20bffef35 100644
  
  This graph can be provided as input to other graphing tools, such as
  those in `Graphviz <http://www.graphviz.org>`_.  If you have graphviz
-diff --git a/lib/spack/docs/workflows.rst b/lib/spack/docs/workflows.rst
-index 4d3a97012..dbeb0df2c 100644
---- a/lib/spack/docs/workflows.rst
-+++ b/lib/spack/docs/workflows.rst
-@@ -38,7 +38,7 @@ possible realization of a particular package, out of combinatorially
- many other realizations.  For example, here is a concrete spec
- instantiated from ``curl``:
- 
--.. command-output:: spack spec curl
-+.. command-output:: spack spec curl target=x86_64 os=SUSE
- 
- Spack's core concretization algorithm generates concrete specs by
- instantiating packages from its repo, based on a set of "hints",
 -- 
-2.26.2
+2.38.0
 
diff --git a/fix-tumbleweed-naming.patch b/fix-tumbleweed-naming.patch
deleted file mode 100644
index a19c225..0000000
--- a/fix-tumbleweed-naming.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From e752e8f95a5fecf223e2849beeb8bd7cef234c60 Mon Sep 17 00:00:00 2001
-From: Christian Goll <cgoll@suse.de>
-Date: Wed, 11 Nov 2020 20:29:55 +0100
-Subject: [PATCH 1/4] fix tumbleweed naming
-
----
- lib/spack/spack/operating_systems/linux_distro.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/lib/spack/spack/operating_systems/linux_distro.py b/lib/spack/spack/operating_systems/linux_distro.py
-index a6608e6d3..dfa09b16e 100644
---- a/lib/spack/spack/operating_systems/linux_distro.py
-+++ b/lib/spack/spack/operating_systems/linux_distro.py
-@@ -33,6 +33,11 @@ def __init__(self):
- 
-         if 'ubuntu' in distname:
-             version = '.'.join(version[0:2])
-+        # openSUSE Tumbleweed is a rolling release which can change
-+        # more than once in a week, so set version to tumbleweed
-+        elif 'opensuse-tumbleweed' in distname:
-+            distname = 'opensuse'
-+            version = 'tumbleweed'
-         else:
-             version = version[0]
- 
--- 
-2.26.2
-
diff --git a/spack-0.17.1.tar.gz b/spack-0.17.1.tar.gz
deleted file mode 100644
index 88ba615..0000000
--- a/spack-0.17.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:96850f750c5a17675275aa059eabc2ae09b7a8c7b59c5762d571925b6897acfb
-size 6749505
diff --git a/spack-0.19.0.tar.gz b/spack-0.19.0.tar.gz
new file mode 100644
index 0000000..cd98349
--- /dev/null
+++ b/spack-0.19.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b4225daf4f365a15caa58ef465d125b0d108ac5430b74d53ca4e807777943daf
+size 9420149
diff --git a/spack.changes b/spack.changes
index 058db5e..8aa8f0d 100644
--- a/spack.changes
+++ b/spack.changes
@@ -1,3 +1,66 @@
+-------------------------------------------------------------------
+Tue Nov 22 11:16:26 UTC 2022 - Christian Goll <cgoll@suse.com>
+
+- updated to version 0.19.0 with follwoinig changes:
+  * Spack's traditional package preferences are soft, but we've added hard
+    requriements to packages.yaml and spack.yaml
+  * spack install in an environment will no longer add to the specs: list; you'll
+    need to either use spack add <spec> or spack install --add <spec>.
+  * spack uninstall will not remove from your environment's specs:
+    list; you'll need to use spack remove or spack uninstall --remove.
+  * concretizer:unify:true is now the default mode for new environments
+  * include environment configuration from URLs
+  * An increasing number of packages in the ecosystem need the ability to
+    support multiple build systems 
+  * package ++variant:
+    enabled variant that will be propagated to dependencies
+  * git. prefix to specify git tags or branches as versions. All of these are
+    valid git versions in
+  * spack ci generate --tests will generate a .gitlab-ci.yml file that not only
+    does builds but also runs tests for built packages
+  * spack test run --explicit will only run tests for packages that are
+    explicitly installed, instead of all packages.
+  * You can add a new shared_linking option to config.yaml to make Spack embed absolute paths
+    to needed shared libraries in ELF executables and shared libraries on Linux
+  * spack spec prints dependencies more legibly. Dependencies in the output now
+    appear at the earliest level of indentation possible (#33406)
+  * You can override package.py attributes like url, directly in packages.yaml
+  * There are a number of new architecture-related format strings you can use
+    in Spack configuration files to specify paths
+- Improvement from v0.18.0
+  * spack install --reuse was introduced in v0.17.0, and --reuse is now the
+    default concretization mode. Spack will try hard to resolve dependencies
+    using installed packages or binaries
+  * Spack hashes now include link, run, and build dependencies, as well as a
+    canonical hash of package recipes. Previously, hashes only included link
+    and run dependencies (though build dependencies were stored by
+    environments). We coarsened the hash to reduce churn in user installations,
+    but the new default concretizer behavior mitigates this concern and gets us
+    reuse and provenance.  You will be able to see the build dependencies of
+    new installations
+  * concretizer:unify:when_possible will try to resolve a fully unified
+    environment, but if it cannot, it will create multiple configurations of
+    some packages where it has to.  with spack find.
+  * Spack now has an updated binary format, with improvements for security. The
+    new format has a detached signature file, and Spack verifies the signature
+    before untarring or decompressing the binary package. The previous format
+    embedded the signature in a tar file, which required the client to run tar
+    before verifying (#30750). Spack can still install from build caches using
+    the old format, but we encourage users to switch to the new format going
+    forward.
+  * The spack bootstrap mirror command can automatically create a mirror for
+    bootstrapping the concretizer and other needed dependencies in an
+    air-gapped environment.
+  * spack env depfile can be used to generate a Makefile from an environment,
+    which can be used to build packages the environment in parallel on a single
+    node
+  * In addition to being conditional themselves, variants can now have
+    conditional values that are only possible for certain configurations of a
+    package.
+- removed following patches as incooperated upstream:
+  * fix-tumbleweed-naming.patch
+
+
 -------------------------------------------------------------------
 Mon Aug 15 19:39:22 UTC 2022 - Dirk Müller <dmueller@suse.com>
 
diff --git a/spack.spec b/spack.spec
index 9fbe0f2..b0e7623 100644
--- a/spack.spec
+++ b/spack.spec
@@ -36,7 +36,7 @@ ExclusiveArch:  do_not_build
 # non oss packages
 %define spack_trigger_external cuda-nvcc
 Name:           spack
-Version:        0.17.1
+Version:        0.19.0
 Release:        0
 Summary:        Package manager for HPC systems
 License:        Apache-2.0 AND MIT AND Python-2.0 AND BSD-3-Clause
@@ -48,7 +48,6 @@ Source3:        run-find-external.sh.in
 Source4:        https://en.opensuse.org/index.php?title=Spack&action=raw&ref=157522#/README-oo-wiki
 # Source5 is from https://docs.python.org/3/objects.inv, but has permanent changes so using a static version
 Source5:        objects.inv
-Patch1:         fix-tumbleweed-naming.patch
 Patch2:         Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch
 Patch4:         added-target-and-os-calls-to-output-of-spack-spec-co.patch
 Patch5:         Make-spack-paths-compliant-to-distro-installation.patch
@@ -168,14 +167,17 @@ done
 %else
 cp %{S:5} lib/spack/docs/
 %endif
+grep -rl '#!/bin/env ' . | xargs -i@ sed -i 's|#!/bin/env|#!/usr/bin/env|g' @
 
-for file in $(find . -type f); do
-    sed -e 's@$spack/opt@/opt@g' \
-	-e 's@$spack/share/spack/modules@/opt/spack/modules@g' \
-	-e 's@$spack/share/spack/lmod@/opt/spack/modules@g' \
-	-e 's@$spack/var@/var/lib@g' \
-	-i $file
-done
+#for file in $(find . -type f); do
+#       -i @
+#done
+grep -rl "spack/" . | xargs -i@ sed -i \
+  -e 's|$spack/opt|/opt|g' \
+  -e 's|$spack/var|/var/lib|g'\
+  -e 's|$spack/share/spack/lmod|/opt/spack/modules|g'\
+  -e 's|$spack/share/spack/modules|/opt/spack/modules|g'\
+  @
 
 %build
 # Nothing to build
@@ -263,9 +265,9 @@ rm -f share/spack/setup-tutorial-env.sh
 ## No need for the standalone scripts
 rm -f lib/spack/external/macholib/macho_*.py
 ## Fix shebangs
-sed -i 's@#!/bin/env sh@#!/bin/bash@' var/spack/repos/builtin/packages/beast-tracer/tracer
-sed -i 's@#! /usr/bin/env bash@ #!/bin/bash@' share/spack/docker/entrypoint.bash
-sed -i 's@#!/usr/bin/env bash@#!/bin/bash@' share/spack/docker/package-index/split.sh
+#sed -i 's@#!/bin/env sh@#!/bin/bash@' var/spack/repos/builtin/packages/beast-tracer/tracer
+#sed -i 's@#! /usr/bin/env bash@ #!/bin/bash@' share/spack/docker/entrypoint.bash
+#sed -i 's@#!/usr/bin/env bash@#!/bin/bash@' share/spack/docker/package-index/split.sh
 
 mkdir -p %{buildroot}%{spack_dir}
 mkdir -p %{buildroot}%{spack_dir}/opt
@@ -281,7 +283,7 @@ ln -sf %{buildroot}/%{_localstatedir}/cache/spack %{buildroot}%{_localstatedir}/
 
 # Copy files to corresponding paths
 cp -r etc %{buildroot}%{_prefix}
-cp -r lib/spack/{env,external,llnl,spack} %{buildroot}%{spack_dir}
+cp -r lib/spack/{env,external,llnl,spack,spack_installable} %{buildroot}%{spack_dir}
 cp -r share/spack/* %{buildroot}%{_datarootdir}/spack
 cp -r var/spack/* %{buildroot}%{_localstatedir}/lib/spack
 cp -r bin/sbang %{buildroot}/%{_bindir}
@@ -294,6 +296,7 @@ sed -i -e 's#@@_sysconfdir@@#%{_sysconfdir}#' %{buildroot}/%{spack_dir}/run-find
 sed -i 's@\(\sroot:\) /opt/spack@\1 ~/spack/packages@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
 sed -i 's@\(\ssource_cache:\).*@\1 /var/tmp/$user/spack-cache@' %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml
 cat >>  %{buildroot}%{_sysconfdir}/skel/.spack/config.yaml <<EOF
+
   binary_index_root: ~/.spack/indices
 EOF
 
@@ -443,7 +446,7 @@ if [ -e /etc/os-release ] ;  then
 fi
 sed -i "s@HOSTTYPE@$HOSTTYPE@" %{spack_dir}/etc/spack/compilers.yaml
 # find installed programms
-/usr/lib/spack/run-find-external.sh
+ /usr/lib/spack/run-find-external.sh
 mkdir -p /opt/spack
 chgrp spack /opt/spack
 chmod 0775 /opt/spack