diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-20 15:59:54 +0100 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-10-11 03:54:46 -1000 |
commit | 1d766e93b42361b7fa846702fe8039b3b0395395 (patch) | |
tree | eea88f9c6f04dbfa2714ea0c8971188e3ad1307c | |
parent | f73ea64bc7d3fa26887c5a939f61775189bd4073 (diff) | |
download | poky-1d766e93b42361b7fa846702fe8039b3b0395395.tar.gz |
contributor-guide/style-guide: Add a note about task idempotence
(From yocto-docs rev: 266f018e816047ea3f91efa4b1944221ea3a2005)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
CC: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-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 | ||