mirror of
https://git.yoctoproject.org/poky
synced 2026-04-19 15:32:13 +02:00
contributor-guide/style-guide: Add a note about task idempotence
(From yocto-docs rev: 681e6a0a4305057f7b96f5bef804391d8aff812b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> CC: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
1c8f2d8cad
commit
7ffedb40a1
@@ -257,6 +257,20 @@ Tips and Guidelines for Writing Recipes
|
||||
and ``-nativesdk`` ones, whenever possible. This avoids having to maintain multiple
|
||||
recipe files at the same time.
|
||||
|
||||
- Recipes should have tasks which are idempotent, i.e. that executing a given task
|
||||
multiple times shouldn't change the end result. The build environment is built upon
|
||||
this assumption and breaking it can cause obscure build failures.
|
||||
|
||||
- For idempotence when modifying files in tasks, it is usually best to:
|
||||
|
||||
- copy a file ``X`` to ``X.orig`` (only if it doesn't exist already)
|
||||
- then, copy ``X.orig`` back to ``X``,
|
||||
- and, finally, modify ``X``.
|
||||
|
||||
This ensures if rerun the task always has the same end result and the
|
||||
original file can be preserved to reuse. It also guards against an
|
||||
interrupted build corrupting the file.
|
||||
|
||||
Patch Upstream Status
|
||||
=====================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user