diff options
-rw-r--r-- | documentation/contributor-guide/recipe-style-guide.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/documentation/contributor-guide/recipe-style-guide.rst b/documentation/contributor-guide/recipe-style-guide.rst index 1a1c1c6ee2..b63172bd77 100644 --- a/documentation/contributor-guide/recipe-style-guide.rst +++ b/documentation/contributor-guide/recipe-style-guide.rst | |||
@@ -257,6 +257,20 @@ Tips and Guidelines for Writing Recipes | |||
257 | and ``-nativesdk`` ones, whenever possible. This avoids having to maintain multiple | 257 | and ``-nativesdk`` ones, whenever possible. This avoids having to maintain multiple |
258 | recipe files at the same time. | 258 | recipe files at the same time. |
259 | 259 | ||
260 | - Recipes should have tasks which are idempotent, i.e. that executing a given task | ||
261 | multiple times shouldn't change the end result. The build environment is built upon | ||
262 | this assumption and breaking it can cause obscure build failures. | ||
263 | |||
264 | - For idempotence when modifying files in tasks, it is usually best to: | ||
265 | |||
266 | - copy a file ``X`` to ``X.orig`` (only if it doesn't exist already) | ||
267 | - then, copy ``X.orig`` back to ``X``, | ||
268 | - and, finally, modify ``X``. | ||
269 | |||
270 | This ensures if rerun the task always has the same end result and the | ||
271 | original file can be preserved to reuse. It also guards against an | ||
272 | interrupted build corrupting the file. | ||
273 | |||
260 | Patch Upstream Status | 274 | Patch Upstream Status |
261 | ===================== | 275 | ===================== |
262 | 276 | ||