summaryrefslogtreecommitdiffstats
path: root/documentation/contributor-guide/submit-change.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/contributor-guide/submit-change.rst')
-rw-r--r--documentation/contributor-guide/submit-change.rst463
1 files changed, 463 insertions, 0 deletions
diff --git a/documentation/contributor-guide/submit-change.rst b/documentation/contributor-guide/submit-change.rst
new file mode 100644
index 0000000000..ba56e5986d
--- /dev/null
+++ b/documentation/contributor-guide/submit-change.rst
@@ -0,0 +1,463 @@
1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
3Contributing a Change to a Component
4************************************
5
6Contributions to the Yocto Project and OpenEmbedded are very welcome.
7Because the system is extremely configurable and flexible, we recognize
8that developers will want to extend, configure or optimize it for their
9specific uses.
10
11Finding a Suitable Mailing List
12===============================
13
14The Yocto Project uses a mailing list and a patch-based workflow that is
15similar to the Linux kernel but contains important differences. In
16general, there is a mailing list through which you can submit patches. You
17should send patches to the appropriate mailing list so that they can be
18reviewed and merged by the appropriate maintainer. The specific mailing
19list you need to use depends on the location of the code you are
20changing. Each component (e.g. layer) should have a ``README`` file that
21indicates where to send the changes and which process to follow.
22
23You can send the patch to the mailing list using whichever approach you
24feel comfortable with to generate the patch. Once sent, the patch is
25usually reviewed by the community at large. If somebody has concerns
26with the patch, they will usually voice their concern over the mailing
27list. If a patch does not receive any negative reviews, the maintainer
28of the affected layer typically takes the patch, tests it, and then
29based on successful testing, merges the patch.
30
31The "poky" repository, which is the Yocto Project's reference build
32environment, is a hybrid repository that contains several individual
33pieces (e.g. BitBake, Metadata, documentation, and so forth) built using
34the combo-layer tool. The upstream location used for submitting changes
35varies by component:
36
37- *Core Metadata:* Send your patch to the
38 :oe_lists:`openembedded-core </g/openembedded-core>`
39 mailing list. For example, a change to anything under the ``meta`` or
40 ``scripts`` directories should be sent to this mailing list.
41
42- *BitBake:* For changes to BitBake (i.e. anything under the
43 ``bitbake`` directory), send your patch to the
44 :oe_lists:`bitbake-devel </g/bitbake-devel>`
45 mailing list.
46
47- *"meta-\*" trees:* These trees contain Metadata. Use the
48 :yocto_lists:`poky </g/poky>` mailing list.
49
50- *Documentation*: For changes to the Yocto Project documentation, use the
51 :yocto_lists:`docs </g/docs>` mailing list.
52
53For changes to other layers hosted in the Yocto Project source
54repositories (i.e. ``yoctoproject.org``) and tools use the
55:yocto_lists:`Yocto Project </g/yocto/>` general mailing list.
56
57.. note::
58
59 Sometimes a layer's documentation specifies to use a particular
60 mailing list. If so, use that list.
61
62For additional recipes that do not fit into the core Metadata, you
63should determine which layer the recipe should go into and submit the
64change in the manner recommended by the documentation (e.g. the
65``README`` file) supplied with the layer. If in doubt, please ask on the
66Yocto general mailing list or on the openembedded-devel mailing list.
67
68You can also push a change upstream and request a maintainer to pull the
69change into the component's upstream repository. You do this by pushing
70to a contribution repository that is upstream. See the
71":ref:`overview-manual/development-environment:git workflows and the yocto project`"
72section in the Yocto Project Overview and Concepts Manual for additional
73concepts on working in the Yocto Project development environment.
74
75Maintainers commonly use ``-next`` branches to test submissions prior to
76merging patches. Thus, you can get an idea of the status of a patch based on
77whether the patch has been merged into one of these branches. The commonly
78used testing branches for OpenEmbedded-Core are as follows:
79
80- *openembedded-core "master-next" branch:* This branch is part of the
81 :oe_git:`openembedded-core </openembedded-core/>` repository and contains
82 proposed changes to the core metadata.
83
84- *poky "master-next" branch:* This branch is part of the
85 :yocto_git:`poky </poky/>` repository and combines proposed
86 changes to BitBake, the core metadata and the poky distro.
87
88Similarly, stable branches maintained by the project may have corresponding
89``-next`` branches which collect proposed changes. For example,
90``&DISTRO_NAME_NO_CAP;-next`` and ``&DISTRO_NAME_NO_CAP_MINUS_ONE;-next``
91branches in both the "openembdedded-core" and "poky" repositories.
92
93Other layers may have similar testing branches but there is no formal
94requirement or standard for these so please check the documentation for the
95layers you are contributing to.
96
97The following sections provide procedures for submitting a change.
98
99Preparing Changes for Submission
100================================
101
102#. *Make Your Changes Locally:* Make your changes in your local Git
103 repository. You should make small, controlled, isolated changes.
104 Keeping changes small and isolated aids review, makes
105 merging/rebasing easier and keeps the change history clean should
106 anyone need to refer to it in future.
107
108#. *Stage Your Changes:* Stage your changes by using the ``git add``
109 command on each file you changed.
110
111#. *Commit Your Changes:* Commit the change by using the ``git commit``
112 command. Make sure your commit information follows standards by
113 following these accepted conventions:
114
115 - Be sure to include a "Signed-off-by:" line in the same style as
116 required by the Linux kernel. This can be done by using the
117 ``git commit -s`` command. Adding this line signifies that you,
118 the submitter, have agreed to the Developer's Certificate of
119 Origin 1.1 as follows:
120
121 .. code-block:: none
122
123 Developer's Certificate of Origin 1.1
124
125 By making a contribution to this project, I certify that:
126
127 (a) The contribution was created in whole or in part by me and I
128 have the right to submit it under the open source license
129 indicated in the file; or
130
131 (b) The contribution is based upon previous work that, to the best
132 of my knowledge, is covered under an appropriate open source
133 license and I have the right under that license to submit that
134 work with modifications, whether created in whole or in part
135 by me, under the same open source license (unless I am
136 permitted to submit under a different license), as indicated
137 in the file; or
138
139 (c) The contribution was provided directly to me by some other
140 person who certified (a), (b) or (c) and I have not modified
141 it.
142
143 (d) I understand and agree that this project and the contribution
144 are public and that a record of the contribution (including all
145 personal information I submit with it, including my sign-off) is
146 maintained indefinitely and may be redistributed consistent with
147 this project or the open source license(s) involved.
148
149 - Provide a single-line summary of the change and, if more
150 explanation is needed, provide more detail in the body of the
151 commit. This summary is typically viewable in the "shortlist" of
152 changes. Thus, providing something short and descriptive that
153 gives the reader a summary of the change is useful when viewing a
154 list of many commits. You should prefix this short description
155 with the recipe name (if changing a recipe), or else with the
156 short form path to the file being changed.
157
158 - For the body of the commit message, provide detailed information
159 that describes what you changed, why you made the change, and the
160 approach you used. It might also be helpful if you mention how you
161 tested the change. Provide as much detail as you can in the body
162 of the commit message.
163
164 .. note::
165
166 You do not need to provide a more detailed explanation of a
167 change if the change is minor to the point of the single line
168 summary providing all the information.
169
170 - If the change addresses a specific bug or issue that is associated
171 with a bug-tracking ID, include a reference to that ID in your
172 detailed description. For example, the Yocto Project uses a
173 specific convention for bug references --- any commit that addresses
174 a specific bug should use the following form for the detailed
175 description. Be sure to use the actual bug-tracking ID from
176 Bugzilla for bug-id::
177
178 Fixes [YOCTO #bug-id]
179
180 detailed description of change
181
182Using Email to Submit a Patch
183=============================
184
185Depending on the components changed, you need to submit the email to a
186specific mailing list. For some guidance on which mailing list to use,
187see the ":ref:`contributor-guide/submit-change:finding a suitable mailing list`"
188section above. For a description of all the available
189mailing lists, see the ":ref:`Mailing Lists <resources-mailinglist>`" section in the
190Yocto Project Reference Manual.
191
192Here is the general procedure on how to submit a patch through email
193without using the scripts once the steps in
194":ref:`contributor-guide/submit-change:preparing changes for submission`"
195have been followed:
196
197#. *Format the Commit:* Format the commit into an email message. To
198 format commits, use the ``git format-patch`` command. When you
199 provide the command, you must include a revision list or a number of
200 patches as part of the command. For example, either of these two
201 commands takes your most recent single commit and formats it as an
202 email message in the current directory::
203
204 $ git format-patch -1
205
206 or ::
207
208 $ git format-patch HEAD~
209
210 After the command is run, the current directory contains a numbered
211 ``.patch`` file for the commit.
212
213 If you provide several commits as part of the command, the
214 ``git format-patch`` command produces a series of numbered files in
215 the current directory – one for each commit. If you have more than
216 one patch, you should also use the ``--cover`` option with the
217 command, which generates a cover letter as the first "patch" in the
218 series. You can then edit the cover letter to provide a description
219 for the series of patches. For information on the
220 ``git format-patch`` command, see ``GIT_FORMAT_PATCH(1)`` displayed
221 using the ``man git-format-patch`` command.
222
223 .. note::
224
225 If you are or will be a frequent contributor to the Yocto Project
226 or to OpenEmbedded, you might consider requesting a contrib area
227 and the necessary associated rights.
228
229#. *Send the patches via email:* Send the patches to the recipients and
230 relevant mailing lists by using the ``git send-email`` command.
231
232 .. note::
233
234 In order to use ``git send-email``, you must have the proper Git packages
235 installed on your host.
236 For Ubuntu, Debian, and Fedora the package is ``git-email``.
237
238 The ``git send-email`` command sends email by using a local or remote
239 Mail Transport Agent (MTA) such as ``msmtp``, ``sendmail``, or
240 through a direct ``smtp`` configuration in your Git ``~/.gitconfig``
241 file. If you are submitting patches through email only, it is very
242 important that you submit them without any whitespace or HTML
243 formatting that either you or your mailer introduces. The maintainer
244 that receives your patches needs to be able to save and apply them
245 directly from your emails. A good way to verify that what you are
246 sending will be applicable by the maintainer is to do a dry run and
247 send them to yourself and then save and apply them as the maintainer
248 would.
249
250 The ``git send-email`` command is the preferred method for sending
251 your patches using email since there is no risk of compromising
252 whitespace in the body of the message, which can occur when you use
253 your own mail client. The command also has several options that let
254 you specify recipients and perform further editing of the email
255 message. For information on how to use the ``git send-email``
256 command, see ``GIT-SEND-EMAIL(1)`` displayed using the
257 ``man git-send-email`` command.
258
259The Yocto Project uses a `Patchwork instance <https://patchwork.yoctoproject.org/>`__
260to track the status of patches submitted to the various mailing lists and to
261support automated patch testing. Each submitted patch is checked for common
262mistakes and deviations from the expected patch format and submitters are
263notified by patchtest if such mistakes are found. This process helps to
264reduce the burden of patch review on maintainers.
265
266.. note::
267
268 This system is imperfect and changes can sometimes get lost in the flow.
269 Asking about the status of a patch or change is reasonable if the change
270 has been idle for a while with no feedback.
271
272Using Scripts to Push a Change Upstream and Request a Pull
273==========================================================
274
275For larger patch series it is preferable to send a pull request which not
276only includes the patch but also a pointer to a branch that can be pulled
277from. This involves making a local branch for your changes, pushing this
278branch to an accessible repository and then using the ``create-pull-request``
279and ``send-pull-request`` scripts from openembedded-core to create and send a
280patch series with a link to the branch for review.
281
282Follow this procedure to push a change to an upstream "contrib" Git
283repository once the steps in
284":ref:`contributor-guide/submit-change:preparing changes for submission`"
285have been followed:
286
287.. note::
288
289 You can find general Git information on how to push a change upstream
290 in the
291 `Git Community Book <https://git-scm.com/book/en/v2/Distributed-Git-Distributed-Workflows>`__.
292
293#. *Push Your Commits to a "Contrib" Upstream:* If you have arranged for
294 permissions to push to an upstream contrib repository, push the
295 change to that repository::
296
297 $ git push upstream_remote_repo local_branch_name
298
299 For example, suppose you have permissions to push
300 into the upstream ``meta-intel-contrib`` repository and you are
301 working in a local branch named `your_name`\ ``/README``. The following
302 command pushes your local commits to the ``meta-intel-contrib``
303 upstream repository and puts the commit in a branch named
304 `your_name`\ ``/README``::
305
306 $ git push meta-intel-contrib your_name/README
307
308#. *Determine Who to Notify:* Determine the maintainer or the mailing
309 list that you need to notify for the change.
310
311 Before submitting any change, you need to be sure who the maintainer
312 is or what mailing list that you need to notify. Use either these
313 methods to find out:
314
315 - *Maintenance File:* Examine the ``maintainers.inc`` file, which is
316 located in the :term:`Source Directory` at
317 ``meta/conf/distro/include``, to see who is responsible for code.
318
319 - *Search by File:* Using :ref:`overview-manual/development-environment:git`, you can
320 enter the following command to bring up a short list of all
321 commits against a specific file::
322
323 git shortlog -- filename
324
325 Just provide the name of the file for which you are interested. The
326 information returned is not ordered by history but does include a
327 list of everyone who has committed grouped by name. From the list,
328 you can see who is responsible for the bulk of the changes against
329 the file.
330
331 - *Examine the List of Mailing Lists:* For a list of the Yocto
332 Project and related mailing lists, see the ":ref:`Mailing
333 lists <resources-mailinglist>`" section in
334 the Yocto Project Reference Manual.
335
336#. *Make a Pull Request:* Notify the maintainer or the mailing list that
337 you have pushed a change by making a pull request.
338
339 The Yocto Project provides two scripts that conveniently let you
340 generate and send pull requests to the Yocto Project. These scripts
341 are ``create-pull-request`` and ``send-pull-request``. You can find
342 these scripts in the ``scripts`` directory within the
343 :term:`Source Directory` (e.g.
344 ``poky/scripts``).
345
346 Using these scripts correctly formats the requests without
347 introducing any whitespace or HTML formatting. The maintainer that
348 receives your patches either directly or through the mailing list
349 needs to be able to save and apply them directly from your emails.
350 Using these scripts is the preferred method for sending patches.
351
352 First, create the pull request. For example, the following command
353 runs the script, specifies the upstream repository in the contrib
354 directory into which you pushed the change, and provides a subject
355 line in the created patch files::
356
357 $ poky/scripts/create-pull-request -u meta-intel-contrib -s "Updated Manual Section Reference in README"
358
359 Running this script forms ``*.patch`` files in a folder named
360 ``pull-``\ `PID` in the current directory. One of the patch files is a
361 cover letter.
362
363 Before running the ``send-pull-request`` script, you must edit the
364 cover letter patch to insert information about your change. After
365 editing the cover letter, send the pull request. For example, the
366 following command runs the script and specifies the patch directory
367 and email address. In this example, the email address is a mailing
368 list::
369
370 $ poky/scripts/send-pull-request -p ~/meta-intel/pull-10565 -t meta-intel@lists.yoctoproject.org
371
372 You need to follow the prompts as the script is interactive.
373
374 .. note::
375
376 For help on using these scripts, simply provide the ``-h``
377 argument as follows::
378
379 $ poky/scripts/create-pull-request -h
380 $ poky/scripts/send-pull-request -h
381
382Responding to Patch Review
383==========================
384
385You may get feedback on your submitted patches from other community members
386or from the automated patchtest service. If issues are identified in your
387patch then it is usually necessary to address these before the patch will be
388accepted into the project. In this case you should amend the patch according
389to the feedback and submit an updated version to the relevant mailing list,
390copying in the reviewers who provided feedback to the previous version of the
391patch.
392
393The patch should be amended using ``git commit --amend`` or perhaps ``git
394rebase`` for more expert git users. You should also modify the ``[PATCH]``
395tag in the email subject line when sending the revised patch to mark the new
396iteration as ``[PATCH v2]``, ``[PATCH v3]``, etc as appropriate. This can be
397done by passing the ``-v`` argument to ``git format-patch`` with a version
398number.
399
400Lastly please ensure that you also test your revised changes. In particular
401please don't just edit the patch file written out by ``git format-patch`` and
402resend it.
403
404Submitting Changes to Stable Release Branches
405=============================================
406
407The process for proposing changes to a Yocto Project stable branch differs
408from the steps described above. Changes to a stable branch must address
409identified bugs or CVEs and should be made carefully in order to avoid the
410risk of introducing new bugs or breaking backwards compatibility. Typically
411bug fixes must already be accepted into the master branch before they can be
412backported to a stable branch unless the bug in question does not affect the
413master branch or the fix on the master branch is unsuitable for backporting.
414
415The list of stable branches along with the status and maintainer for each
416branch can be obtained from the
417:yocto_wiki:`Releases wiki page </Releases>`.
418
419.. note::
420
421 Changes will not typically be accepted for branches which are marked as
422 End-Of-Life (EOL).
423
424With this in mind, the steps to submit a change for a stable branch are as
425follows:
426
427#. *Identify the bug or CVE to be fixed:* This information should be
428 collected so that it can be included in your submission.
429
430 See :ref:`dev-manual/vulnerabilities:checking for vulnerabilities`
431 for details about CVE tracking.
432
433#. *Check if the fix is already present in the master branch:* This will
434 result in the most straightforward path into the stable branch for the
435 fix.
436
437 #. *If the fix is present in the master branch --- submit a backport request
438 by email:* You should send an email to the relevant stable branch
439 maintainer and the mailing list with details of the bug or CVE to be
440 fixed, the commit hash on the master branch that fixes the issue and
441 the stable branches which you would like this fix to be backported to.
442
443 #. *If the fix is not present in the master branch --- submit the fix to the
444 master branch first:* This will ensure that the fix passes through the
445 project's usual patch review and test processes before being accepted.
446 It will also ensure that bugs are not left unresolved in the master
447 branch itself. Once the fix is accepted in the master branch a backport
448 request can be submitted as above.
449
450 #. *If the fix is unsuitable for the master branch --- submit a patch
451 directly for the stable branch:* This method should be considered as a
452 last resort. It is typically necessary when the master branch is using
453 a newer version of the software which includes an upstream fix for the
454 issue or when the issue has been fixed on the master branch in a way
455 that introduces backwards incompatible changes. In this case follow the
456 steps in ":ref:`contributor-guide/submit-change:preparing changes for submission`" and
457 ":ref:`contributor-guide/submit-change:using email to submit a patch`"
458 but modify the subject header of your patch
459 email to include the name of the stable branch which you are
460 targetting. This can be done using the ``--subject-prefix`` argument to
461 ``git format-patch``, for example to submit a patch to the dunfell
462 branch use
463 ``git format-patch --subject-prefix='&DISTRO_NAME_NO_CAP_MINUS_ONE;][PATCH' ...``.