|
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | +---- |
| 5 | + |
| 6 | +# Creator contributor guide. |
| 7 | + |
| 8 | + |
| 9 | +## Reporting issues and bugs. |
| 10 | + |
| 11 | +If you discover a bug, have a technical question for the development team, or find an issue or area that you feel needs improvement: |
| 12 | + |
| 13 | +* Navigate to the "Issues" tab on the project Github repository |
| 14 | + |
| 15 | +* Click the "New Issue" button. |
| 16 | + |
| 17 | + |
| 18 | +When making your report, be as clear and concise as possible. Use the following list as a guide: |
| 19 | + |
| 20 | +* Describe the issue, and why you believe it's a problem. |
| 21 | +* Include the project version or commit id. |
| 22 | +* Describe environment details (OS/distribution etc). |
| 23 | +* State how often the issue has occurred. |
| 24 | +* Describe the steps to take to uncover or reproduce the issue (if any). |
| 25 | +* Expected behaviour. |
| 26 | +* Actual behaviour. |
| 27 | +* Any additional information, log output etc. |
| 28 | + |
| 29 | + |
| 30 | +---- |
| 31 | + |
| 32 | + |
| 33 | +## Developer submissions. |
| 34 | + |
| 35 | +If you have a submission for a code change to resolve a bug, improve code implementation, or bring a new feature to the project you should create a Github Pull Request for your submission. |
| 36 | + |
| 37 | +### Create a Github account. |
| 38 | + |
| 39 | +Before you can contribute you require a Github account. |
| 40 | + |
| 41 | +You can sign up for a free account here: [https://github.com/](https://github.com/) |
| 42 | + |
| 43 | +### Add your ssh key to your Github account. |
| 44 | + |
| 45 | +If you are using a Linux development environment, you can normally find your public key in *~/.ssh/id_rsa.pub*. Alternatively you can generate a new key with the following command: |
| 46 | + |
| 47 | +``` |
| 48 | +ssh-keygen -t rsa -b 4096 -C "[email protected]" |
| 49 | +```` |
| 50 | +
|
| 51 | +When you're prompted to enter a file in which to save the key, press Enter to accept the default file location. |
| 52 | +
|
| 53 | +Now that you have a key: |
| 54 | +* Sign in to your Github account |
| 55 | +* Click the top right icon |
| 56 | +* Select *settings -> ssh keys -> new ssh key* |
| 57 | +* Paste the contents of your public key into the box. |
| 58 | +
|
| 59 | +Your public key should look something like: |
| 60 | +``` |
| 61 | +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOvXIAom7iVB/JmNFZrDNZVz+ta6vZoAvoyzjAR53 |
| 62 | +LwFyA82TDK4RkosKZHgEU/KT+AXYZ9983uVvzS/O7rxa1YxiL21ckw8Ymm4qRxjMP6Bvw8vsGXlLfq7 |
| 63 | +bNH2tmxIMxd/csIR246FxmCIddLcrIJ2JOTF3AXNRX8uw0FFeJuZTIkAF/PLDO4HhStY6AGxDzpgoZt |
| 64 | +480EdPXzNRqTPJ41iXmMZhsJ3I7HCNeZHmy4VFk0XWKXdvmYKm7nSHeqMZxA9LHRPbLnolJyuBp7qPJ |
| 65 | +yWC8xT48dS8PDmn5i/wYyXEBNS6uwsYfLZuPfPAKaSTzd1g1fphEw4/9rTZIqqUSMBR87IdDhVKffvf |
| 66 | +tQD4O0TTJAsVEzx6w2dx29lwKWrhuJ9ipSZyH+ujai+azW52b+RmcFOqXh7E79XvWfMF1NqiEDtlqFV |
| 67 | +gqnvYg+PkS4+sCyLE0qfMx301r9E6pSTj0SIsBz0PUHFhNUx3grg4eJ1FH8Zu9+JYaFjZeNEFSypxaS |
| 68 | +Z7J6coWx8hfBG6bpdnFsuL8JJHKwzlU2OdUJ78uLGgl190OYOEsIz5k3yK49nTyky4sOGmJsmds+fqR |
| 69 | +rbURhDGu/tLAAK/6np3fai5ef4beZDbdhXrWS+rjOKSU0lRifUXU/JJFicG2PiX2B1InuqGLwGwAp/3 |
| 70 | + |
| 71 | + |
| 72 | +``` |
| 73 | +
|
| 74 | +### Set your git user name. |
| 75 | +
|
| 76 | +It is important that you set the user name and email address to use for any commits to the |
| 77 | +git repository: |
| 78 | +
|
| 79 | +``` |
| 80 | +$ git config --global user.name User Name |
| 81 | +$ git config --global user.email [email protected] |
| 82 | +``` |
| 83 | +
|
| 84 | +Use the same email address that you used to sign up for your github account. |
| 85 | +
|
| 86 | +### Forking the repository. |
| 87 | +
|
| 88 | +If you want to contribute to the project the best practice is to create a fork. To do so |
| 89 | +navigate to the project's repository and click on the *fork* button at the top right of the |
| 90 | +screen. If you are a member of multiple organisations you will be presented with a selection screen |
| 91 | +which can be used to select where to create the fork. Click on your user account to create the fork. |
| 92 | +
|
| 93 | +You can now clone your fork: |
| 94 | +
|
| 95 | +``` |
| 96 | +$ git clone [email protected]:< username>/< repository>.git |
| 97 | +``` |
| 98 | +
|
| 99 | +### Keeping your fork in sync. |
| 100 | +
|
| 101 | +In order to easily pull down upstream changes to your fork you need to setup a new remote. |
| 102 | +
|
| 103 | +``` |
| 104 | +$ git remote add upstream [email protected]/< organisation>/< repository>.git |
| 105 | +``` |
| 106 | +For the example of OpenWrt for the Creator Ci40 in the Creatordev organisation this would be |
| 107 | +``` |
| 108 | +$ git remote add upstream [email protected]/CreatorDev/openwrt.git |
| 109 | +``` |
| 110 | +
|
| 111 | +
|
| 112 | +
|
| 113 | +You can now fetch from the upstream repository with: |
| 114 | +
|
| 115 | +``` |
| 116 | +$ git fetch upstream |
| 117 | +``` |
| 118 | +
|
| 119 | +And merge any new changes into your master branch with: |
| 120 | +
|
| 121 | +``` |
| 122 | +$ git checkout master |
| 123 | +$ git merge upstream/master |
| 124 | +``` |
| 125 | +
|
| 126 | +### Making changes. |
| 127 | +
|
| 128 | +The simplest way of working is to keep a clean master branch in the new fork and to create branches for each new pull request. This prevents merge conflicts with the upstream |
| 129 | +master branch, and allows you to make changes to your pull request if required. |
| 130 | +
|
| 131 | +To create a new branch: |
| 132 | +
|
| 133 | +``` |
| 134 | +$ git checkout master -b dev-branch1 --track |
| 135 | +``` |
| 136 | +
|
| 137 | +**Note.** *The branch name here is important. It will show up in the git history so use something meaningful or suitably general* |
| 138 | +
|
| 139 | +Once you have created your branch make your changes, then commit them to your new branch. |
| 140 | +
|
| 141 | +### Commit messages. |
| 142 | +
|
| 143 | +For the commit message, the following rules apply: |
| 144 | +
|
| 145 | + * The first line should be a brief summary of the patch. |
| 146 | + * Leave a blank line after the summary. |
| 147 | + * Provide a detailed description of the change. |
| 148 | + * Leave a blank line after the description. |
| 149 | + * If the patch relates to an issue, add a line with 'Ref: ISSUE_ID'. |
| 150 | + * Add a Git 'Signed-off-by' line using ````git commit -s```` or ````git commit --sign-off```` (see *Signing your work* below). |
| 151 | +
|
| 152 | + Example: |
| 153 | +
|
| 154 | +```` |
| 155 | +
|
| 156 | + Adds a new example feature xyz |
| 157 | +
|
| 158 | + This patch adds example feature xyz. This feature merely acts |
| 159 | + as an example of how to commit something to the project. |
| 160 | + For real features this would contain some text |
| 161 | + describing in detail what the new feature actually does. |
| 162 | +
|
| 163 | + Ref: <project>-<ID_number> |
| 164 | + Signed-off-by: User Name <[email protected]> |
| 165 | +
|
| 166 | +```` |
| 167 | +
|
| 168 | +
|
| 169 | +
|
| 170 | +### Signing your work. |
| 171 | +
|
| 172 | +CreatorDev projects require contributors to accept the Developer Certificate of Origin (DCO) from developercertificate.org. Github.com defines a contributor as "A contributor is someone from the outside not on the core development team of the project that wants to contribute some changes to a project." |
| 173 | +
|
| 174 | +The sign-off is a single line at the end of your commit comment to certify that you either wrote the supplied code or otherwise have the right to pass on the code as open source. |
| 175 | +
|
| 176 | +
|
| 177 | +Certifying your contribution asserts that *for the current submission* the following statement is true: |
| 178 | +
|
| 179 | +
|
| 180 | +
|
| 181 | +``` |
| 182 | +Developer Certificate of Origin |
| 183 | +Version 1.1 |
| 184 | + |
| 185 | +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. |
| 186 | +660 York Street, Suite 102, |
| 187 | +San Francisco, CA 94110 USA |
| 188 | + |
| 189 | +Everyone is permitted to copy and distribute verbatim copies of this |
| 190 | +license document, but changing it is not allowed. |
| 191 | + |
| 192 | +Developer's Certificate of Origin 1.1 |
| 193 | + |
| 194 | +By making a contribution to this project, I certify that: |
| 195 | + |
| 196 | +(a) The contribution was created in whole or in part by me and I |
| 197 | + have the right to submit it under the open source license |
| 198 | + indicated in the file; or |
| 199 | + |
| 200 | +(b) The contribution is based upon previous work that, to the best |
| 201 | + of my knowledge, is covered under an appropriate open source |
| 202 | + license and I have the right under that license to submit that |
| 203 | + work with modifications, whether created in whole or in part |
| 204 | + by me, under the same open source license (unless I am |
| 205 | + permitted to submit under a different license), as indicated |
| 206 | + in the file; or |
| 207 | + |
| 208 | +(c) The contribution was provided directly to me by some other |
| 209 | + person who certified (a), (b) or (c) and I have not modified |
| 210 | + it. |
| 211 | + |
| 212 | +(d) I understand and agree that this project and the contribution |
| 213 | + are public and that a record of the contribution (including all |
| 214 | + personal information I submit with it, including my sign-off) is |
| 215 | + maintained indefinitely and may be redistributed consistent with |
| 216 | + this project or the open source license(s) involved. |
| 217 | +``` |
| 218 | +
|
| 219 | +To certify your submission just add the following line to *every* git commit message to indicate that you accept the above DCO: |
| 220 | +
|
| 221 | +```` |
| 222 | +Signed-off-by: User Name <[email protected]> |
| 223 | +
|
| 224 | +```` |
| 225 | +
|
| 226 | +If you set-up your user.name and user.email via git config, you can sign your commit automatically with git commit: |
| 227 | +
|
| 228 | +```` |
| 229 | +$ git commit --signoff |
| 230 | +```` |
| 231 | +
|
| 232 | +### Pushing your changes to your branch. |
| 233 | +
|
| 234 | +If you specified --track when you created your new branch you should be able to simply push using |
| 235 | +
|
| 236 | +``` |
| 237 | +$ git push |
| 238 | +``` |
| 239 | +
|
| 240 | +If not you will either have to specify where to push your new commits. |
| 241 | +
|
| 242 | +``` |
| 243 | +$ git push origin dev_branch1:dev_branch1 |
| 244 | +``` |
| 245 | +
|
| 246 | +or alternatively setup branch tracking |
| 247 | +
|
| 248 | +``` |
| 249 | +$ git push --set-upstream origin dev_branch1 |
| 250 | +``` |
| 251 | +
|
| 252 | +### Creating a pull request. |
| 253 | +
|
| 254 | +- Navigate to https://github.com/*username*/*repository*/pulls |
| 255 | +- Click on *New pull request* |
| 256 | +- Select the repository's master as the base in the left hand box |
| 257 | +- Select the branch you wish to submit as a pull request in the right hand box. |
| 258 | +- Click the *create* button. |
| 259 | +
|
| 260 | +**Note.** Developers should only submit patches against the master branch. |
| 261 | +
|
| 262 | +An email will be sent to the project maintainers who will review your pull request. |
| 263 | +
|
| 264 | +If everything checks out no further action will be required. |
| 265 | +
|
| 266 | +You may wish to continue making other changes, in this case simply resync with the upstream |
| 267 | +and create a new branch. Do **NOT** add your new unrelated changes to the branch you |
| 268 | +used for the pull request as they will automatically be included in the request. |
| 269 | +
|
| 270 | +### Making changes to a pull request. |
| 271 | +
|
| 272 | +You may be asked to make some changes before your pull request will be accepted. |
| 273 | +Any further commits that are pushed to the branch you used for the initial pull |
| 274 | +request will be automatically added to your pull request. |
| 275 | +
|
| 276 | +In some cases you may be asked to rebase your commits, either to bring them in-line |
| 277 | +with the current master branch, to tidy up any commit comments or to add a forgotten |
| 278 | +sign-off. |
| 279 | +
|
| 280 | +
|
| 281 | +---- |
| 282 | +
|
| 283 | +---- |
0 commit comments