You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorial_developer_workflows.rst
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,28 +138,35 @@ Now we are ready to begin work on the actual application.
138
138
Development iteration cycles
139
139
-----------------------------
140
140
141
-
Let's assume that scr has a bug, and we'd like to patch scr to find out what the problem is.
142
-
First, we tell Spack that we'd like to check out the version of scr that we want to work on.
141
+
Let's assume that ``scr`` has a bug, and we'd like to patch ``scr`` to find out what the problem is.
142
+
First, we tell Spack that we'd like to check out the version of ``scr`` that we want to work on.
143
143
In this case, it will be the 3.1.0 release that we want to write a patch for:
144
144
145
145
.. literalinclude:: outputs/dev/develop-1.out
146
146
:language: spec
147
147
148
-
The ``spack develop`` command marks the package as being a "development" package in the ``spack.yaml``.
149
-
This adds a special ``dev_path=`` attribute to the spec for the package, so Spack remembers where the source code for this package is located.
150
-
The develop command also downloads/checks out the source code for the package.
151
-
By default, the source code is downloaded into a subdirectory of the environment.
152
-
You can change the location of this source directory by modifying the ``path:`` attribute of the develop configuration in the environment.
148
+
The ``spack develop`` command marks the package as being a "development" package based on the supplied ``develop spec``.
149
+
Develop specs are listed in their own ``develop`` section inside the ``spack.yaml``.
150
+
The mechanics of how this section is used to enforce develpoment are as follows:
151
+
152
+
1. Specs in the environment that ``satisfy`` the develop specs are selected for development.
153
+
2. Any specs selected in step 1 receive a ``dev_path=`` variant. This variant tells Spack where to find the source code for the spec.
154
+
3. Calls to ``spack install`` will now use the source code at ``dev_path`` when building that package. Spack doesn't clean this build up after a successful build so subsequent calls to ``spack install`` trigger incremental builds.
155
+
156
+
If the environment is already concretized ``spack develop`` performs step 1 and 2 insitu and updates the ``spack.lock`` file unless the ``--no-modify-concrete-specs`` option is passed.
157
+
If ``--no-modify-concrete-specs`` is passed, the environment is not yet concretized, or needs to be futher changed to satisfy the develop specs (i.e. change version of the package) then selection of develop specs and assignment of ``dev_path`` are handled by the concretizer.
158
+
159
+
So how does Spack determine the value of the ``dev_path`` variant?
160
+
By default, the source code is downloaded into a subdirectory of the environment using Spack's staging functionality.
161
+
You can change the location of this source directory by modifying the ``path:`` attribute of the develop configuration in the environment or by passing the ``--path`` options when calling ``spack develop``.
153
162
154
163
There are a few gotchas with the ``spack develop`` command
155
164
156
-
* You often specify the package version manually when specifying a package as a dev package.
157
-
Spack needs to know the version of the dev package so it can supply the correct flags for the package's build system.
158
-
If a version is not supplied, then Spack will take the maximum version defined in the package where `infinity versions <https://spack.readthedocs.io/en/latest/packaging_guide_creation.html#version-comparison>`_ like ``develop`` and ``main`` have a higher value than the numeric versions.
165
+
* Spack needs to know the version of the dev package so it can supply the correct flags for the package's build system.
166
+
If a version is not supplied or detectable in the environment, then Spack falls back to the maximum version defined in the package where `infinity versions <https://spack.readthedocs.io/en/latest/packaging_guide_creation.html#version-comparison>`_ like ``develop`` and ``main`` have a higher value than the numeric versions.
159
167
* You should ensure a spec for the package you are developing appears in the DAG of at least one of the roots of the environment with the same version that you are developing.
160
168
``spack add <package>`` with the matching version you want to develop is a way to ensure the develop spec is satisfied in the ``spack.yaml`` environments file.
161
169
This is because develop specs are not concretization constraints but rather criteria for adding the ``dev_path=`` variant to existing spec.
162
-
* You'll need to re-concretize the environment so that the version number and the ``dev_path=`` attributes are properly added to the cached spec in ``spack.lock``.
0 commit comments