]> git.proxmox.com Git - mirror_frr.git/blame - COMMUNITY.md
Merge branch 'frr/pull/536'
[mirror_frr.git] / COMMUNITY.md
CommitLineData
f6ee5b52
DL
1# Developing for PROJECT (DRAFT)
2
4765f35e 3[TOC]
f6ee5b52 4
02fe6f86
DL
5## General note on this document
6
7This document is "descriptive/post-factual" in that it documents pratices that
8are in use; it is not "definitive/pre-factual" in prescribing practices.
9
10This means that when a procedure changes, it is agreed upon, then put into
11practice, and then documented here. If this document doesn't match reality,
12it's the document that needs to be updated, not reality.
13
14
f6ee5b52
DL
15## Git Structure
16
17The master Git for PROJECT resides on Github at
4765f35e 18[https://github.com/PROJECT/XXX](https://github.com/PROJECT/XXX)
f6ee5b52 19
9b7939d9
DL
20![git branches continually merging to the left from 3 lanes; float-right](doc/git_branches.svg
21"git branch mechanics")
22
02fe6f86 23There is one main branch for development and a release branch for each
f6ee5b52
DL
24major release.
25
02fe6f86 26New contributions are done against the head of the master branch. The CI
f6ee5b52 27systems will pick up the Github Pull Requests or the new patch from
02fe6f86 28Patchwork, run some basic build and functional tests.
f6ee5b52
DL
29
30For each major release (1.0, 1.1 etc) a new release branch is created based
31on the master.
32
02fe6f86
DL
33There was an attempt to use a "develop" branch automatically maintained by
34the CI system. This is not currently in active use, though the system is
35operational. If the "develop" branch is in active use and this paragraph
36is still here, this document obviously wasn't updated.
37
f6ee5b52
DL
38
39## Programming language, Tools and Libraries
40
41The core of PROJECT is written in C (gcc or clang supported). A few
42non-essential scripts are implemented in Perl and Python. PROJECT requires
43the following tools to build distribution packages: automake, autoconf,
44texinfo, libtool and gawk and various libraries (i.e. libpam and libjson-c).
45
46If your contribution requires a new library or other tool, then please
47highlight this in your description of the change. Also make sure it’s
48supported by all PROJECT platform OSes or provide a way to build without the
49library (potentially without the new feature) on the other platforms.
50
51Documentation should be written in Tex (.texi) or Markdown (.md) format with
52preference on Markdown.
53
54
55## Before Submitting your changes
56
4765f35e
DL
57* Format code (see [Code Styling requirements](#code-styling-requirements))
58* Verify and acknowledge license (see [License for contributions](#license-for-contributions))
f6ee5b52 59* Test building with various configurations:
4765f35e 60 * `buildtest.sh`
f6ee5b52 61* Verify building source distribution:
4765f35e 62 * `make dist` (and try rebuilding from the resulting tar file)
f6ee5b52 63* Run DejaGNU unit tests:
4765f35e 64 * `make test`
f6ee5b52
DL
65* Document Regression Runs and plans for continued maintenance of the feature
66
67### Changelog
68
69The changelog will be the base for the release notes. A changelog entry for
70your changes is usually not required and will be added based on your commit
71messages by the maintainers. However, you are free to include an update to
72the changelog with some better description. The changelog will be the base
73for the release notes.
74
75
76## Submitting Patches and Enhancements
77
78### License for contributions
79
80PROJECT is under a “GPLv2 or later” license. Any code submitted must be
81released under the same license (preferred) or any license which allows
82redistribution under this GPLv2 license (eg MIT License).
83
84### Signed-off required
85
86Submissions to PROJECT require a “Signed-off” in the patch or git commit.
87We follow the same standard as the Linux Kernel Development.
88
89> Developer's Certificate of Origin 1.1
90>
91> By making a contribution to this project, I certify that:
92>
93> (a) The contribution was created in whole or in part by me and I
94> have the right to submit it under the open source license
95> indicated in the file; or
96>
97> (b) The contribution is based upon previous work that, to the best
98> of my knowledge, is covered under an appropriate open source
99> license and I have the right under that license to submit that
100> work with modifications, whether created in whole or in part
101> by me, under the same open source license (unless I am
102> permitted to submit under a different license), as indicated
103> in the file; or
104>
105> (c) The contribution was provided directly to me by some other
106> person who certified (a), (b) or (c) and I have not modified
107> it.
108>
109> (d) I understand and agree that this project and the contribution
110> are public and that a record of the contribution (including all
111> personal information I submit with it, including my sign-off) is
112> maintained indefinitely and may be redistributed consistent with
113> this project or the open source license(s) involved.
114
115#### Using this Process
116
117We have the same requirements for using the signed-off-by process as the Linux
118kernel. In short, you need to include a signed-off-by tag in every patch:
119
120* `Signed-off-by:` this is a developer's certification that he or she has the
121right to submit the patch for inclusion into the project. It is an agreement to
122the Developer's Certificate of Origin (above). Code without a proper signoff
123cannot be merged into the mainline.
124
125Please make sure to have a `Signed-off-by:` in each commit/patch or the patches
126will be rejected until this is added.
127
128If you are unfamiliar with this process, you should read the [official policy
129at kernel.org](http://www.kernel.org/doc/Documentation/SubmittingPatches) and
130you might find this article about [participating in the Linux community on the
131Linux Foundation
132website](http://www.linuxfoundation.org/content/how-participate-linux-community-0)
133to be a helpful resource.
134
e0ba80e2
DS
135### Code submission - What do I submit my changes against?
136
137We've documented where we would like to have the different fixes applied at
138https://github.com/FRRouting/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F
139If you are unsure where your submission goes, look at that document or ask
140the question of a maintainer.
f6ee5b52 141
4765f35e 142### Code submission - Github Pull Request (Strongly Preferred)
f6ee5b52
DL
143
144Preferred submission of code is by using a Github Pull Request against the
145Develop branch. Code submitted by Pull Request will have an email generated to
146the PROJECT-devel mailing list for review and the submission will be
147automatically tested by one or more CI systems. Only after this test succeeds
148(and the submission is based on the head of the develop branch), then it will
149be automatically merged into the develop branch. In case of failed tests, it is
150up to the submitter to either amend the request with further commits or close,
151fix and create a new pull request.
152
153Further (manual) code review and discussion happens after the merge into the
154develop branch.
155
156
4765f35e 157### Code submission - Mailing Patch to PROJECT-Devel list
f6ee5b52
DL
158
159As an alternative submission, a patch can be mailed to the PROJECT-Devel
160mailing list. Preferred way to send the patch is using git send-mail. Patches
161received on the mailing list will be picked up by Patchwork and tested against
162the latest develop branch. After a further ACK by someone on the mailing list,
163the patch is then merged into the develop branch.
164
165Further (manual) code review and discussion happens after the merge into the
166develop branch.
167
4765f35e 168#### Sending patch to mailing list
f6ee5b52
DL
169
170The recommended way to send the patch (or series of NN patches) to the list is
171by using ‘git send-email’ as follows (assuming they are the most recent NN
172commit(s) in your git history:
173
174```
175git send-email -NN --annotate --to=XXX-Devel@XXX.org
176```
177
178If your commits do not already contain a `Signed-off-by` line, then use the
179following version to add it (after making sure to be able to agree to the
180Developer Certificate of Origin as outlined above):
181
182```
183git send-email -NN --annotate --signoff --to=XXX-Devel@XXX.org
184```
185
186Submitting multi-commit patches as a Github Pull Request is strongly encouraged
187and will allow your changes to merge faster
188
189
190## After submitting your changes
191
192* Watch for Continuous Integration (CI) Test results
193 * You should automatically receive an email with the test results within
194 less than 2 hrs of the submission. If you don’t get the email, then check
195 status on the github pull request (if submitted by pull request) or on
4765f35e
DL
196 Patchwork at
197 [https://patchwork.PROJECT.org](https://patchwork.PROJECT.org) (if
198 submitted as patch to mailing list).
f6ee5b52 199 * Please notify PROJECT-Devel mailing list if you think something doesn’t
4765f35e 200 work
f6ee5b52
DL
201* If the tests failed:
202 * In general, expect the community to ignore the submission until the tests
203 pass.
204 * It is up to you to fix and resubmit.
205 * This includes fixing existing dejagnu (“make test”) tests if your
206 changes broke or changed them.
207 * It also includes fixing distribution packages for the failing
208 platforms (ie if new libraries are required)
209 * Feel free to ask for help on PROJECT-Devel list
210 * Go back to the submission process and repeat until the tests pass.
211* If the tests pass:
212 * If the changes are done as a pull request, then they should be
213 automatically merged to the develop branch.
214 * Changes sent to mailing list require a manual ACK to be merged and should
215 be merged within 2 weeks. If you don’t see the merge or any
216 reason/discussion on PROJECT-Devel, then please ask.
217* Watch out for questions on the mailing list. At this time there will be a
218 manual code review and further (longer) tests by various community members.
219* Your submission is done once it is merged to the master branch. (which should
220 happen every few weeks from the develop branch)
221
222
223## Code Styling requirements
224
225### File header required for new files added
226
4765f35e
DL
227New files need to have a Copyright header (see [License for
228contributions](#license-for-contributions) above) added to the file. Preferred
229form of the header is as follows:
f6ee5b52
DL
230
231```
232/*
896014f4
DL
233 * Title/Function of file
234 * Copyright (C) YEAR Author’s Name
235 *
236 * This program is free software; you can redistribute it and/or modify it
237 * under the terms of the GNU General Public License as published by the Free
238 * Software Foundation; either version 2 of the License, or (at your option)
239 * any later version.
240 *
241 * This program is distributed in the hope that it will be useful, but WITHOUT
242 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
243 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
244 * more details.
245 *
246 * You should have received a copy of the GNU General Public License along
247 * with this program; see the file COPYING; if not, write to the Free Software
248 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
f6ee5b52 249 */
4765f35e
DL
250
251#include <zebra.h>
f6ee5b52
DL
252```
253
254### Adding Copyright claims to already existing file
255
256When adding copyright claims for modifications to an existing file, please
257preface the claim with "Portions: " on a line before it and indent the
258"Copyright ..." string. If such a case already exists, add your indented claim
259immediately after. E.g.:
260
261```
262Portions:
263 Copyright (C) 2010 Entity A ....
264 Copyright (C) 2016 Your name [optional brief change description]
265```
266
267### Code styling / format
268
02fe6f86
DL
269Coding style standards in FRR vary depending on location. Pre-existing
270code uses GNU coding standards. New code may use Linux kernel coding style.
271
272GNU coding style apply to the following parts:
273
274* lib/
275* zebra/
276* bgpd/
277* ospfd/
278* ospf6d/
279* isisd/
280* ripd/
281* ripngd/
282* vtysh/
283
284Linux kernel coding style applies to:
285
286* nhrpd/
287* watchfrr/
288* pimd/
289* lib/{checksum,hook,imsg-buffer,imsg,libfrr,md5,module,monotime,queue}.[ch]
290
291BSD coding style applies to:
292
293* ldpd/
294
295**Whitespace changes in untouched parts of the code are not acceptable in
296patches that change actual code.** To change/fix formatting issues, please
297create a separate patch that only does formatting changes and nothing else.
298
299It is acceptable to rewrap entire files to Linux kernel style, but this
300**MUST** come as a separate patch that does nothing other than this
301reformatting.
302
303
304#### GNU style
305
306For GNU coding style, Indentation follows the result of invoking GNU indent:
f6ee5b52
DL
307
308```
309indent -nut -nfc1 file_for_submission.c
310```
311
02fe6f86
DL
312Originally, tabs were used instead of spaces, with tabs are every 8 columns.
313However, tab interoperability issues mean space characters are now preferred for
314new changes. We generally only clean up whitespace when code is unmaintainable
315due to whitespace issues, to minimise merging conflicts.
316
317
318#### Linux kernel & BSD style
319
320These styles are documented externally:
321
322* [https://www.kernel.org/doc/Documentation/CodingStyle](https://www.kernel.org/doc/Documentation/CodingStyle).
323* [http://man.openbsd.org/style](http://man.openbsd.org/style)
324
325They are relatively similar but differ in details.
326
327pimd deviates from Linux kernel style in using 2 spaces for indentation, with
328Tabs replacing 8 spaces, as well as adding a line break between `}` and `else`.
329It is acceptable to convert indentation in pimd/ to Linux kernel style, but
330please convert an entire file at a time. (Rationale: apart from 2-space
331indentation, the styles are sufficiently close to not upset when mixed.)
332
333Unlike GNU style, these styles use tabs, not spaces.
334
f6ee5b52 335
f6ee5b52
DL
336### Compile-Time conditional code
337
338Many users access PROJECT via binary packages from 3rd party sources;
339compile-time code puts inclusion/exclusion in the hands of the package
340maintainer. Please think very carefully before making code conditional at
341compile time, as it increases regression testing, maintenance burdens, and user
342confusion. In particular, please avoid gratuitous --enable-… switches to the
343configure script - typically code should be good enough to be in PROJECT, or it
344shouldn’t be there at all.
345
346When code must be compile-time conditional, try have the compiler make it
347conditional rather than the C pre-processor - so that it will still be checked
348by the compiler, even if disabled. I.e. this:
349
350```
351if (SOME_SYMBOL)
352 frobnicate();
353```
354
355rather than
356
357```
358#ifdef SOME_SYMBOL
359frobnicate ();
360#endif /* SOME_SYMBOL */
361```
362
363Note that the former approach requires ensuring that `SOME_SYMBOL` will be
364defined (watch your `AC_DEFINE`s).
7ce0cb3c
DS
365
366### Debug-Guards in code
367
368Debugs are an important methodology to allow developers to fix issues
369found in the code after it has been released. The caveat here is
370that the developer must remember that people will be using the code
371at scale and in ways that can be unexpected for the original implementor.
372As such debugs MUST be guarded in such a way that they can be turned off.
373This PROJECT has the ability to turn on/off debugs from the CLI and it is
374expected that the developer will use this convention to allow control
19c7f43f
DS
375of their debugs.
376
377### CLI-Changes
378
379CLI's are a complicated ugly beast. Additions or changes to the CLI
380should use a DEFUN to encapsulate one setting as much as is possible.
381Additionally as new DEFUN's are added to the system, documentation
02fe6f86 382should be provided for the new commands.