xref: /openbmc/docs/meta-layer-guidelines.md (revision d3b3bf70)
19746aeb8SBrad 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
109746aeb8SBrad Bishop## Meta layers should not patch projects that exist within the openBMC tree
11d078e0d2SEd Tanous
129746aeb8SBrad Bishop**Why?**
139746aeb8SBrad 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.
189746aeb8SBrad 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
259746aeb8SBrad Bishop**What should I do instead?**
269746aeb8SBrad 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
359746aeb8SBrad Bishop## Meta layers should not patch Yocto recipes and projects
36d078e0d2SEd Tanous
379746aeb8SBrad Bishop**Why?**
389746aeb8SBrad 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
459746aeb8SBrad Bishop**What should I do instead?**
469746aeb8SBrad 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
529746aeb8SBrad Bishop## Meta layers should avoid using EXTRA_OEMAKE and EXTRA_OEMESON
53d078e0d2SEd Tanous
549746aeb8SBrad Bishop**Why?**
559746aeb8SBrad 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.
619746aeb8SBrad 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
669746aeb8SBrad Bishop**What should I do instead?**
679746aeb8SBrad 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
719746aeb8SBrad Bishop## Meta layers should not have recipes that point to proprietary licensed code
72d078e0d2SEd Tanous
739746aeb8SBrad Bishop**Why?**
749746aeb8SBrad 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
799746aeb8SBrad Bishop**What should I do instead?**
809746aeb8SBrad Bishop
81d078e0d2SEd TanousFind an equivalent open source project that meets the needs, or request that the
82d078e0d2SEd Tanousproject owner relicenses their project.
83d078e0d2SEd Tanous
849746aeb8SBrad Bishop## Meta layer recipes should only point to well maintained open source projects
85d078e0d2SEd Tanous
869746aeb8SBrad Bishop**Why?**
879746aeb8SBrad 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
959746aeb8SBrad Bishop**What should I do instead?**
969746aeb8SBrad 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*d3b3bf70SEd Tanous## Meta layers should not point to OpenBMC specific repositories outside of
107*d3b3bf70SEd Tanous   https://github.com/openbmc
108*d3b3bf70SEd Tanous
109*d3b3bf70SEd Tanous**What defines an OpenBMC specific repository?**
110*d3b3bf70SEd Tanous
111*d3b3bf70SEd TanousGenerally an OpenBMC specific repository is something that does any of the
112*d3b3bf70SEd Tanousfollowing:
113*d3b3bf70SEd Tanous* Relies on or implements on OpenBMC defined Dbus interfaces.
114*d3b3bf70SEd Tanous* Is not designed with configurability to be used outside of OpenBMC
115*d3b3bf70SEd Tanous* Relies on OpenBMC specific layouts, configuration information to accomplish
116*d3b3bf70SEd Tanous  its primary function.
117*d3b3bf70SEd Tanous
118*d3b3bf70SEd Tanous**Why?**
119*d3b3bf70SEd Tanous
120*d3b3bf70SEd TanousOpenBMC as a codebase needs to remain buildable in the long term.  Companies,
121*d3b3bf70SEd Tanousmaintainers, and contributors come and go over the course of the project.
122*d3b3bf70SEd TanousKeeping all long-term-supported code in the OpenBMC github ensures that the
123*d3b3bf70SEd Tanousproject will remain useful.  In addition, having significant portions of
124*d3b3bf70SEd TanousOpenBMC-specific code outside of github limits the ability of the project to
125*d3b3bf70SEd Tanousdo refactoring that might be necessary to keep up with the latest best
126*d3b3bf70SEd Tanouspractices, Yocto updates, and package revisions, as there isn't always a clear
127*d3b3bf70SEd Tanouspath to getting patches accepted when repositories are not within the OpenBMC
128*d3b3bf70SEd Tanousgithub project
129*d3b3bf70SEd Tanous
130*d3b3bf70SEd Tanous**What should I do instead?**
131*d3b3bf70SEd Tanous
132*d3b3bf70SEd TanousDiscuss the code you'd like to write with the community using the mailing list
133*d3b3bf70SEd Tanousand/or discord.  If the design would require a new repository, request one using
134*d3b3bf70SEd Tanousthe OpenBMC technical oversight committee process.
135*d3b3bf70SEd Tanous
1369746aeb8SBrad Bishop## Don't use SRCREV="${AUTOREV}" in a recipe
137d078e0d2SEd Tanous
1389746aeb8SBrad Bishop**Why?**
1399746aeb8SBrad Bishop
140d078e0d2SEd TanousRepository branches can change at any time.  Pointing to an autorev revision
141d078e0d2SEd Tanousincreases the likelihood that builds break, and makes builds far less
142d078e0d2SEd Tanousreproducible.
1439746aeb8SBrad Bishop
144d078e0d2SEd TanousIn addition, having an accounting of exactly what is in your build prevents
145d078e0d2SEd Tanouserrors when a repo is quietly updated while working, and suddenly changes
146d078e0d2SEd Tanoussignificantly.
147d078e0d2SEd Tanous
1489746aeb8SBrad Bishop**What should I do instead?**
1499746aeb8SBrad Bishop
150d078e0d2SEd TanousPoint SRCREV to a specific commit of the repository, and increase the revision
151d078e0d2SEd Tanouseither via the autobump script in CI, which can be requested on the mailing
152d078e0d2SEd Tanouslist, or manually as new revisions exist.
153