Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| submitting-patches [2019/04/06 02:28] – [13. The canonical patch format] formatting vgaetera | submitting-patches [2024/06/17 08:59] – old revision restored (2024/01/03 07:44) svanheule | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Submitting patches ====== | ====== Submitting patches ====== | ||
| - | See also [[docs: | + | See also: |
| + | * [[docs: | ||
| + | * If you are using GitHub, read also [[docs: | ||
| - | If you are using GitHub read also [[docs: | + | =====Deciding where to send the patch===== |
| - | Patches can be submitted as a pull request on Github | + | * **Patches |
| + | |||
| + | * **Patches for LuCI web interface and related packages** can be submitted to mailing list or to the [[https:// | ||
| + | |||
| + | * **Patches for community packages about routing** should go as a Github PR in the [[https:// | ||
| + | |||
| + | * **Patches for community packages about telephony and SIP/VOIP** should go as a Github PR in the [[https:// | ||
| + | |||
| + | * **Patches for miscellaneous community packages** should go as a Github PR in the [[https:// | ||
| + | |||
| + | <WRAP round info 60%> | ||
| + | **If you want to add a new package that is not specific for a device** nor crucial to compile or use OpenWrt on a device, (i.e. tools, compilers, runtimes libraries, VPNs, media servers, backup servers and more), **open a PR in the appropriate community packages repository mentioned above.** Note that if you add a package you usually must assign yourself as " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Submission Guidelines ===== | ||
| Submissions should follow the following guidelines: | Submissions should follow the following guidelines: | ||
| - | * use a different git branch for each pull request (GitHub does this automatically | + | * use a different git branch for each pull request (GitHub does this automatically |
| * write commit subject and message in the imperative form: "add support for X", NOT "added support for X" | * write commit subject and message in the imperative form: "add support for X", NOT "added support for X" | ||
| * **code formatting** | * **code formatting** | ||
| Line 30: | Line 47: | ||
| * If you add support for new hardware: Include in your commit message a short description of the hardware and how to install OpenWrt on it. Have a look at the [[https:// | * If you add support for new hardware: Include in your commit message a short description of the hardware and how to install OpenWrt on it. Have a look at the [[https:// | ||
| - | * **all commits must contain '' | + | * **all commits must contain '' |
| - | * it can be done automatically by git commandline with: < | + | * GitHub web interface or GUI application for git: you must append the '' |
| + | * git command-line interface: | ||
| - | | + | <code bash> |
| - | * if you are editing files and committing through | + | git commit --signoff |
| - | * if you are editing files and committing on your local PC, set your name and email with< | + | </ |
| + | |||
| + | | ||
| + | * GitHub | ||
| + | * git command-line interface: | ||
| + | |||
| + | < | ||
| git config --global user.name "my name" | git config --global user.name "my name" | ||
| - | git config --global user.email " | + | git config --global user.email " |
| + | </ | ||
| ===== Patch merging and tree life cycle ===== | ===== Patch merging and tree life cycle ===== | ||
| Line 45: | Line 70: | ||
| - PRs can be sent to the patches mailing list from any source and will always be considered for inclusion if the quality of the tree is good and format of submission is correct | - PRs can be sent to the patches mailing list from any source and will always be considered for inclusion if the quality of the tree is good and format of submission is correct | ||
| - Staging trees can be hosted as part of the projects git infrastructure, | - Staging trees can be hosted as part of the projects git infrastructure, | ||
| + | ===== Patch backports ===== | ||
| + | Backporting refers to applying changes to a stable (release) branch like for example **openwrt-23.05** from the **main** branch. Since new features are not added to stable branches, backported changes are generally bug fixes and security fixes only. The process is roughly following: | ||
| + | - Changes needs to be first applied into the **main** branch | ||
| + | - Afterwards those changes can be proposed to be applied into the stable (release) branch | ||
| + | When pulling the commits from the **main** branch, you need to use '' | ||
| + | <code bash> | ||
| + | $ git cherry-pick --signoff -x < | ||
| + | </ | ||
| ===== Patch checklist ===== | ===== Patch checklist ===== | ||
| - Single commit ( multiple commits must first be squashed, as described [[docs: | - Single commit ( multiple commits must first be squashed, as described [[docs: | ||
| Line 63: | Line 95: | ||
| - Remove all ocurrencies of '' | - Remove all ocurrencies of '' | ||
| - If you're adding MTD flash layout, and you've '' | - If you're adding MTD flash layout, and you've '' | ||
| - | - If it's possible try to dedicate some of the LEDs for system status indication in [[https:// | + | - If it's possible try to dedicate some of the LEDs for system status indication in [[https:// |
| - The name of a node should reflect the function of the device and not its model. Examples for generic node names can be found in Section [[https:// | - The name of a node should reflect the function of the device and not its model. Examples for generic node names can be found in Section [[https:// | ||
| - Remove all [[https:// | - Remove all [[https:// | ||
| + | An overview of non-mandatory guidelines for device support submissions is provided in [[docs: | ||
| ===== In-depth process of preparing and submitting code to OpenWrt ===== | ===== In-depth process of preparing and submitting code to OpenWrt ===== | ||
| Based on [[https:// | Based on [[https:// | ||
| - | OpenWrt is constantly being improved. We'd like as many people to contribute to this as we can get. If you find a change useful, by all means try to get it incorporated into the project. This should improve OpenWrt and it should help carry your changes forward into future versions | + | OpenWrt is constantly being improved. We'd like as many people to contribute to this as we can get. If you find a change useful, by all means try to get it incorporated into the project. This should improve OpenWrt and it should help carry your changes forward into future versions. |
| For a person or company who wishes to submit a change to OpenWrt, the process can sometimes be daunting if you're not familiar with "the system." | For a person or company who wishes to submit a change to OpenWrt, the process can sometimes be daunting if you're not familiar with "the system." | ||
| - | |||
| - | This document tries to lay out a procedure to enable people to submit patches in a way that is most effective for all concerned. | ||
| It is important to do all these steps repeatedly: | It is important to do all these steps repeatedly: | ||
| - | listen | + | * Listen |
| - | talk explaining | + | * Explain |
| - | do write useful patches including documentation | + | * Write useful patches including documentation. |
| - | | + | * Test, test, test. |
| Where to listen and talk: | Where to listen and talk: | ||
| * Google to find things related to your problem | * Google to find things related to your problem | ||
| - | * Wiki: check this [[: | + | * [[: |
| - | * Mailing Lists | + | * [[: |
| - | * Forums like [[https:// | + | * [[: |
| - | * IRC irc.freenode.net, | + | * [[https:// |
| - | * TRAC https:// | + | * GitHub - https:// |
| - | * Github - http:// | + | * (archived) |
| ===== Documentation ===== | ===== Documentation ===== | ||
| It is often best to document what you are doing before you do it. The process of documentation often exposes possible improvements. Keep your documentation up to date. | It is often best to document what you are doing before you do it. The process of documentation often exposes possible improvements. Keep your documentation up to date. | ||
| - | ===== Creating and Sending | + | ===== Creating and sending |
| Read [[: | Read [[: | ||
| - | For patches against external package sources, refer to the quilt howto at [[docs: | + | For patches against external package sources, refer to the quilt howto at [[docs: |
| Please read [[https:// | Please read [[https:// | ||
| Line 106: | Line 137: | ||
| Patches should be based in the root trunk, not in any lower subdirectory. | Patches should be based in the root trunk, not in any lower subdirectory. | ||
| - | Make sure your patch does not include any extra files which do not belong in a patch submission. | + | Make sure your patch does not include any extra files which do not belong in a patch submission. |
| + | Be sure to review your patch **after** you have generated it, to ensure accuracy. | ||
| - | If your changes produce a lot of deltas, you may want to look into splitting them into individual patches which modify things in logical stages. This will facilitate easier reviewing by other OpenWrt developers, which is very important if you want your patch to be accepted. | + | If your changes produce a lot of deltas, you may want to look into splitting them into individual patches which modify things in logical stages. |
| + | This will facilitate easier reviewing by other OpenWrt developers, which is very important if you want your patch to be accepted. | ||
| The tools you can use to create a patch, in order of preference, are: | The tools you can use to create a patch, in order of preference, are: | ||
| Line 115: | Line 148: | ||
| * diff | * diff | ||
| - | To ease integration of smaller patches into trunk, developers can also make pull-requests into the Github | + | To ease integration of smaller patches into trunk, developers can also make pull-requests into the GitHub |
| + | Larger patches, or patches that require further discussion, should still be sent to the **openwrt-devel** list, where they' | ||
| ==== 2. Describe your changes ===== | ==== 2. Describe your changes ===== | ||
| Line 145: | Line 179: | ||
| ==== 5. Select email destination ===== | ==== 5. Select email destination ===== | ||
| - | Look in the Makefile if a MAINTAINER macro exists. If so, e-mail | + | Look in the Makefile if a MAINTAINER macro exists. If so, email that person. Unless you have a reason NOT to do so, always CC openwrt-devel <at> lists.openwrt.org. If no maintainer is listed, send your patch to the [[https:// |
| ==== 6. No MIME, no links, no compression, | ==== 6. No MIME, no links, no compression, | ||
| - | OpenWrt developers need to be able to read and comment on the changes you are submitting. It is important for an OpenWrt developer to be able to " | + | OpenWrt developers need to be able to read and comment on the changes you are submitting. It is important for an OpenWrt developer to be able to " |
| - | For this reason, all patches should be submitting | + | For this reason, all patches should be submitting |
| - | Do not attach the patch as a MIME attachment, compressed or not. Many popular | + | Do not attach the patch as a MIME attachment, compressed or not. Many popular |
| Exception: If your mailer is mangling patches then someone may ask you to re-send them using MIME. | Exception: If your mailer is mangling patches then someone may ask you to re-send them using MIME. | ||
| Mozilla Thunderbird requires that you change email defaults to send plain text email. | Mozilla Thunderbird requires that you change email defaults to send plain text email. | ||
| - | read [[http:// | + | read [[http:// |
| :!: disable flowed text | :!: disable flowed text | ||
| Line 163: | Line 197: | ||
| Large changes are not appropriate for mailing lists, and some maintainers. If your patch, uncompressed, | Large changes are not appropriate for mailing lists, and some maintainers. If your patch, uncompressed, | ||
| - | ==== 8. Don't get discouraged, re-submit ===== | + | ==== 8. Remain objective, re-submit ===== |
| + | |||
| + | It's nothing personal. Code should work well for its intended purpose and results should adhere to many standards and requirements, | ||
| After you have submitted your change, be patient and wait. If developers like your change and apply it, it will appear as new revision in the source code management system. | After you have submitted your change, be patient and wait. If developers like your change and apply it, it will appear as new revision in the source code management system. | ||
| Line 172: | Line 209: | ||
| * Your patch was not sufficiently discussed on openwrt-devel. | * Your patch was not sufficiently discussed on openwrt-devel. | ||
| * A style issue. | * A style issue. | ||
| - | * An e-mail | + | * An email formatting issue (re-read this section). |
| * A technical problem with your change. | * A technical problem with your change. | ||
| - | * They get tons of e-mail, and yours got lost in the shuffle. | + | * They get tons of email, and yours got lost in the shuffle. |
| * You are being annoying. | * You are being annoying. | ||
| Line 180: | Line 217: | ||
| ==== 9. Include PATCH in the subject ===== | ==== 9. Include PATCH in the subject ===== | ||
| - | Due to high e-mail | + | Due to high email traffic to openwrt-devel, |
| ==== 10. Sign your work ===== | ==== 10. Sign your work ===== | ||
| Line 217: | Line 254: | ||
| then you just add a line saying | then you just add a line saying | ||
| - | < | + | < |
| Signed-off-by: | Signed-off-by: | ||
| </ | </ | ||
| Line 223: | Line 260: | ||
| using your real name (no pseudonyms or anonymous contributions.) | using your real name (no pseudonyms or anonymous contributions.) | ||
| - | If you are a package or target maintainer, sometimes you need to slightly modify patches you receive in order to merge them, because the code is not exactly the same in your tree and the submitters' | + | If you are a package or target maintainer, sometimes you need to slightly modify patches you receive in order to merge them, because the code is not exactly the same in your tree and the submitters' |
| - | < | + | < |
| Signed-off-by: | Signed-off-by: | ||
| [lucky@maintainer.example.org: | [lucky@maintainer.example.org: | ||
| Line 235: | Line 272: | ||
| Special note to back-porters: | Special note to back-porters: | ||
| - | < | + | < |
| Date: Wed Jul 25 15:14:50 2012 +0300 | Date: Wed Jul 25 15:14:50 2012 +0300 | ||
| [generic] add missing symbols | [generic] add missing symbols | ||
| Line 244: | Line 281: | ||
| For the more convenient developers, git can automatically add a sign-off: | For the more convenient developers, git can automatically add a sign-off: | ||
| - | < | + | |
| + | < | ||
| + | git commit -s | ||
| + | </ | ||
| ==== 11. When to use " | ==== 11. When to use " | ||
| - | The Signed-off-by: | + | The Signed-off-by: |
| If a person was not directly involved in the preparation or handling of a patch but wishes to signify and record their approval of it then they can arrange to have an Acked-by: line added to the patch' | If a person was not directly involved in the preparation or handling of a patch but wishes to signify and record their approval of it then they can arrange to have an Acked-by: line added to the patch' | ||
| Line 295: | Line 335: | ||
| The canonical patch subject line is: | The canonical patch subject line is: | ||
| - | < | + | < |
| Subject: [PATCH 001/123] [section] summary phrase | Subject: [PATCH 001/123] [section] summary phrase | ||
| </ | </ | ||
| Line 324: | Line 364: | ||
| Some example Subjects: | Some example Subjects: | ||
| - | < | + | < |
| Subject: [PATCH] e2fsprogs: Bump to 1.41.3 | Subject: [PATCH] e2fsprogs: Bump to 1.41.3 | ||
| Line 334: | Line 374: | ||
| The " | The " | ||
| - | < | + | < |
| From: Original Author < | From: Original Author < | ||
| </ | </ | ||