1# OpenBMC meta layer guidelines 2 3While most of these could be called "rules", in specific scenarios might be 4actively against the intended goals. This is why each guideline has a very 5large "Why" section, to ensure that the intent is being met, and that if 6exceptions to the rules exist, then can be understood and managed by the 7project. In general, if there's a question, and the community agrees, these 8guidelines can be overridden on a case by case basis. 9 10## Meta layers should not patch projects that exist within the openBMC tree 11 12**Why?** 13 14In general, keeping the codebase building in the long term is difficult. 15Opening the possibility that patches exist that repo maintainers aren't aware 16of makes it much more likely that a single machine breaks, or we have behavior 17differences between two repos. 18 19Also, in general, the maintainer is there to ensure that the greater community, 20features, and codebase are prioritized over any one patch, and generally does so 21in code review. If patches are checked into meta layers, generally the 22maintainer is not a reviewer, thereby defeating most of the purpose of the role 23of the maintainer. 24 25**What should I do instead?** 26 27Discuss with the project maintainers and the community about whether or not the 28feature you're building needs to be configurable, or if it can be applied to all 29projects. If it can be applied to all, simply check it into the master branch 30through a gerrit review, and follow the processes outlined for the repository. 31If it needs to be per-project or per-machine configurable, check it in under a 32compile time option, at the suggestion of the maintainer, and add a 33PACKAGECONFIG entry that can be set to enable it. 34 35## Meta layers should not patch Yocto recipes and projects 36 37**Why?** 38 39Yocto itself is an open source project that accepts contributions. The more 40changes that OpenBMC stacks against Yocto recipes, the more unmaintainable it 41becomes, and the longer it takes to rebase to new Yocto versions. In general, 42the Yocto community is as responsive (sometimes much faster) than the OpenBMC 43community in regards to pull requests. 44 45**What should I do instead?** 46 47Submit any changes needed to the Yocto upstream repositories, using their 48process. If the Yocto process has gone several weeks without responses, 49cherry-pick the commit into the OpenBMC tree, with a pointer to the review in 50the commit message. 51 52## Meta layers should avoid using EXTRA_OEMAKE and EXTRA_OEMESON 53 54**Why?** 55 56There are some OpenBMC projects that are utilized outside of OpenBMC. As such, 57there are configuration items that are not intended to be used in OpenBMC, or 58configuration items that would pose a security risk. Also, as options change 59and are deprecated, the project needs a single place to update the available 60config items and dependencies. 61 62In addition, subprojects might change their build tooling, for example from 63autotools to meson, in pursuit of other goals. Having tool-specific 64configurations makes that change far more difficult to do. 65 66**What should I do instead?** 67 68In the root recipe, add a PACKAGECONFIG entry for the feature in question, then 69use that to enable said feature in your meta layer. 70 71## Meta layers should not have recipes that point to proprietary licensed code 72 73**Why?** 74 75OpenBMC is an open source project, and is intended to be built from source, with 76appropriate distribution licenses such that it can be reused. Pointing to 77commercially licensed repositories actively opposes that goal. 78 79**What should I do instead?** 80 81Find an equivalent open source project that meets the needs, or request that the 82project owner relicenses their project. 83 84## Meta layer recipes should only point to well maintained open source projects 85 86**Why?** 87 88Without this guideline, a loophole is present that allows OpenBMC developers to 89bypass code review by pointing the upstream recipe to a public repository that 90they control, but which OpenBMC has no input on the content of. This splits the 91discussion forums in unproductive ways, and prevents all the other good 92processes within OpenBMC like bug tracking and continuous integration from 93having an effect. 94 95**What should I do instead?** 96 97The advice tends to be on a case by case basis, but if the code is only intended 98for use on OpenBMC, then push a design doc, and push the code to openbmc gerrit 99under the openbmc/openbmc repository where it can be reviewed, along with an 100OWNERS file, signaling your willingness to maintain this project. Then, once 101the community has looked through your design, a repo will be created for code to 102be pushed to. If you're pulling in code from a dead project, inquire to the 103community through the mailing list or discord whether or not the OpenBMC 104community would be willing to adopt support and maintenance of said project. 105 106## Meta layers should not point to OpenBMC specific repositories outside of 107 https://github.com/openbmc 108 109**What defines an OpenBMC specific repository?** 110 111Generally an OpenBMC specific repository is something that does any of the 112following: 113* Relies on or implements on OpenBMC defined Dbus interfaces. 114* Is not designed with configurability to be used outside of OpenBMC 115* Relies on OpenBMC specific layouts, configuration information to accomplish 116 its primary function. 117 118**Why?** 119 120OpenBMC as a codebase needs to remain buildable in the long term. Companies, 121maintainers, and contributors come and go over the course of the project. 122Keeping all long-term-supported code in the OpenBMC github ensures that the 123project will remain useful. In addition, having significant portions of 124OpenBMC-specific code outside of github limits the ability of the project to 125do refactoring that might be necessary to keep up with the latest best 126practices, Yocto updates, and package revisions, as there isn't always a clear 127path to getting patches accepted when repositories are not within the OpenBMC 128github project 129 130**What should I do instead?** 131 132Discuss the code you'd like to write with the community using the mailing list 133and/or discord. If the design would require a new repository, request one using 134the OpenBMC technical oversight committee process. 135 136## Don't use SRCREV="${AUTOREV}" in a recipe 137 138**Why?** 139 140Repository branches can change at any time. Pointing to an autorev revision 141increases the likelihood that builds break, and makes builds far less 142reproducible. 143 144In addition, having an accounting of exactly what is in your build prevents 145errors when a repo is quietly updated while working, and suddenly changes 146significantly. 147 148**What should I do instead?** 149 150Point SRCREV to a specific commit of the repository, and increase the revision 151either via the autobump script in CI, which can be requested on the mailing 152list, or manually as new revisions exist. 153