summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-20 15:59:54 +0100
committerSteve Sakoman <steve@sakoman.com>2023-10-11 03:54:46 -1000
commit1d766e93b42361b7fa846702fe8039b3b0395395 (patch)
treeeea88f9c6f04dbfa2714ea0c8971188e3ad1307c
parentf73ea64bc7d3fa26887c5a939f61775189bd4073 (diff)
downloadpoky-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.rst14
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
260Patch Upstream Status 274Patch Upstream Status
261===================== 275=====================
262 276