xref: /openbmc/docs/meta-layer-guidelines.md (revision 9746aeb8)
1*9746aeb8SBrad Bishop# OpenBMC meta layer guidelines
2d078e0d2SEd Tanous
3d078e0d2SEd TanousWhile most of these could be called "rules", in specific scenarios might be
4d078e0d2SEd Tanousactively against the intended goals.  This is why each guideline has a very
5d078e0d2SEd Tanouslarge "Why" section, to ensure that the intent is being met, and that if
6d078e0d2SEd Tanousexceptions to the rules exist, then can be understood and managed by the
7d078e0d2SEd Tanousproject.  In general, if there's a question, and the community agrees, these
8d078e0d2SEd Tanousguidelines can be overridden on a case by case basis.
9d078e0d2SEd Tanous
10*9746aeb8SBrad Bishop## Meta layers should not patch projects that exist within the openBMC tree
11d078e0d2SEd Tanous
12*9746aeb8SBrad Bishop**Why?**
13*9746aeb8SBrad Bishop
14d078e0d2SEd TanousIn general, keeping the codebase building in the long term is difficult.
15d078e0d2SEd TanousOpening the possibility that patches exist that repo maintainers aren't aware
16d078e0d2SEd Tanousof makes it much more likely that a single machine breaks, or we have behavior
17d078e0d2SEd Tanousdifferences between two repos.
18*9746aeb8SBrad Bishop
19d078e0d2SEd TanousAlso, in general, the maintainer is there to ensure that the greater community,
20d078e0d2SEd Tanousfeatures, and codebase are prioritized over any one patch, and generally does so
21d078e0d2SEd Tanousin code review.  If patches are checked into meta layers, generally the
22d078e0d2SEd Tanousmaintainer is not a reviewer, thereby defeating most of the purpose of the role
23d078e0d2SEd Tanousof the maintainer.
24d078e0d2SEd Tanous
25*9746aeb8SBrad Bishop**What should I do instead?**
26*9746aeb8SBrad Bishop
27d078e0d2SEd TanousDiscuss with the project maintainers and the community about whether or not the
28d078e0d2SEd Tanousfeature you're building needs to be configurable, or if it can be applied to all
29d078e0d2SEd Tanousprojects.  If it can be applied to all, simply check it into the master branch
30d078e0d2SEd Tanousthrough a gerrit review, and follow the processes outlined for the repository.
31d078e0d2SEd TanousIf it needs to be per-project or per-machine configurable, check it in under a
32d078e0d2SEd Tanouscompile time option, at the suggestion of the maintainer, and add a
33d078e0d2SEd TanousPACKAGECONFIG entry that can be set to enable it.
34d078e0d2SEd Tanous
35*9746aeb8SBrad Bishop## Meta layers should not patch Yocto recipes and projects
36d078e0d2SEd Tanous
37*9746aeb8SBrad Bishop**Why?**
38*9746aeb8SBrad Bishop
39d078e0d2SEd TanousYocto itself is an open source project that accepts contributions.  The more
40d078e0d2SEd Tanouschanges that OpenBMC stacks against Yocto recipes, the more unmaintainable it
41d078e0d2SEd Tanousbecomes, and the longer it takes to rebase to new Yocto versions.  In general,
42d078e0d2SEd Tanousthe Yocto community is as responsive (sometimes much faster) than the OpenBMC
43d078e0d2SEd Tanouscommunity in regards to pull requests.
44d078e0d2SEd Tanous
45*9746aeb8SBrad Bishop**What should I do instead?**
46*9746aeb8SBrad Bishop
47d078e0d2SEd TanousSubmit any changes needed to the Yocto upstream repositories, using their
48d078e0d2SEd Tanousprocess.  If the Yocto process has gone several weeks without responses,
49d078e0d2SEd Tanouscherry-pick the commit into the OpenBMC tree, with a pointer to the review in
50d078e0d2SEd Tanousthe commit message.
51d078e0d2SEd Tanous
52*9746aeb8SBrad Bishop## Meta layers should avoid using EXTRA_OEMAKE and EXTRA_OEMESON
53d078e0d2SEd Tanous
54*9746aeb8SBrad Bishop**Why?**
55*9746aeb8SBrad Bishop
56d078e0d2SEd TanousThere are some OpenBMC projects that are utilized outside of OpenBMC.  As such,
57d078e0d2SEd Tanousthere are configuration items that are not intended to be used in OpenBMC, or
58d078e0d2SEd Tanousconfiguration items that would pose a security risk.  Also, as options change
59d078e0d2SEd Tanousand are deprecated, the project needs a single place to update the available
60d078e0d2SEd Tanousconfig items and dependencies.
61*9746aeb8SBrad Bishop
62d078e0d2SEd TanousIn addition, subprojects might change their build tooling, for example from
63d078e0d2SEd Tanousautotools to meson, in pursuit of other goals.  Having tool-specific
64d078e0d2SEd Tanousconfigurations makes that change far more difficult to do.
65d078e0d2SEd Tanous
66*9746aeb8SBrad Bishop**What should I do instead?**
67*9746aeb8SBrad Bishop
68d078e0d2SEd TanousIn the root recipe, add a PACKAGECONFIG entry for the feature in question, then
69d078e0d2SEd Tanoususe that to enable said feature in your meta layer.
70d078e0d2SEd Tanous
71*9746aeb8SBrad Bishop## Meta layers should not have recipes that point to proprietary licensed code
72d078e0d2SEd Tanous
73*9746aeb8SBrad Bishop**Why?**
74*9746aeb8SBrad Bishop
75d078e0d2SEd TanousOpenBMC is an open source project, and is intended to be built from source, with
76d078e0d2SEd Tanousappropriate distribution licenses such that it can be reused.  Pointing to
77d078e0d2SEd Tanouscommercially licensed repositories actively opposes that goal.
78d078e0d2SEd Tanous
79*9746aeb8SBrad Bishop**What should I do instead?**
80*9746aeb8SBrad Bishop
81d078e0d2SEd TanousFind an equivalent open source project that meets the needs, or request that the
82d078e0d2SEd Tanousproject owner relicenses their project.
83d078e0d2SEd Tanous
84*9746aeb8SBrad Bishop## Meta layer recipes should only point to well maintained open source projects
85d078e0d2SEd Tanous
86*9746aeb8SBrad Bishop**Why?**
87*9746aeb8SBrad Bishop
88d078e0d2SEd TanousWithout this guideline, a loophole is present that allows OpenBMC developers to
89d078e0d2SEd Tanousbypass code review by pointing the upstream recipe to a public repository that
90d078e0d2SEd Tanousthey control, but which OpenBMC has no input on the content of.  This splits the
91d078e0d2SEd Tanousdiscussion forums in unproductive ways, and prevents all the other good
92d078e0d2SEd Tanousprocesses within OpenBMC like bug tracking and continuous integration from
93d078e0d2SEd Tanoushaving an effect.
94d078e0d2SEd Tanous
95*9746aeb8SBrad Bishop**What should I do instead?**
96*9746aeb8SBrad Bishop
97d078e0d2SEd TanousThe advice tends to be on a case by case basis, but if the code is only intended
98d078e0d2SEd Tanousfor use on OpenBMC, then push a design doc, and push the code to openbmc gerrit
99d078e0d2SEd Tanousunder the openbmc/openbmc repository where it can be reviewed, along with an
100d078e0d2SEd TanousOWNERS file, signaling your willingness to maintain this project.  Then, once
101d078e0d2SEd Tanousthe community has looked through your design, a repo will be created for code to
102d078e0d2SEd Tanousbe pushed to.  If you're pulling in code from a dead project, inquire to the
103d078e0d2SEd Tanouscommunity through the mailing list or discord whether or not the OpenBMC
104d078e0d2SEd Tanouscommunity would be willing to adopt support and maintenance of said project.
105d078e0d2SEd Tanous
106*9746aeb8SBrad Bishop## Don't use SRCREV="${AUTOREV}" in a recipe
107d078e0d2SEd Tanous
108*9746aeb8SBrad Bishop**Why?**
109*9746aeb8SBrad Bishop
110d078e0d2SEd TanousRepository branches can change at any time.  Pointing to an autorev revision
111d078e0d2SEd Tanousincreases the likelihood that builds break, and makes builds far less
112d078e0d2SEd Tanousreproducible.
113*9746aeb8SBrad Bishop
114d078e0d2SEd TanousIn addition, having an accounting of exactly what is in your build prevents
115d078e0d2SEd Tanouserrors when a repo is quietly updated while working, and suddenly changes
116d078e0d2SEd Tanoussignificantly.
117d078e0d2SEd Tanous
118*9746aeb8SBrad Bishop**What should I do instead?**
119*9746aeb8SBrad Bishop
120d078e0d2SEd TanousPoint SRCREV to a specific commit of the repository, and increase the revision
121d078e0d2SEd Tanouseither via the autobump script in CI, which can be requested on the mailing
122d078e0d2SEd Tanouslist, or manually as new revisions exist.
123