diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-20 15:59:54 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-25 14:37:26 +0100 |
commit | 79007d04fc5f43749ef9a878682bc6c488e6340e (patch) | |
tree | 0b33c78363a7aa5b2dade5d0242745073ea4166e /documentation/contributor-guide | |
parent | 3eb4532cad8623400080a331d0e7cdcff033d309 (diff) | |
download | poky-79007d04fc5f43749ef9a878682bc6c488e6340e.tar.gz |
contributor-guide/style-guide: Add a note about task idempotence
(From yocto-docs rev: 7d715d62c32ab81d26bf1ff82f79ad2c4a2e3f85)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
CC: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/contributor-guide')
-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 | ||