Change installation directory for software packages

38 views
Skip to first unread message

Richard Young

unread,
Dec 6, 2023, 6:22:28 PM12/6/23
to Spack
I have recently installed version 0.21.1 of spack and am configuring to match previous installations, however, I don't seem to be able to change the installation directory name. On previous installations in config.yaml, I used the following settings:

root: /opt/sw
projections:
   all: "${PACKAGE}/${PACKAGE}-${VERSION}-${HASH:3}"

this would install a package into:

/opt/sw/xz/xz-5.2.7-wxb

With the same changes in 0.21.1 or the following:

root: /opt/sw
projections:
   all: '{name}/{name}-{version}-{hash:3}'

all packages get installed into a directory of a name similar to below:

__spack.pkg.builtin.gmake.Gmake_object_at_0x7f59a5fc4eb8_

this directory and its module file work correctly but it's not the same format as previous installations. Is there a way of changing the default installation directory?

Thank you.
Richard

Richard A. Young

HPC Systems Engineer | Office of Research

Office of Research | Research and Innovation Division


Todd Gamblin

unread,
Dec 7, 2023, 12:21:37 PM12/7/23
to Richard Young, Spack
Hi Richard:

One the backports/v0.21.1 branch (note that 0.21.1 is not released), I see what you see with the first config:

> cat config.yaml

config:

  install_tree:

    root: /opt/sw

    projections:

      all: "${PACKAGE}/${PACKAGE}-${VERSION}-${HASH:3}"

> sudo spack -C . python -c 'from spack.spec import Spec; print(Spec("zlib").concretized().prefix)'

/opt/sw/__spack.pkg.builtin.zlib.Zlib_object_at_0x107add150_/__spack.pkg.builtin.zlib.Zlib_object_at_0x107add150_-_1.3-_yr2


But not the second:

> cat config.yaml

config:

  install_tree:

    root: /opt/sw

    projections:

      all: '{name}/{name}-{version}-{hash:3}'

> sudo spack -C . python -c 'from spack.spec import Spec; print(Spec("zlib").concretized().prefix)'

/opt/sw/zlib/zlib-1.3-yr2


We removed the first syntax in v0.20; it was deprecated in 0.15:

So, the second one should still work the way you want.

What you’re seeing is that {package} *is* actually a property on the spec object (we don’t restrict this too much), so it gets you spec.package, which is the Package object that corresponds to the Spec, which is <spack.pkg.builtin.zlib.Zlib_object_at_0x107add150>.  Then Spack converts $ and <> to _ to sanitize the path.  It’s not pretty but I don’t think we’re likely to remove that functionality -- users seem to like using different properties of the spec to format their strings.

Let us know if {name} doesn’t work.

-Todd


--
You received this message because you are subscribed to the Google Groups "Spack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spack+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spack/27867a38-4ce4-4413-b286-8d8e59590f00n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages