summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-01-19 14:58:34 +0100
committerGitHub <noreply@github.com>2023-01-19 14:58:34 +0100
commita357a39963b5c9161b85f933f4001de8b951b99a (patch)
tree2071f645bdc7e8aa185674e456f03133d2b0473a
parenta7613407df64b66ea2a3c5e5a0ff4749799ecea2 (diff)
downloadspack-a357a39963b5c9161b85f933f4001de8b951b99a.tar.gz
spack-a357a39963b5c9161b85f933f4001de8b951b99a.tar.bz2
spack-a357a39963b5c9161b85f933f4001de8b951b99a.tar.xz
spack-a357a39963b5c9161b85f933f4001de8b951b99a.zip
depfile: --make-target-prefix -> --make-prefix (#35009)
Since SPACK_PACKAGE_IDS is now also "namespaced" with <prefix>, it makes more sense to call the flag `--make-prefix` and alias the old flag `--make-target-prefix` to it.
-rw-r--r--lib/spack/docs/environments.rst10
-rw-r--r--lib/spack/spack/cmd/env.py28
-rw-r--r--lib/spack/spack/test/cmd/env.py4
-rwxr-xr-xshare/spack/spack-completion.bash2
4 files changed, 22 insertions, 22 deletions
diff --git a/lib/spack/docs/environments.rst b/lib/spack/docs/environments.rst
index 4b9a3cd818..09d8f07af1 100644
--- a/lib/spack/docs/environments.rst
+++ b/lib/spack/docs/environments.rst
@@ -1039,7 +1039,7 @@ gets installed and is available for use in the ``env`` target.
$(SPACK) -e . concretize -f
env.mk: spack.lock
- $(SPACK) -e . env depfile -o $@ --make-target-prefix spack
+ $(SPACK) -e . env depfile -o $@ --make-prefix spack
env: spack/env
$(info Environment installed!)
@@ -1062,9 +1062,9 @@ the include is conditional.
.. note::
When including generated ``Makefile``\s, it is important to use
- the ``--make-target-prefix`` flag and use the non-phony target
- ``<target-prefix>/env`` as prerequisite, instead of the phony target
- ``<target-prefix>/all``.
+ the ``--make-prefix`` flag and use the non-phony target
+ ``<prefix>/env`` as prerequisite, instead of the phony target
+ ``<prefix>/all``.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Building a subset of the environment
@@ -1105,7 +1105,7 @@ associated ``Makefile`` with a prefix ``example``:
.. code:: console
- $ spack env depfile -o env.mk --make-target-prefix example
+ $ spack env depfile -o env.mk --make-prefix example
And we now include it in a different ``Makefile``, in which we create a target
``example/push/%`` with ``%`` referring to a package identifier. This target
diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py
index 8ae0c4fa5c..16e2838b67 100644
--- a/lib/spack/spack/cmd/env.py
+++ b/lib/spack/spack/cmd/env.py
@@ -588,12 +588,13 @@ def env_revert(args):
def env_depfile_setup_parser(subparser):
"""generate a depfile from the concrete environment specs"""
subparser.add_argument(
+ "--make-prefix",
"--make-target-prefix",
default=None,
metavar="TARGET",
- help="prefix Makefile targets with <TARGET>/<name>. By default the absolute "
- "path to the directory makedeps under the environment metadata dir is "
- "used. Can be set to an empty string --make-target-prefix ''.",
+ help="prefix Makefile targets (and variables) with <TARGET>/<name>. By default "
+ "the absolute path to the directory makedeps under the environment metadata dir is "
+ "used. Can be set to an empty string --make-prefix ''.",
)
subparser.add_argument(
"--make-disable-jobserver",
@@ -695,26 +696,26 @@ def env_depfile(args):
# Special make targets are useful when including a makefile in another, and you
# need to "namespace" the targets to avoid conflicts.
- if args.make_target_prefix is None:
- target_prefix = os.path.join(env.env_subdir_path, "makedeps")
+ if args.make_prefix is None:
+ prefix = os.path.join(env.env_subdir_path, "makedeps")
else:
- target_prefix = args.make_target_prefix
+ prefix = args.make_prefix
def get_target(name):
# The `all` and `clean` targets are phony. It doesn't make sense to
# have /abs/path/to/env/metadir/{all,clean} targets. But it *does* make
# sense to have a prefix like `env/all`, `env/clean` when they are
# supposed to be included
- if name in ("all", "clean") and os.path.isabs(target_prefix):
+ if name in ("all", "clean") and os.path.isabs(prefix):
return name
else:
- return os.path.join(target_prefix, name)
+ return os.path.join(prefix, name)
def get_install_target(name):
- return os.path.join(target_prefix, "install", name)
+ return os.path.join(prefix, "install", name)
def get_install_deps_target(name):
- return os.path.join(target_prefix, "install-deps", name)
+ return os.path.join(prefix, "install-deps", name)
# What things do we build when running make? By default, we build the
# root specs. If specific specs are provided as input, we build those.
@@ -742,10 +743,10 @@ def env_depfile(args):
# running tests, etc.
# NOTE: GNU Make allows directory separators in variable names, so for consistency
# we can namespace this variable with the same prefix as targets.
- if args.make_target_prefix is None:
+ if args.make_prefix is None:
pkg_identifier_variable = "SPACK_PACKAGE_IDS"
else:
- pkg_identifier_variable = os.path.join(target_prefix, "SPACK_PACKAGE_IDS")
+ pkg_identifier_variable = os.path.join(prefix, "SPACK_PACKAGE_IDS")
# All install and install-deps targets
all_install_related_targets = []
@@ -759,7 +760,7 @@ def env_depfile(args):
all_pkg_identifiers.append(tgt)
all_install_related_targets.append(get_install_target(tgt))
all_install_related_targets.append(get_install_deps_target(tgt))
- if args.make_target_prefix is None:
+ if args.make_prefix is None:
phony_convenience_targets.append(os.path.join("install", tgt))
phony_convenience_targets.append(os.path.join("install-deps", tgt))
@@ -782,7 +783,6 @@ def env_depfile(args):
"jobserver_support": "+" if args.jobserver else "",
"adjacency_list": make_targets.adjacency_list,
"phony_convenience_targets": " ".join(phony_convenience_targets),
- "target_prefix": target_prefix,
"pkg_ids_variable": pkg_identifier_variable,
"pkg_ids": " ".join(all_pkg_identifiers),
}
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
index 2b727670b3..df1de8beeb 100644
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -3115,7 +3115,7 @@ def test_environment_depfile_makefile(depfile_flags, expected_installs, tmpdir,
"-o",
makefile,
"--make-disable-jobserver",
- "--make-target-prefix=prefix",
+ "--make-prefix=prefix",
*depfile_flags,
)
@@ -3164,7 +3164,7 @@ def test_spack_package_ids_variable(tmpdir, mock_packages):
"-G",
"make",
"--make-disable-jobserver",
- "--make-target-prefix=example",
+ "--make-prefix=example",
"-o",
include_path,
)
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index c6e1120bbe..bdfa87acd5 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -1004,7 +1004,7 @@ _spack_env_revert() {
_spack_env_depfile() {
if $list_options
then
- SPACK_COMPREPLY="-h --help --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
+ SPACK_COMPREPLY="-h --help --make-prefix --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
else
_all_packages
fi