]> git.proxmox.com Git - mirror_frr.git/blob - HACKING
2005-04-16 Paul Jakma <paul@dishone.st>
[mirror_frr.git] / HACKING
1 -*- mode: text; -*-
2 $Id: HACKING,v 1.19 2005/04/07 07:30:20 paul Exp $
3
4 GUIDELINES FOR HACKING ON QUAGGA
5
6 [this is a draft in progress]
7
8 GNU coding standards apply. Indentation follows the result of
9 invoking GNU indent (as of 2.2.8a) with no arguments. Note that this
10 uses tabs instead of spaces where possible for leading whitespace, and
11 assumes that tabs are every 8 columns. Do not attempt to redefine the
12 location of tab stops. Note also that some indentation does not
13 follow GNU style. This is a historical accident, and we generally
14 only clean up whitespace when code is unmaintainable due to whitespace
15 issues, as fewer changes from zebra lead to easier merges.
16
17 For GNU emacs, use indentation style "gnu".
18
19 For Vim, use the following lines (note that tabs are at 8, and that
20 softtabstop sets the indentation level):
21
22 set tabstop=8
23 set softtabstop=2
24 set shiftwidth=2
25 set noexpandtab
26
27 Be particularly careful not to break platforms/protocols that you
28 cannot test.
29
30 New code should have good comments, and changes to existing code
31 should in many cases upgrade the comments when necessary for a
32 reviewer to conclude that the change has no unintended consequences.
33
34 Each file in CVS should have the RCS keyword Id, somewhere very near
35 the top, commented out appropriately for the file type. Just add
36 <dollar>Id:<dollar>, replacing <dollar> with $. See line 2 of HACKING
37 for an example; on checkout :$ is expanded to include the value.
38
39 Please document fully the proper use of a new function in the header file
40 in which it is declared. And please consult existing headers for
41 documentation on how to use existing functions. In particular, please consult
42 these header files:
43
44 lib/log.h logging levels and usage guidance
45 [more to be added]
46
47 If changing an exported interface, please try to deprecate the interface in
48 an orderly manner. If at all possible, try to retain the old deprecated
49 interface as is, or functionally equivalent. Make a note of when the
50 interface was deprecated and guard the deprecated interface definitions in
51 the header file, ie:
52
53 /* Deprecated: 20050406 */
54 #if !defined(QUAGGA_NO_DEPRECATED_INTERFACES)
55 #warning "Using deprecated <libname> (interface(s)|function(s))"
56 ...
57 #endif /* QUAGGA_NO_DEPRECATED_INTERFACES */
58
59 To ensure that the core Quagga sources do not use the deprecated interfaces
60 (you should update Quagga sources to use new interfaces, if applicable)
61 while allowing external sources to continue to build. Deprecated interfaces
62 should be excised in the next unstable cycle.
63
64 If changing or removing a command definition, *ensure* that you properly
65 deprecate it - use the _DEPRECATED form of the appropriate DEFUN macro. This
66 is *critical*. Even if the command can no longer function, you *must* still
67 implement it as a do-nothing stub. Failure to follow this causes grief for
68 systems administrators. Deprecated commands should be excised in the next
69 unstable cycle. A list of deprecated commands should be collated for each
70 release.
71
72 See also below regarding SHARED LIBRARY VERSIONING.
73
74 CHANGELOG
75
76 Add a ChangeLog entry whenever changing code, except for minor fixes
77 to a commit (with a ChangeLog entry) within the last few days.
78
79 Most directories have a ChangeLog file; changes to code in that
80 directory should go in the per-directory ChangeLog. Global or
81 structural changes should also be mentioned in the top-level
82 ChangeLog.
83
84 Certain directories do not contain project code, but contain project
85 meta-data, eg packaging information, changes to files in these directory may
86 not require the global ChangeLog to be updated (at the discretion of the
87 maintainer who usually maintains that meta-data). Also, CVS meta-data such
88 as cvsignore files do not require ChangeLog updates, just a sane commit
89 message.
90
91 RELEASE PROCEDURE
92
93 Tag the repository with release tag (follow existing conventions).
94 [This enables recreating the release, and is just good CM practice.]
95
96 Check out the tag, and do a test build.
97
98 In an empty directory, do a fresh checkout with -r <release-tag>
99 [This makes the dates in the tarball be the modified dates in CVS.]
100
101 ./configure
102 make dist
103
104 If any errors occur, move tags as needed and start over from the fresh
105 checkouts. Do not append to tarballs, as this has produced
106 non-standards-conforming tarballs in the past.
107
108 [TODO: collation of a list of deprecated commands. Possibly can be scripted
109 to extract from vtysh/vtysh_cmd.c]
110
111 TOOL VERSIONS
112
113 Require versions of support tools are listed in INSTALL.quagga.txt.
114 Required versions should only be done with due deliberation, as it can
115 cause environments to no longer be able to compile quagga.
116
117 SHARED LIBRARY VERSIONING
118
119 [this section is at the moment just gdt's opinion]
120
121 Quagga builds several shared libaries (lib/libzebra, ospfd/libospf,
122 ospfclient/libsopfapiclient). These may be used by external programs,
123 e.g. a new routing protocol that works with the zebra daemon, or
124 ospfapi clients. The libtool info pages (node Versioning) explain
125 when major and minor version numbers should be changed. These values
126 are set in Makefile.am near the definition of the library. If you
127 make a change that requires changing the shared library version,
128 please update Makefile.am.
129
130 libospf exports far more than it should, and is needed by ospfapi
131 clients. Only bump libospf for changes to functions for which it is
132 reasonable for a user of ospfapi to call, and please err on the side
133 of not bumping.
134
135 There is no support intended for installing part of zebra. The core
136 library libzebra and the included daemons should always be built and
137 installed together.
138
139 PATCH SUBMISSION
140
141 * Send a clean diff against the head of CVS in unified diff format, eg by:
142 cvs <cvs opts> diff -upwb ....
143
144 * Include ChangeLog and NEWS entries as appropriate before the patch
145 (or in it if you are 100% up to date). A good ChangeLog makes it easier to
146 review a patch, hence failure to include a good ChangeLog is prejudicial
147 to proper review of the patch, and hence the possibility of inclusion.
148
149 * Include only one semantic change or group of changes per patch.
150
151 * Do not make gratuitous changes to whitespace. See the w and b arguments
152 to diff.
153
154 * State on which platforms and with what daemons the patch has been
155 tested. Understand that if the set of testing locations is small,
156 and the patch might have unforeseen or hard to fix consequences that
157 there may be a call for testers on quagga-dev, and that the patch
158 may be blocked until test results appear.
159
160 If there are no users for a platform on quagga-dev who are able and
161 willing to verify -current occasionally, that platform may be
162 dropped from the "should be checked" list.
163
164 PATCH APPLICATION TO CVS
165
166 * Only apply patches that meet the submission guidelines.
167
168 * If a patch is large (perhaps more than 100 new/changed lines), tag
169 the repository before and after the change with e.g. before-foo-fix
170 and after-foo-fix.
171
172 * If the patch might break something, issue a call for testing on the
173 mailinglist.
174
175 * Give an appropriate commit message, eg the ChangeLog entry should suffice,
176 if it does not, then the ChangeLog entry itself needs to be corrected. The
177 commit message text should be identical to that added to the ChangeLog
178 message. (One suggestion: when commiting, use your editor to read in the
179 ChangeLog and delete all previous ChangeLogs.)
180
181 * By committing a patch, you are responsible for fixing problems
182 resulting from it (or backing it out).
183
184 STABLE PLATFORMS AND DAEMONS
185
186 The list of platforms that should be tested follow. This is a list
187 derived from what quagga is thought to run on and for which
188 maintainers can test or there are people on quagga-dev who are able
189 and willing to verify that -current does or does not work correctly.
190
191 BSD (Free, Net or Open, any platform) # without capabilities
192 GNU/Linux (any distribution, i386)
193 Solaris (strict alignment, any platform)
194 [future: NetBSD/sparc64]
195
196 The list of daemons that are thought to be stable and that should be
197 tested are:
198
199 zebra
200 bgpd
201 ripd
202 ospfd
203 ripngd
204
205 Daemons which are in a testing phase are
206
207 ospf6d
208 isisd
209 watchquagga
210
211 IMPORT OR UPDATE VENDOR SPECIFIC ROUTING PROTOCOLS
212
213 The source code of Quagga is based on two vendors:
214
215 zebra_org (http://www.zebra.org/)
216 isisd_sf (http://isisd.sf.net/)
217
218 [20041105: Is isisd.sf.netf still where isisd word is happening, or is
219 the quagga repo now the canonical place? The last tarball on sf is
220 two years old. --gdt]
221
222 In order to import source code, the following procedure should be used:
223
224 * Tag the Current Quagga CVS repository:
225
226 cvs tag import_isisd_sf_20031223
227
228 * Import the source code into the Quagga's framework. You must not modified
229 this source code. It will be merged later.
230
231 cd dir_isisd
232 export CVSROOT=:pserver:LOGIN@anoncvs.quagga.net:/var/cvsroot
233 cvs import quagga/isisd isisd_sf isisd_sf_20031223
234 ---COMMENTS---
235 Vendor: [isisd_sf] Sampo's ISISd from Sourceforge
236 Tag: [isisd_sf_20031217] Current CVS release
237 ---
238
239 * Update your Quagga's directory:
240
241 cd dir_quagga
242 cvs update -dP
243
244 or
245
246 cvs co -d quagga_isisd quagga
247
248 * Merge the code, then commit:
249
250 cvs commit
251