You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
11 KiB

  1. # Contributing Guidelines
  2. Ref: <https://openwrt.org/docs/guide-developer/packages> for overall format and construction
  3. ## Basic guidelines
  4. All packages you commit or submit by pull-request should follow these simple
  5. guidelines:
  6. - Package a version which is still maintained by the upstream author and will
  7. be updated regularly with supported versions.
  8. - Have no dependencies outside the OpenWrt core packages or this repository
  9. feed.
  10. - Have been tested to compile with the correct includes and dependencies.
  11. Please also test with "Compile with full language support" found under
  12. "General Build Settings" set if language support is relevant to your package.
  13. - Best of all -- it works as expected!
  14. ## Package Sources (archives and repositories)
  15. - PKG_SOURCE should reference the smallest available archive. In order of
  16. preference: xz (most compressed), bzip2, gz and zip. As a last resort,
  17. downloads from source repositories can be used.
  18. - PKG_SOURCE_URL should link to an official release archive. Use of HTTPS&#x3A;
  19. is preferred. If a source archive is not available, a locally generated
  20. archive fetched using git, svn, cvs or in rare circumstances, hg or bzr.
  21. - Convenience macros for popular mirrors are defined. Using these macros will
  22. make your package downloads more robust by mapping to a list of possible
  23. source mirrors for archive availability.
  24. - @SF - Sourceforge (downloads.sourceforge.net) with 5 retries due to
  25. re-directs
  26. - @GITHUB - Github (raw.githubusercontent.com) with 5 retries due to
  27. re-directs
  28. - @GNU - 8 regional servers
  29. - @GNOME - 8 regional servers
  30. - @SAVANNAH - 8 regional servers
  31. - @APACHE - 8 regional servers
  32. - @KERNEL - Linux kernel archives & mirrors
  33. - Please _DO NOT_ use an archive which changes over time. A version labeled
  34. "latest" is not constant each download. Also, using the head of a branch will
  35. create unpredictable results which can be different each build.
  36. ### Makefile contents should contain
  37. - Provide an up-to-date Copyright notice or **none**. Copyright should not be
  38. assigned to OpenWrt unless you are explicitly requested by or working under
  39. contract to OpenWrt. Assigning a Copyright to yourself or organization you
  40. represent is acceptable.
  41. - A (PKG\_)MAINTAINER definition listing either yourself and/or another person
  42. responsible for this package (E.g.: PKG_MAINTAINER:= Joe D. Hacker
  43. `<jdh@jdhs-email-provider.org`>). Listing multiple maintainers is encouraged in
  44. order to keep the package active and up-to-date. Leaving this blank will also
  45. be accepted, however the review process may not be as quick as one with a
  46. maintainer.
  47. - A PKG_LICENSE tag declaring the main license of the package. (E.g.:
  48. PKG_LICENSE:=GPL-2.0-or-later) Please use SPDX identifiers if possible (see
  49. list at the bottom).
  50. - An optional PKG_LICENSE_FILES tag including the filenames of the
  51. license-files in the source-package. (E.g.: PKG_LICENSE_FILES:=COPYING)
  52. - PKG_RELEASE should be initially set to 1 or reset to 1 if the software
  53. version is changed. You should increment it if the package itself has
  54. changed. For example, modifying a support script, changing configure options
  55. like --disable_ or --enable\_ switches, or if you changed something in the
  56. package which causes the resulting binaries to be different. Changes like
  57. correcting md5sums, changing mirror URLs, adding a maintainer field or updating
  58. a comment or copyright year in a Makefile do not require a change to
  59. PKG_RELEASE.
  60. - Avoid reuse of PKG_NAME in call, define and eval lines to improve
  61. readability.
  62. ### Commits in your pull-requests should
  63. - Have a useful description prefixed with the package name (E.g.: "foopkg: Add
  64. libzot dependency")
  65. - Include Signed-off-by tag in the commit comments. See: [Sign your
  66. work](https://openwrt.org/submitting-patches#sign_your_work)
  67. ## Advice on pull requests
  68. Pull requests are the easiest way to contribute changes to git repos at Github.
  69. They are the preferred contribution method, as they offer a nice way for
  70. commenting and amending the proposed changes.
  71. - You need a local "fork" of the Github repo.
  72. - Use a "feature branch" for your changes. That separates the changes in the
  73. pull request from your other changes and makes it easy to edit/amend commits
  74. in the pull request. Workflow using "feature_x" as the example:
  75. - Update your local git fork to the tip (of the master, usually)
  76. - Create the feature branch with `git checkout -b feature_x`
  77. - Edit changes and commit them locally
  78. - Push them to your Github fork by `git push -u origin feature_x`. That
  79. creates the "feature_x" branch at your Github fork and sets it as the
  80. remote of this branch
  81. - When you now visit Github, you should see a proposal to create a pull
  82. request
  83. - If you later need to add new commits to the pull request, you can simply
  84. commit the changes to the local branch and then use `git push` to
  85. automatically update the pull request.
  86. - If you need to change something in the existing pull request (e.g. to add a
  87. missing signed-off-by line to the commit message), you can use `git push -f`
  88. to overwrite the original commits. That is easy and safe when using a feature
  89. branch. Example workflow:
  90. - Checkout the feature branch by `git checkout feature_x`
  91. - Edit changes and commit them locally. If you are just updating the commit
  92. message in the last commit, you can use `git commit --amend` to do that
  93. - If you added several new commits or made other changes that require
  94. cleaning up, you can use `git rebase -i HEAD~X` (X = number of commits to
  95. edit) to possibly squash some commits
  96. - Push the changed commits to Github with `git push -f` to overwrite the
  97. original commits in the "feature_x" branch with the new ones. The pull
  98. request gets automatically updated
  99. ## If you have commit access
  100. - Do NOT use git push --force.
  101. - Do NOT commit to other maintainer's packages without their consent.
  102. - Use Pull Requests if you are unsure and to suggest changes to other
  103. maintainers.
  104. ### Gaining commit access
  105. - We will gladly grant commit access to responsible contributors who have made
  106. useful pull requests and / or feedback or patches to this repository or
  107. OpenWrt in general. Please include your request for commit access in your next
  108. pull request or ticket.
  109. ## Release Branches
  110. - Old stable branches were named after the following pattern "for-XX.YY" (e.g.
  111. for-14.07) before the LEDE split. During the LEDE split there was only one
  112. release branch with the name "lede-17.01". After merging the LEDE fork with
  113. OpenWrt the release branches are named according to the following pattern
  114. "openwrt-XX.YY" (e.g. openwrt-18.06).
  115. - These branches are built with the respective OpenWrt release and are created
  116. during the release stabilisation phase.
  117. - Please ONLY cherry-pick or commit security and bug-fixes to these branches.
  118. - Do NOT add new packages and do NOT do major upgrades of packages here.
  119. - If you are unsure if your change is suitable, please use a pull request.
  120. ## Common LICENSE tags (short list)
  121. (Complete list can be found at: <https://spdx.org/licenses>)
  122. | Full Name | Identifier |
  123. | ------------------------------------------------ | :----------------------- |
  124. | Apache License 1.0 | Apache-1.0 |
  125. | Apache License 1.1 | Apache-1.1 |
  126. | Apache License 2.0 | Apache-2.0 |
  127. | Artistic License 1.0 | Artistic-1.0 |
  128. | Artistic License 1.0 w/clause 8 | Artistic-1.0-cl8 |
  129. | Artistic License 1.0 (Perl) | Artistic-1.0-Perl |
  130. | Artistic License 2.0 | Artistic-2.0 |
  131. | BSD 2-Clause "Simplified" License | BSD-2-Clause |
  132. | BSD 2-Clause FreeBSD License | BSD-2-Clause-FreeBSD |
  133. | BSD 2-Clause NetBSD License | BSD-2-Clause-NetBSD |
  134. | BSD 3-Clause "New" or "Revised" License | BSD-3-Clause |
  135. | BSD with attribution | BSD-3-Clause-Attribution |
  136. | BSD 3-Clause Clear License | BSD-3-Clause-Clear |
  137. | BSD 4-Clause "Original" or "Old" License | BSD-4-Clause |
  138. | BSD-4-Clause (University of California-Specific) | BSD-4-Clause-UC |
  139. | BSD Protection License | BSD-Protection |
  140. | GNU General Public License v1.0 only | GPL-1.0-only |
  141. | GNU General Public License v1.0 or later | GPL-1.0-or-later |
  142. | GNU General Public License v2.0 only | GPL-2.0-only |
  143. | GNU General Public License v2.0 or later | GPL-2.0-or-later |
  144. | GNU General Public License v3.0 only | GPL-3.0-only |
  145. | GNU General Public License v3.0 or later | GPL-3.0-or-later |
  146. | GNU Lesser General Public License v2.1 only | LGPL-2.1-only |
  147. | GNU Lesser General Public License v2.1 or later | LGPL-2.1-or-later |
  148. | GNU Lesser General Public License v3.0 only | LGPL-3.0-only |
  149. | GNU Lesser General Public License v3.0 or later | LGPL-3.0-or-later |
  150. | GNU Library General Public License v2 only | LGPL-2.0-only |
  151. | GNU Library General Public License v2 or later | LGPL-2.0-or-later |
  152. | Fair License | Fair |
  153. | ISC License | ISC |
  154. | MIT License | MIT |
  155. | No Limit Public License | NLPL |
  156. | OpenSSL License | OpenSSL |
  157. | X11 License | X11 |
  158. | zlib License | Zlib |
  159. ## Continuous Integration
  160. To simplify review and require less human resources, a CI tests all packages.
  161. Passing CI tests are not a hard requirement but a good indicator what the
  162. Buildbots will think about the proposed patch.
  163. The CI builds modified packages for multiple architectures using the latest
  164. snapshot SDK. For supported architectures (`aarch64_generic`,
  165. `arm_cortex-a15_neon-vfpv4`, `i386_pentium4` and `x86_64`) an additional
  166. runtime test is executed. A running OpenWrt is simulated which tries to install
  167. created packages and runs a script called `test.sh` located next to the package
  168. Makefile. The script is executed with the two arguments `PKG_NAME` and
  169. `PKG_VERSION`. The `PKG_NAME` can be used to distinguish package variants, e.g.
  170. `foobar` vs. `foobar-full`. The `PKG_VERSION` can be used for a trivial test
  171. checking if `foobar --version` prints the correct version. `PKG_VERSION` is the
  172. OpenWrt version and therefore includes the `PKG_RELEASE`, which isn't usually
  173. part of the running programs version.
  174. The following snippet show a script that tests different binaries, depending
  175. what IPK package was installed. The `gpsd` Makefile produces both a `gpsd` and
  176. a `gpsd-clients` IPK package.
  177. ```shell
  178. #!/bin/sh
  179. case "$1" in
  180. "gpsd")
  181. gpsd -V 2>&1 | grep "$2"
  182. ;;
  183. "gpsd-clients")
  184. cgps -V 2>&1 | grep "$2"
  185. ;;
  186. esac
  187. ```