]> git.proxmox.com Git - mirror_frr.git/blob - COMMUNITY.md
build: improve COMMUNITY.md formatting
[mirror_frr.git] / COMMUNITY.md
1 # Developing for PROJECT (DRAFT)
2
3 [TOC]
4
5 ## Git Structure
6
7 The master Git for PROJECT resides on Github at
8 [https://github.com/PROJECT/XXX](https://github.com/PROJECT/XXX)
9
10 There are 3 main branches for development and a release branch for each
11 major release.
12
13 New contributions are done against the head of the Develop branch. The CI
14 systems will pick up the Github Pull Requests or the new patch from
15 Patchwork, run some basic build and functional tests and will merge them
16 into the branch automatically on success.
17
18 Code on the develop branch will then be further tested and reviewed by the
19 community and merged to master on a regular interval.
20
21 For each major release (1.0, 1.1 etc) a new release branch is created based
22 on the master.
23
24
25 ## Programming language, Tools and Libraries
26
27 The core of PROJECT is written in C (gcc or clang supported). A few
28 non-essential scripts are implemented in Perl and Python. PROJECT requires
29 the following tools to build distribution packages: automake, autoconf,
30 texinfo, libtool and gawk and various libraries (i.e. libpam and libjson-c).
31
32 If your contribution requires a new library or other tool, then please
33 highlight this in your description of the change. Also make sure it’s
34 supported by all PROJECT platform OSes or provide a way to build without the
35 library (potentially without the new feature) on the other platforms.
36
37 Documentation should be written in Tex (.texi) or Markdown (.md) format with
38 preference on Markdown.
39
40
41 ## Before Submitting your changes
42
43 * Format code (see [Code Styling requirements](#code-styling-requirements))
44 * Verify and acknowledge license (see [License for contributions](#license-for-contributions))
45 * Test building with various configurations:
46 * `buildtest.sh`
47 * Verify building source distribution:
48 * `make dist` (and try rebuilding from the resulting tar file)
49 * Run DejaGNU unit tests:
50 * `make test`
51 * Document Regression Runs and plans for continued maintenance of the feature
52
53 ### Changelog
54
55 The changelog will be the base for the release notes. A changelog entry for
56 your changes is usually not required and will be added based on your commit
57 messages by the maintainers. However, you are free to include an update to
58 the changelog with some better description. The changelog will be the base
59 for the release notes.
60
61
62 ## Submitting Patches and Enhancements
63
64 ### License for contributions
65
66 PROJECT is under a “GPLv2 or later” license. Any code submitted must be
67 released under the same license (preferred) or any license which allows
68 redistribution under this GPLv2 license (eg MIT License).
69
70 ### Signed-off required
71
72 Submissions to PROJECT require a “Signed-off” in the patch or git commit.
73 We follow the same standard as the Linux Kernel Development.
74
75 > Developer's Certificate of Origin 1.1
76 >
77 > By making a contribution to this project, I certify that:
78 >
79 > (a) The contribution was created in whole or in part by me and I
80 > have the right to submit it under the open source license
81 > indicated in the file; or
82 >
83 > (b) The contribution is based upon previous work that, to the best
84 > of my knowledge, is covered under an appropriate open source
85 > license and I have the right under that license to submit that
86 > work with modifications, whether created in whole or in part
87 > by me, under the same open source license (unless I am
88 > permitted to submit under a different license), as indicated
89 > in the file; or
90 >
91 > (c) The contribution was provided directly to me by some other
92 > person who certified (a), (b) or (c) and I have not modified
93 > it.
94 >
95 > (d) I understand and agree that this project and the contribution
96 > are public and that a record of the contribution (including all
97 > personal information I submit with it, including my sign-off) is
98 > maintained indefinitely and may be redistributed consistent with
99 > this project or the open source license(s) involved.
100
101 #### Using this Process
102
103 We have the same requirements for using the signed-off-by process as the Linux
104 kernel. In short, you need to include a signed-off-by tag in every patch:
105
106 * `Signed-off-by:` this is a developer's certification that he or she has the
107 right to submit the patch for inclusion into the project. It is an agreement to
108 the Developer's Certificate of Origin (above). Code without a proper signoff
109 cannot be merged into the mainline.
110
111 Please make sure to have a `Signed-off-by:` in each commit/patch or the patches
112 will be rejected until this is added.
113
114 If you are unfamiliar with this process, you should read the [official policy
115 at kernel.org](http://www.kernel.org/doc/Documentation/SubmittingPatches) and
116 you might find this article about [participating in the Linux community on the
117 Linux Foundation
118 website](http://www.linuxfoundation.org/content/how-participate-linux-community-0)
119 to be a helpful resource.
120
121
122 ### Code submission - Github Pull Request (Strongly Preferred)
123
124 Preferred submission of code is by using a Github Pull Request against the
125 Develop branch. Code submitted by Pull Request will have an email generated to
126 the PROJECT-devel mailing list for review and the submission will be
127 automatically tested by one or more CI systems. Only after this test succeeds
128 (and the submission is based on the head of the develop branch), then it will
129 be automatically merged into the develop branch. In case of failed tests, it is
130 up to the submitter to either amend the request with further commits or close,
131 fix and create a new pull request.
132
133 Further (manual) code review and discussion happens after the merge into the
134 develop branch.
135
136
137 ### Code submission - Mailing Patch to PROJECT-Devel list
138
139 As an alternative submission, a patch can be mailed to the PROJECT-Devel
140 mailing list. Preferred way to send the patch is using git send-mail. Patches
141 received on the mailing list will be picked up by Patchwork and tested against
142 the latest develop branch. After a further ACK by someone on the mailing list,
143 the patch is then merged into the develop branch.
144
145 Further (manual) code review and discussion happens after the merge into the
146 develop branch.
147
148 #### Sending patch to mailing list
149
150 The recommended way to send the patch (or series of NN patches) to the list is
151 by using ‘git send-email’ as follows (assuming they are the most recent NN
152 commit(s) in your git history:
153
154 ```
155 git send-email -NN --annotate --to=XXX-Devel@XXX.org
156 ```
157
158 If your commits do not already contain a `Signed-off-by` line, then use the
159 following version to add it (after making sure to be able to agree to the
160 Developer Certificate of Origin as outlined above):
161
162 ```
163 git send-email -NN --annotate --signoff --to=XXX-Devel@XXX.org
164 ```
165
166 Submitting multi-commit patches as a Github Pull Request is strongly encouraged
167 and will allow your changes to merge faster
168
169
170 ## After submitting your changes
171
172 * Watch for Continuous Integration (CI) Test results
173 * You should automatically receive an email with the test results within
174 less than 2 hrs of the submission. If you don’t get the email, then check
175 status on the github pull request (if submitted by pull request) or on
176 Patchwork at
177 [https://patchwork.PROJECT.org](https://patchwork.PROJECT.org) (if
178 submitted as patch to mailing list).
179 * Please notify PROJECT-Devel mailing list if you think something doesn’t
180 work
181 * If the tests failed:
182 * In general, expect the community to ignore the submission until the tests
183 pass.
184 * It is up to you to fix and resubmit.
185 * This includes fixing existing dejagnu (“make test”) tests if your
186 changes broke or changed them.
187 * It also includes fixing distribution packages for the failing
188 platforms (ie if new libraries are required)
189 * Feel free to ask for help on PROJECT-Devel list
190 * Go back to the submission process and repeat until the tests pass.
191 * If the tests pass:
192 * If the changes are done as a pull request, then they should be
193 automatically merged to the develop branch.
194 * Changes sent to mailing list require a manual ACK to be merged and should
195 be merged within 2 weeks. If you don’t see the merge or any
196 reason/discussion on PROJECT-Devel, then please ask.
197 * Watch out for questions on the mailing list. At this time there will be a
198 manual code review and further (longer) tests by various community members.
199 * Your submission is done once it is merged to the master branch. (which should
200 happen every few weeks from the develop branch)
201
202
203 ## Code Styling requirements
204
205 ### File header required for new files added
206
207 New files need to have a Copyright header (see [License for
208 contributions](#license-for-contributions) above) added to the file. Preferred
209 form of the header is as follows:
210
211 ```
212 /*
213 Title/Function of file
214 Copyright (C) 2016 Author’s Name
215
216 This program is free software; you can redistribute it and/or modify
217 it under the terms of the GNU General Public License as published by
218 the Free Software Foundation; either version 2 of the License, or
219 (at your option) any later version.
220
221 This program is distributed in the hope that it will be useful, but
222 WITHOUT ANY WARRANTY; without even the implied warranty of
223 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
224 General Public License for more details.
225
226 You should have received a copy of the GNU General Public License
227 along with this program; see the file COPYING; if not, write to the
228 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
229 MA 02110-1301 USA
230 */
231
232 #include <zebra.h>
233 ```
234
235 ### Adding Copyright claims to already existing file
236
237 When adding copyright claims for modifications to an existing file, please
238 preface the claim with "Portions: " on a line before it and indent the
239 "Copyright ..." string. If such a case already exists, add your indented claim
240 immediately after. E.g.:
241
242 ```
243 Portions:
244 Copyright (C) 2010 Entity A ....
245 Copyright (C) 2016 Your name [optional brief change description]
246 ```
247
248 ### Code styling / format
249
250 GNU coding standards apply. Indentation follows the result of invoking GNU
251 indent (as of 2.2.8a) with the `-nut -nfc1` arguments.
252
253 ```
254 indent -nut -nfc1 file_for_submission.c
255 ```
256
257 Please don’t reformat existing files (or only sections modified by your
258 changes), even if they don’t follow the standard. This makes it very hard to
259 highlight the changes
260
261 ### Changing / Deprecate an existing exported interface
262
263 If changing an exported interface, please try to deprecate the interface in an
264 orderly manner. If at all possible, try to retain the old deprecated interface
265 as is, or functionally equivalent. Make a note of when the interface was
266 deprecated and guard the deprecated interface definitions in the header file,
267 i.e.:
268
269 ```
270 /* Deprecated: 20050406 */
271 #if !defined(QUAGGA_NO_DEPRECATED_INTERFACES)
272 #warning "Using deprecated <libname> (interface(s)|function(s))"
273 ...
274 #endif /* QUAGGA_NO_DEPRECATED_INTERFACES */
275 ```
276
277 This is to ensure that the core Quagga sources do not use the deprecated
278 interfaces (you should update Quagga sources to use new interfaces, if
279 applicable), while allowing external sources to continue to build. Deprecated
280 interfaces should be excised in the next unstable cycle.
281
282 Note: If you wish, you can test for GCC and use a function marked with the
283 `deprecated` attribute. However, you must provide the warning for other
284 compilers. If changing or removing a command definition, ensure that you
285 properly deprecate it - use the `_DEPRECATED` form of the appropriate `DEFUN`
286 macro. This is critical. Even if the command can no longer function, you MUST
287 still implement it as a do-nothing stub.
288
289 Failure to follow this causes grief for systems administrators, as an upgrade
290 may cause daemons to fail to start because of unrecognised commands. Deprecated
291 commands should be excised in the next unstable cycle. A list of deprecated
292 commands should be collated for each release.
293
294
295 ### Compile-Time conditional code
296
297 Many users access PROJECT via binary packages from 3rd party sources;
298 compile-time code puts inclusion/exclusion in the hands of the package
299 maintainer. Please think very carefully before making code conditional at
300 compile time, as it increases regression testing, maintenance burdens, and user
301 confusion. In particular, please avoid gratuitous --enable-… switches to the
302 configure script - typically code should be good enough to be in PROJECT, or it
303 shouldn’t be there at all.
304
305 When code must be compile-time conditional, try have the compiler make it
306 conditional rather than the C pre-processor - so that it will still be checked
307 by the compiler, even if disabled. I.e. this:
308
309 ```
310 if (SOME_SYMBOL)
311 frobnicate();
312 ```
313
314 rather than
315
316 ```
317 #ifdef SOME_SYMBOL
318 frobnicate ();
319 #endif /* SOME_SYMBOL */
320 ```
321
322 Note that the former approach requires ensuring that `SOME_SYMBOL` will be
323 defined (watch your `AC_DEFINE`s).