Repository: spack/spack

Issue:
lua-luaposix needs unzip, adding dependency to lua doesn't work, what to do?
I'm having my first Spack on Ubuntu adventure, using a very minimally configured Ubuntu instance on AWS.

lua-luaposix wouldn't install:

```
1 error found in build log:
  >> 5    Error: Directory luaposix-release-v33.4.0 not found inside archive release-v33.4.0.zip
     6    Using luaposix-33.4.0-1.rockspec... switching to 'build' mode
```

I can fix it by using `apt-get` to install the *unzip* package.

I thought that I could fix it for all luarocks based packages by adding 

```diff
diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py
index eec46f9..cdc63f8 100644
--- a/var/spack/repos/builtin/packages/lua/package.py
+++ b/var/spack/repos/builtin/packages/lua/package.py
@@ -49,6 +49,7 @@ class Lua(Package):

     depends_on('ncurses')
     depends_on('readline')
+    depends_on('unzip', type='build')

     resource(
         name="luarocks",
```

but that didn't work.  The dependency is there:

```
hartzell@ubuntu-spack-test:~/spack$ spack spec lua-luaposix
Input spec
--------------------------------
lua-luaposix

Concretized
--------------------------------
lua-luaposix@33.4.0%gcc@5.5.0 arch=linux-ubuntu14.04-x86_64
    ^lua@5.3.4%gcc@5.5.0 arch=linux-ubuntu14.04-x86_64
        ^ncurses@6.1%gcc@5.5.0~symlinks~termlib arch=linux-ubuntu14.04-x86_64
            ^pkgconf@1.4.2%gcc@5.5.0 arch=linux-ubuntu14.04-x86_64
        ^readline@7.0%gcc@5.5.0 arch=linux-ubuntu14.04-x86_64
        ^unzip@6.0%gcc@5.5.0 arch=linux-ubuntu14.04-x86_64
```

but it seems like that PATH isn't being set up for the top level.

Adding the depend to *lua-luaposix* does work:

```diff
diff --git a/var/spack/repos/builtin/packages/lua-luaposix/package.py b/var/spack/repos/builtin/packages/lua-luaposix/package.py
index 4db3f84..f29ea54 100644
--- a/var/spack/repos/builtin/packages/lua-luaposix/package.py
+++ b/var/spack/repos/builtin/packages/lua-luaposix/package.py
@@ -34,6 +34,7 @@ class LuaLuaposix(Package):
     version('33.4.0', 'b36ff049095f28752caeb0b46144516c')

     extends("lua")
+    depends_on('unzip', type='build')

     def install(self, spec, prefix):
         rockspec = glob.glob('luaposix-*.rockspec')
```

Is the right fix here to use the system unzip or to update *lua-luaposix* or?

g.



Discussion:
@hartzell Can you create PR with your suggested change to `lua-luaposix`?  This has helped me on a couple of systems.
I can, but I'm confused about why I ended up needing to put it in the `lua-luaposix` package.

It'd be great if someone who understand the extension system (@adamjstewart @alalazo ???) could loan me a clue about whether a dependencies are supposed to be carried through extensions.

I don't know if `lua-luaposix` is the only lua package that will need this, or ...


@KineticTheory -- if you want to grab it and run with it I won't be offended.  I no longer have easy access to Ubuntu systems....
From what I understand from @tgamblin's explanations in #8802 `build` dependencies are not transient. I.e. adding the `depends_on('unzip', type='build')` to `lua` does not affect the build environment for `lua-luaposix` (imo this also the intended behaviour). 

But afaik there was a discussion on what kind of dependencies `spack` should take for granted and iirc `unzip` was one of these things where people weren't naturally like "of course `spack` should take care of this". Personally I'd just add it to `lua-luaposix` as a build dependency

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py
--- a/var/spack/repos/builtin/packages/lua/package.py
+++ b/var/spack/repos/builtin/packages/lua/package.py
@@ -49,6 +49,8 @@ class Lua(Package):
 
     depends_on('ncurses')
     depends_on('readline')
+    # luarocks needs unzip for some packages (e.g. lua-luaposix)
+    depends_on('unzip', type='run')
 
     resource(
         name="luarocks",


Test patch: