spack env create: allow creation from environment dir#51433
spack env create: allow creation from environment dir#51433
Conversation
Signed-off-by: Gregory Becker <[email protected]>
7bdf196 to
4373a47
Compare
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
|
@becker33 it would be cool to extend this functionality a little to allow someone to clone a named environment -> to an independent environment in a directory like so, $ spack env create /path/to/new/environment myoldenv |
|
@alecbcs that is already covered by this PR |
|
Trying this PR I ran into a couple of errors on edge cases. Happy to help work on fixing these if needed. While the following works when creating a new environment, > spack env create .
==> Created independent environment in: /Users/scott112/src/scratch/spack-test
==> Activate with: spack env activate .I noticed that if you attempt to do the same while cloning an existing environment it fails, > spack env create . default
==> Error: [Errno 17] File exists: '.'If you point to a nonexistent directory it appears to then work, but fails to generate the view. > spack env create ./spack-env-test default
==> Created independent environment in: /path/to/spack-env-test
==> Activate with: spack env activate ./spack-env-test
==> Error: Failed to generate environment view, because the target /path/to/spack-env-test/.spack-env/._view/52zrqd743mpt4bo2evttasinwfeji2zl already exists or is not empty. To update the view, remove this path, and run `spack env view regenerate` |
|
I think it's more accurate to say it emits an error about the view -- you're right that the problem is that the view already exists. |
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
|
No need for the label, was merged before we branched |
Currently, when an environment is created from another environment's lockfile, it loses all config information. This not relevant if the environment is installed as-is, but matters when reconcretizing.
Additionally, other artifacts in the environment (such as repos or developer source) are either ignored or rewritten into absolute paths to the original environment.
This PR introduces a capability to create an environment as a copy of another entire environment. It uses the same syntax as before (
spack env create myenv /path/to/env/spack.{yaml,lock}), but allows referencing the environment dir.or the environment name
This copies the entire environment dir, and only rewrites relative paths that point outside the environment (e.g.
path: ../../foo).includes unit test and docs updates.