contributor-guide/style-guide: Refer to recipes, not packages
PATCH 1/9 contributor-guide/style-guide: Refer to recipes, not packages
From: Michael Opdenacker <[email protected]>
From: Richard Purdie <[email protected]>
Whilst often referred to as packages by people we should use the more accurate term in documentation, 'recipe' instead of 'packages'.
--- .../contributor-guide/recipe-style-guide.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
documentation/contributor-guide/recipe-style-guide.rst +8 -7
@@ -7,17 +7,18 @@ Recipe Naming Conventions ========================= In general, most recipes should follow the naming convention -``recipes-category/package/packagename_version.bb``. Recipes for related -projects may share the same package directory. ``packagename``, ``category``, -and ``package`` may contain hyphens, but hyphens are not allowed in ``version``. +``recipes-category/recipename/recipename_version.bb``. Recipes for related +projects may share the same recipe directory. ``recipename`` and ``category`` +may contain hyphens, but hyphens are not allowed in ``version``. If the recipe is tracking a Git revision that does not correspond to a released -version of the software, ``version`` may be ``git`` (e.g. ``packagename_git.bb``) +version of the software, ``version`` may be ``git`` (e.g. ``recipename_git.bb``) +and the recipe would set :term:`PV`. Version Policy ============== -Our versions follow the form ``<package epoch>:<package version>-<package revision>`` +Our versions follow the form ``<epoch>:<version>-<revision>`` or in BitBake variable terms ${:term:`PE`}:${:term:`PV`}-${:term:`PR`}. We generally follow the `Debian <https://www.debian.org/doc/debian-policy/ch-controlfields.html#version>`__ version policy which defines these terms.
@@ -26,7 +27,7 @@ In most cases the version :term:`PV` will be set automatically from the recipe file name. It is recommended to use released versions of software as these are revisions that upstream are expecting people to use. -Package versions should always compare and sort correctly so that upgrades work +Recipe versions should always compare and sort correctly so that upgrades work as expected. With conventional versions such as ``1.4`` upgrading ``to 1.5`` this happens naturally, but some versions don't sort. For example, ``1.5 Release Candidate 2`` could be written as ``1.5rc2`` but this sorts after
@@ -62,7 +63,7 @@ Version Number Changes The :term:`PR` variable is used to indicate different revisions of a recipe that reference the same upstream source version. It can be used to force a -new version of a package to be installed onto a device from a package feed. +new version of a recipe to be installed onto a device from a package feed. These once had to be set manually but in most cases these can now be set and incremented automatically by a PR Server connected with a package feed.
Signature · 1 line
2.34.1
PATCH 2/9 contributor-guide/style-guide: Add a note about task idempotence
From: Michael Opdenacker <[email protected]>
From: Richard Purdie <[email protected]>
---
Changes in V2:
- Use a bulleted list to clarify the order of steps (Suggested by Yoann Congal)
- Recall that we are talking about idempotence in tasks. Useful for people overlooking the previous paragraph.
--- .../contributor-guide/recipe-style-guide.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
documentation/contributor-guide/recipe-style-guide.rst +14 -0
@@ -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 =====================
Signature · 1 line
2.34.1
PATCH 3/9 bsp-guide: bsp.rst: replace reference to wiki
In reply to [email protected]From: Michael Opdenacker <[email protected]>
--- documentation/bsp-guide/bsp.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
documentation/bsp-guide/bsp.rst +2 -2
@@ -893,8 +893,8 @@ Yocto Project: ``recipes-*`` subdirectories specific to the recipe's function, or within a subdirectory containing a set of closely-related recipes. The recipes themselves should follow the general guidelines for - recipes used in the Yocto Project found in the ":oe_wiki:`OpenEmbedded - Style Guide </Styleguide>`". + recipes found in the ":doc:`../contributor-guide/recipe-style-guide`" + in the Yocto Project and OpenEmbedded Contributor Guide. - *License File:* You must include a license file in the ``meta-bsp_root_name`` directory. This license covers the BSP
Signature · 1 line
2.34.1
PATCH 4/9 dev-manual: new-recipe.rst: replace reference to wiki
In reply to [email protected]From: Michael Opdenacker <[email protected]>
--- documentation/dev-manual/new-recipe.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
documentation/dev-manual/new-recipe.rst +3 -3
@@ -1442,9 +1442,9 @@ doing the following: Following Recipe Style Guidelines ================================= -When writing recipes, it is good to conform to existing style -guidelines. The :oe_wiki:`OpenEmbedded Styleguide </Styleguide>` wiki page -provides rough guidelines for preferred recipe style. +When writing recipes, it is good to conform to existing style guidelines. +See the ":doc:`../contributor-guide/recipe-style-guide`" in the Yocto Project +and OpenEmbedded Contributor Guide for reference. It is common for existing recipes to deviate a bit from this style. However, aiming for at least a consistent style is a good idea. Some
Signature · 1 line
2.34.1
PATCH 5/9 contributor-guide: recipe-style-guide: add more patch tagging examples
In reply to [email protected]From: Michael Opdenacker <[email protected]>
From: Roland Hieber <[email protected]>
--- .../contributor-guide/recipe-style-guide.rst | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
documentation/contributor-guide/recipe-style-guide.rst +20 -1
@@ -336,7 +336,10 @@ the status should be changed to ``Submitted [where]``, and an additional ``Signed-off-by:`` line should be added to the patch by the person claiming responsibility for upstreaming. -For example, if the patch has been submitted upstream:: +Examples +-------- + +Here's an example of a patch that has been submitted upstream:: rpm: Adjusted the foo setting in bar
@@ -351,3 +354,19 @@ For example, if the patch has been submitted upstream:: A future update can change the value to ``Accepted`` or ``Denied`` as appropriate. + +Another example of a patch that is specific to OpenEmbedded:: + + Do not treat warnings as errors + + There are additional warnings found with musl which are + treated as errors and fails the build, we have more combinations + than upstream supports to handle. + + Upstream-Status: Inappropriate [oe specific] + +Here's a patch that has been backported from an upstream commit:: + + include missing sys/file.h for LOCK_EX + + Upstream-Status: Backport [https://github.com/systemd/systemd/commit/ac8db36cbc26694ee94beecc8dca208ec4b5fd45]
Signature · 1 line
2.34.1
PATCH 6/9 contributor-guide: recipe-style-guide: add section about CVE patches
In reply to [email protected]From: Michael Opdenacker <[email protected]>
From: Roland Hieber <[email protected]>
This was previously included in the OpenEmbedded wiki page [1], but was not ported along with the rest in commit 95c9a1e1e78bbfb82ade (2023-09-12, Michael Opdenacker: "contributor-guide: recipe-style-guide:
add Upstream-Status").
[1]: https://www.openembedded.org/index.php?title=Commit_Patch_Message_Guidelines&oldid=10935
Group the examples in their own sections (but name it differently from any other section in this document so that sphinx doesn't generate a warning about duplicate labels).
--- .../contributor-guide/recipe-style-guide.rst | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
documentation/contributor-guide/recipe-style-guide.rst +25 -0
@@ -370,3 +370,28 @@ Here's a patch that has been backported from an upstream commit:: include missing sys/file.h for LOCK_EX Upstream-Status: Backport [https://github.com/systemd/systemd/commit/ac8db36cbc26694ee94beecc8dca208ec4b5fd45] + +CVE patches +=========== + +In order to have a better control of vulnerabilities, patches that fix CVEs must +contain a ``CVE:`` tag. This tag list all CVEs fixed by the patch. If more than +one CVE is fixed, separate them using spaces. + +CVE Examples +------------ + +This should be the header of patch that fixes :cve:`2015-8370` in GRUB2:: + + grub2: Fix CVE-2015-8370 + + [No upstream tracking] -- https://bugzilla.redhat.com/show_bug.cgi?id=1286966 + + Back to 28; Grub2 Authentication + + Two functions suffer from integer underflow fault; the grub_username_get() and grub_password_get()located in + grub-core/normal/auth.c and lib/crypto.c respectively. This can be exploited to obtain a Grub rescue shell. + + Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/grub.git/commit/?id=451d80e52d851432e109771bb8febafca7a5f1f2] + CVE: CVE-2015-8370 + Signed-off-by: Joe Developer <[email protected]>
Signature · 1 line
2.34.1
PATCH 7/9 contributor-guide: discourage marking patches as Inappropriate
In reply to [email protected]From: Michael Opdenacker <[email protected]>
From: Roland Hieber <[email protected]>
It was never really clear what all those reasons really meant, and every patch submitted upstream liftens the maintenance on the Yocto side. So remove the current list, and replace it with two reasons in which an upstream submission likely won't benefit the upstream project.
--- .../contributor-guide/recipe-style-guide.rst | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-)
documentation/contributor-guide/recipe-style-guide.rst +14 -16
@@ -314,22 +314,20 @@ following status strings: ``Inappropriate [reason]`` The patch is not appropriate for upstream, include a brief reason on the - same line enclosed with ``[]``. The reason can be: - - - ``not author`` (you are not the author and do not intend to upstream this, - the source must be listed in the comments) - - ``native`` - - ``licensing`` - - ``configuration`` - - ``enable feature`` - - ``disable feature`` - - ``bugfix`` (add bug URL here) - - ``embedded specific`` - - ``other`` (give details in comments) - -The various ``Inappropriate [reason]`` status items are meant to indicate that -the person responsible for adding this patch to the system does not intend to -upstream the patch for a specific reason. + same line enclosed with ``[]``. In the past, there were several different + reasons not to submit patches upstream, but we have to consider that every + non-upstreamed patch means a maintainance burden for recipe maintainers. + Currently, the only reasons to mark patches as inappropriate for upstream + submission are: + + - ``oe specific``: the issue is specific to how OpenEmbedded performs builds + or sets things up at runtime, and can be resolved only with a patch that + is not however relevant or appropriate for general upstream submission. + - ``upstream ticket <link>``: the issue is not specific to Open-Embedded + and should be fixed upstream, but the patch in its current form is not + suitable for merging upstream, and the author lacks sufficient expertise + to develop a proper patch. Instead the issue is handled via a bug report + (include link). Of course, if another person later takes care of submitting this patch upstream, the status should be changed to ``Submitted [where]``, and an additional
Signature · 1 line
2.34.1
PATCH 8/9 contributor-guide: deprecate "Accepted" patch status
In reply to [email protected]From: Michael Opdenacker <[email protected]>
From: Roland Hieber <[email protected]>
This is in accordance with the gatesgarth Release Notes:
Quoted 6 lines
In the ``Upstream-Status`` header convention for patches, ``Accepted`` has | been replaced with ``Backport`` as these almost always mean the same thing i.e. the patch is already upstream and may need to be removed in a future recipe upgrade. If you are adding these headers to your own patches then use Backport to indicate that the patch has been sent upstream.
<https://docs.yoctoproject.org/migration-guides/migration-3.2.html#miscellaneous-changes>
--- .../contributor-guide/recipe-style-guide.rst | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
documentation/contributor-guide/recipe-style-guide.rst +5 -8
@@ -292,13 +292,10 @@ following status strings: Submitted to upstream, waiting for approval. Optionally include where it was submitted, such as the author, mailing list, etc. -``Accepted`` - Accepted in upstream, expect it to be removed at next update, include - expected version info. - -``Backport`` - Backported from new upstream version, because we are at a fixed version, - include upstream version info. +``Backport [version]`` + Accepted upstream and included in the next release, or backported from newer + upstream version, because we are at a fixed version. + Include upstream version info (e.g. commit ID or next expected version). ``Denied`` Not accepted by upstream, include reason in patch.
@@ -350,7 +347,7 @@ Here's an example of a patch that has been submitted upstream:: Signed-off-by: Joe Developer <[email protected]> -A future update can change the value to ``Accepted`` or ``Denied`` as +A future update can change the value to ``Backport`` or ``Denied`` as appropriate. Another example of a patch that is specific to OpenEmbedded::
Signature · 1 line
2.34.1
PATCH 9/9 contributor-guide: style-guide: discourage using Pending patch status
In reply to [email protected]From: Michael Opdenacker <[email protected]>
From: Roland Hieber <[email protected]>
--- documentation/contributor-guide/recipe-style-guide.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
documentation/contributor-guide/recipe-style-guide.rst +8 -1
@@ -286,7 +286,14 @@ Then, you should also add an ``Upstream-Status:`` tag containing one of the following status strings: ``Pending`` - No determination has been made yet or not yet submitted to upstream. + No determination has been made yet, or patch has not yet been submitted to + upstream. + + Keep in mind that every patch submitted upstream reduces the maintainance + burden in OpenEmbedded and Yocto Project in the long run, so this patch + status should only be used in exceptional cases if there are genuine + obstacles to submitting a patch upstream; the reason for that should be + included in the patch. ``Submitted [where]`` Submitted to upstream, waiting for approval. Optionally include where
Signature · 1 line
2.34.1