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 50*c9fb5ea7SEd Tanousthe commit message, and documentation. The patch commit message should follow 51*c9fb5ea7SEd Tanousthe Yocto requirements for patch comments, including a statement of the patch 52*c9fb5ea7SEd Tanousupstream status. 53*c9fb5ea7SEd Tanous[yocto patch requirements](https://wiki.yoctoproject.org/wiki/Best_Known_Methods_%28BKMs%29_for_Package_Updating#Patch_Comments) 54d078e0d2SEd Tanous 559746aeb8SBrad Bishop## Meta layers should avoid using EXTRA_OEMAKE and EXTRA_OEMESON 56d078e0d2SEd Tanous 579746aeb8SBrad Bishop**Why?** 589746aeb8SBrad Bishop 59d078e0d2SEd TanousThere are some OpenBMC projects that are utilized outside of OpenBMC. As such, 60d078e0d2SEd Tanousthere are configuration items that are not intended to be used in OpenBMC, or 61d078e0d2SEd Tanousconfiguration items that would pose a security risk. Also, as options change 62d078e0d2SEd Tanousand are deprecated, the project needs a single place to update the available 63d078e0d2SEd Tanousconfig items and dependencies. 649746aeb8SBrad Bishop 65d078e0d2SEd TanousIn addition, subprojects might change their build tooling, for example from 66d078e0d2SEd Tanousautotools to meson, in pursuit of other goals. Having tool-specific 67d078e0d2SEd Tanousconfigurations makes that change far more difficult to do. 68d078e0d2SEd Tanous 699746aeb8SBrad Bishop**What should I do instead?** 709746aeb8SBrad Bishop 71d078e0d2SEd TanousIn the root recipe, add a PACKAGECONFIG entry for the feature in question, then 72d078e0d2SEd Tanoususe that to enable said feature in your meta layer. 73d078e0d2SEd Tanous 749746aeb8SBrad Bishop## Meta layers should not have recipes that point to proprietary licensed code 75d078e0d2SEd Tanous 769746aeb8SBrad Bishop**Why?** 779746aeb8SBrad Bishop 78d078e0d2SEd TanousOpenBMC is an open source project, and is intended to be built from source, with 79d078e0d2SEd Tanousappropriate distribution licenses such that it can be reused. Pointing to 80d078e0d2SEd Tanouscommercially licensed repositories actively opposes that goal. 81d078e0d2SEd Tanous 829746aeb8SBrad Bishop**What should I do instead?** 839746aeb8SBrad Bishop 84d078e0d2SEd TanousFind an equivalent open source project that meets the needs, or request that the 85d078e0d2SEd Tanousproject owner relicenses their project. 86d078e0d2SEd Tanous 879746aeb8SBrad Bishop## Meta layer recipes should only point to well maintained open source projects 88d078e0d2SEd Tanous 899746aeb8SBrad Bishop**Why?** 909746aeb8SBrad Bishop 91d078e0d2SEd TanousWithout this guideline, a loophole is present that allows OpenBMC developers to 92d078e0d2SEd Tanousbypass code review by pointing the upstream recipe to a public repository that 93d078e0d2SEd Tanousthey control, but which OpenBMC has no input on the content of. This splits the 94d078e0d2SEd Tanousdiscussion forums in unproductive ways, and prevents all the other good 95d078e0d2SEd Tanousprocesses within OpenBMC like bug tracking and continuous integration from 96d078e0d2SEd Tanoushaving an effect. 97d078e0d2SEd Tanous 989746aeb8SBrad Bishop**What should I do instead?** 999746aeb8SBrad Bishop 100d078e0d2SEd TanousThe advice tends to be on a case by case basis, but if the code is only intended 101d078e0d2SEd Tanousfor use on OpenBMC, then push a design doc, and push the code to openbmc gerrit 102d078e0d2SEd Tanousunder the openbmc/openbmc repository where it can be reviewed, along with an 103d078e0d2SEd TanousOWNERS file, signaling your willingness to maintain this project. Then, once 104d078e0d2SEd Tanousthe community has looked through your design, a repo will be created for code to 105d078e0d2SEd Tanousbe pushed to. If you're pulling in code from a dead project, inquire to the 106d078e0d2SEd Tanouscommunity through the mailing list or discord whether or not the OpenBMC 107d078e0d2SEd Tanouscommunity would be willing to adopt support and maintenance of said project. 108d078e0d2SEd Tanous 109d3b3bf70SEd Tanous## Meta layers should not point to OpenBMC specific repositories outside of 110d3b3bf70SEd Tanous https://github.com/openbmc 111d3b3bf70SEd Tanous 112d3b3bf70SEd Tanous**What defines an OpenBMC specific repository?** 113d3b3bf70SEd Tanous 114d3b3bf70SEd TanousGenerally an OpenBMC specific repository is something that does any of the 115d3b3bf70SEd Tanousfollowing: 116d3b3bf70SEd Tanous* Relies on or implements on OpenBMC defined Dbus interfaces. 117d3b3bf70SEd Tanous* Is not designed with configurability to be used outside of OpenBMC 118d3b3bf70SEd Tanous* Relies on OpenBMC specific layouts, configuration information to accomplish 119d3b3bf70SEd Tanous its primary function. 120d3b3bf70SEd Tanous 121d3b3bf70SEd Tanous**Why?** 122d3b3bf70SEd Tanous 123d3b3bf70SEd TanousOpenBMC as a codebase needs to remain buildable in the long term. Companies, 124d3b3bf70SEd Tanousmaintainers, and contributors come and go over the course of the project. 125d3b3bf70SEd TanousKeeping all long-term-supported code in the OpenBMC github ensures that the 126d3b3bf70SEd Tanousproject will remain useful. In addition, having significant portions of 127d3b3bf70SEd TanousOpenBMC-specific code outside of github limits the ability of the project to 128d3b3bf70SEd Tanousdo refactoring that might be necessary to keep up with the latest best 129d3b3bf70SEd Tanouspractices, Yocto updates, and package revisions, as there isn't always a clear 130d3b3bf70SEd Tanouspath to getting patches accepted when repositories are not within the OpenBMC 131d3b3bf70SEd Tanousgithub project 132d3b3bf70SEd Tanous 133d3b3bf70SEd Tanous**What should I do instead?** 134d3b3bf70SEd Tanous 135d3b3bf70SEd TanousDiscuss the code you'd like to write with the community using the mailing list 136d3b3bf70SEd Tanousand/or discord. If the design would require a new repository, request one using 137d3b3bf70SEd Tanousthe OpenBMC technical oversight committee process. 138d3b3bf70SEd Tanous 1399746aeb8SBrad Bishop## Don't use SRCREV="${AUTOREV}" in a recipe 140d078e0d2SEd Tanous 1419746aeb8SBrad Bishop**Why?** 1429746aeb8SBrad Bishop 143d078e0d2SEd TanousRepository branches can change at any time. Pointing to an autorev revision 144d078e0d2SEd Tanousincreases the likelihood that builds break, and makes builds far less 145d078e0d2SEd Tanousreproducible. 1469746aeb8SBrad Bishop 147d078e0d2SEd TanousIn addition, having an accounting of exactly what is in your build prevents 148d078e0d2SEd Tanouserrors when a repo is quietly updated while working, and suddenly changes 149d078e0d2SEd Tanoussignificantly. 150d078e0d2SEd Tanous 1519746aeb8SBrad Bishop**What should I do instead?** 1529746aeb8SBrad Bishop 153d078e0d2SEd TanousPoint SRCREV to a specific commit of the repository, and increase the revision 154d078e0d2SEd Tanouseither via the autobump script in CI, which can be requested on the mailing 155d078e0d2SEd Tanouslist, or manually as new revisions exist. 156