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
+29-13Lines changed: 29 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,7 +139,7 @@ Development iteration cycles
139
139
-----------------------------
140
140
141
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.
142
+
First, we tell Spack that we'd like to check out the version of ``scr`` in our environment.
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
@@ -188,7 +188,7 @@ If the file times are newer, it will rebuild ``scr`` and any other package that
188
188
:language: console
189
189
190
190
Here, the build failed as expected.
191
-
We can look at the output for the build in ``scr/spack-build-out.txt`` to find out why, or we can launch a shell directly with the appropriate environment variables to figure out what went wrong by using ``spack build-env scr@2.0 -- bash``.
191
+
We can look at the output for the build in ``scr/spack-build-out.txt`` to find out why, or we can launch a shell directly with the appropriate environment variables to figure out what went wrong by using ``spack build-env scr -- bash``.
192
192
If that's too much to remember, then sourcing ``scr/spack-build-env.txt`` will also set all the appropriate environment variables so we can diagnose the build ourselves.
193
193
Now let's fix it and rebuild directly.
194
194
@@ -205,14 +205,33 @@ If your build system can take advantage of the previously compiled object files
205
205
- If your package uses CMake with the typical ``cmake`` / ``build`` / ``install`` build stages, you'll get iterative builds for free with Spack because CMake doesn’t modify the filetime on the ``CMakeCache.txt`` file if your cmake flags haven't changed.
206
206
- If your package uses autoconf, then rerunning the typical ``autoreconf`` stage typically modifies the filetime of ``config.h``, which can trigger a cascade of rebuilding.
207
207
208
-
Multiple packages can also be marked as develop.
209
-
If we were co-developing ``macsio``, we could run
208
+
Multi-package development
209
+
-------------------------
210
+
211
+
You may have noticed that ``macsio`` is restaged and fully rebuilt each time we call ``spack install``.
212
+
This is an unnecessary expense for cross package development.
213
+
Luckily, Spack has tools to reduce this expense.
214
+
We will use this as an opportunity to introduce another ``spack develop`` feature: the ``--recursive`` option.
210
215
211
216
.. literalinclude:: outputs/dev/develop-5.out
212
217
:language: console
213
218
214
-
Note that we intentionally gave a different version and in the examples above ``macsio`` never received the ``dev_path`` variant.
215
-
This example is to show a few gotchas with the ``spack develop`` command
219
+
``spack develop --recursive`` can only be used with a concrete environment.
220
+
When called Spack traces the graph from the supplied develop spec to every root in the graph that transitivley depends on the develop package.
221
+
Using ``--recursive`` can be very powerful wehn developing applications deep in a graph.
222
+
In this case our development point is very close to the root spec so we could have called ``spack develop macsio`` and gotten the same result.
223
+
224
+
Pre-configuring development environments
225
+
----------------------------------------
226
+
227
+
So far all of our calls to ``spack develop`` have been on a concretized environment, and we have allowed spack to automatically update the build specs for us.
228
+
If we don't want Spack to update the concrete environment's specs we can pass the ``---no-modify-concrete-spec``.
229
+
This will require you to force concretize an environment to have the develop specs take affect.
230
+
231
+
.. literalinclude:: outputs/dev/develop-6.out
232
+
:language: console
233
+
234
+
This example is to show a few gotchas with the ``spack develop`` command
216
235
217
236
* 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.
218
237
``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.
@@ -222,13 +241,8 @@ This example is to show a few gotchas with the ``spack develop`` command
222
241
223
242
If we really wanted to change to developing ``macsio@develop`` we need to change the root spec in the environment and then reconcretize.
224
243
225
-
In our case the ``1.1`` version is sufficient and we will use this as an opportunity to introduce another ``spack develop`` feature: the ``--recursive`` option.
226
-
``spack develop --recursive`` can only be used with a concrete environment.
227
-
When called Spack traces the graph from the supplied develop spec to every root in the graph that transitivley depends on the develop package.
228
-
This is a nice way to ensure that all specs are skipping restages, and performing incremental builds if their build-system allows for it.
229
-
230
-
.. literalinclude:: outputs/dev/develop-6.out
231
-
:language: console
244
+
Sharing development environments
245
+
--------------------------------
232
246
233
247
Using development workflows also lets us ship our whole development process to another developer on the team.
234
248
They can simply take our spack.yaml, create a new environment, and use this to replicate our build process.
@@ -244,13 +258,15 @@ When we're done developing, we simply tell Spack that it no longer needs to keep
244
258
.. literalinclude:: outputs/dev/wrapup.out
245
259
:language: console
246
260
261
+
----------------
247
262
Workflow Summary
248
263
----------------
249
264
250
265
Use the ``spack develop`` command with an environment to make a reproducible build environment for your development workflow.
251
266
Spack will set up all the dependencies for you and link all your packages together.
252
267
Within a development environment, ``spack install`` works similarly to ``make`` in that it will check file times to rebuild the minimum number of Spack packages necessary to reflect the changes to your build.
0 commit comments