patch: add workdir option (#5501)

* patch: add working_dir option
* added documentation
This commit is contained in:
Christoph Junghans
2017-10-02 23:56:43 -06:00
committed by Todd Gamblin
parent 35085fdae2
commit d22ee8f993
3 changed files with 46 additions and 11 deletions

View File

@@ -1304,6 +1304,36 @@ It's generally easier to just structure your patch file so that it
applies cleanly with ``-p1``, but if you're using a patch you didn't
create yourself, ``level`` can be handy.
"""""""""""""""
``working_dir``
"""""""""""""""
This tells spack where to run the ``patch`` command. By default,
the working directory is the source path of the stage (``.``).
However, sometimes patches are made with respect to a subdirectory
and this is where the working directory comes in handy. Internally,
the working directory is given to ``patch`` via the ``-d`` option.
Let's take the example patch from above and assume for some reason,
it can only be downloaded in the following form:
.. code-block:: diff
:linenos:
--- a/romio/adio/ad_lustre/ad_lustre_rwcontig.c 2013-12-10 12:05:44.806417000 -0800
+++ b/romio/adio/ad_lustre/ad_lustre_rwcontig.c 2013-12-10 11:53:03.295622000 -0800
@@ -8,7 +8,7 @@
* Copyright (C) 2008 Sun Microsystems, Lustre group
\*/
-#define _XOPEN_SOURCE 600
+//#define _XOPEN_SOURCE 600
#include <stdlib.h>
#include <malloc.h>
#include "ad_lustre.h"
Hence, the patch needs to applied in the ``src/mpi`` subdirectory, and the
``working_dir='src/mpi'`` option would exactly do that.
^^^^^^^^^^^^^^^^^^^^^
Patch functions
^^^^^^^^^^^^^^^^^^^^^