gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 1 | -*- mode: text; -*- |
paul | 208f0b7 | 2005-04-05 10:10:06 +0000 | [diff] [blame^] | 2 | $Id: HACKING,v 1.17 2005/04/05 10:10:06 paul Exp $ |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 3 | |
| 4 | GUIDELINES FOR HACKING ON QUAGGA |
| 5 | |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 6 | [this is a draft in progress] |
| 7 | |
hasso | 863076d | 2004-09-01 20:13:23 +0000 | [diff] [blame] | 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 |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 26 | |
gdt | 2934f28 | 2004-01-05 20:09:00 +0000 | [diff] [blame] | 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 | |
gdt | 697877e | 2004-11-15 19:23:47 +0000 | [diff] [blame] | 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 | |
ajs | 5e76477 | 2004-12-03 19:03:33 +0000 | [diff] [blame] | 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 | |
gdt | 2934f28 | 2004-01-05 20:09:00 +0000 | [diff] [blame] | 48 | CHANGELOG |
| 49 | |
| 50 | Add a ChangeLog entry whenever changing code, except for minor fixes |
| 51 | to a commit (with a ChangeLog entry) within the last few days. |
| 52 | |
gdt | 18323bb | 2004-11-05 13:17:20 +0000 | [diff] [blame] | 53 | Most directories have a ChangeLog file; changes to code in that |
| 54 | directory should go in the per-directory ChangeLog. Global or |
| 55 | structural changes should also be mentioned in the top-level |
| 56 | ChangeLog. |
gdt | 2934f28 | 2004-01-05 20:09:00 +0000 | [diff] [blame] | 57 | |
paul | 1f8f61a | 2004-11-05 23:38:20 +0000 | [diff] [blame] | 58 | Certain directories do not contain project code, but contain project |
| 59 | meta-data, eg packaging information, changes to files in these directory may |
| 60 | not require the global ChangeLog to be updated (at the discretion of the |
| 61 | maintainer who usually maintains that meta-data). Also, CVS meta-data such |
| 62 | as cvsignore files do not require ChangeLog updates, just a sane commit |
| 63 | message. |
| 64 | |
gdt | 0d7e913 | 2005-02-23 16:20:07 +0000 | [diff] [blame] | 65 | RELEASE PROCEDURE |
| 66 | |
| 67 | Tag the repository with release tag (follow existing conventions). |
| 68 | [This enables recreating the release, and is just good CM practice.] |
| 69 | |
| 70 | Check out the tag, and do a test build. |
| 71 | |
| 72 | In an empty directory, do a fresh checkout with -r <release-tag> |
| 73 | [This makes the dates in the tarball be the modified dates in CVS.] |
| 74 | |
gdt | 0d7e913 | 2005-02-23 16:20:07 +0000 | [diff] [blame] | 75 | ./configure |
| 76 | make dist |
| 77 | |
| 78 | If any errors occur, move tags as needed and start over from the fresh |
| 79 | checkouts. Do not append to tarballs, as this has produced |
| 80 | non-standards-conforming tarballs in the past. |
| 81 | |
gdt | fbb6709 | 2004-11-15 17:29:11 +0000 | [diff] [blame] | 82 | TOOL VERSIONS |
| 83 | |
| 84 | Require versions of support tools are listed in INSTALL.quagga.txt. |
| 85 | Required versions should only be done with due deliberation, as it can |
| 86 | cause environments to no longer be able to compile quagga. |
| 87 | |
gdt | b7a97f8 | 2004-07-23 16:23:56 +0000 | [diff] [blame] | 88 | SHARED LIBRARY VERSIONING |
| 89 | |
| 90 | [this section is at the moment just gdt's opinion] |
| 91 | |
| 92 | Quagga builds several shared libaries (lib/libzebra, ospfd/libospf, |
| 93 | ospfclient/libsopfapiclient). These may be used by external programs, |
| 94 | e.g. a new routing protocol that works with the zebra daemon, or |
| 95 | ospfapi clients. The libtool info pages (node Versioning) explain |
| 96 | when major and minor version numbers should be changed. These values |
| 97 | are set in Makefile.am near the definition of the library. If you |
| 98 | make a change that requires changing the shared library version, |
| 99 | please update Makefile.am. |
| 100 | |
| 101 | libospf exports far more than it should, and is needed by ospfapi |
| 102 | clients. Only bump libospf for changes to functions for which it is |
| 103 | reasonable for a user of ospfapi to call, and please err on the side |
| 104 | of not bumping. |
| 105 | |
| 106 | There is no support intended for installing part of zebra. The core |
| 107 | library libzebra and the included daemons should always be built and |
| 108 | installed together. |
| 109 | |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 110 | PATCH SUBMISSION |
| 111 | |
paul | 85cf0a0 | 2004-01-09 16:34:54 +0000 | [diff] [blame] | 112 | * Send a clean diff against the head of CVS in unified diff format, eg by: |
hasso | e69b9e4 | 2005-02-23 11:54:12 +0000 | [diff] [blame] | 113 | cvs <cvs opts> diff -upwb .... |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 114 | |
| 115 | * Include ChangeLog and NEWS entries as appropriate before the patch |
| 116 | (or in it if you are 100% up to date). |
| 117 | |
gdt | 18323bb | 2004-11-05 13:17:20 +0000 | [diff] [blame] | 118 | * Include only one semantic change or group of changes per patch. |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 119 | |
paul | 85cf0a0 | 2004-01-09 16:34:54 +0000 | [diff] [blame] | 120 | * Do not make gratuitous changes to whitespace. See the w and b arguments |
| 121 | to diff. |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 122 | |
| 123 | * State on which platforms and with what daemons the patch has been |
| 124 | tested. Understand that if the set of testing locations is small, |
| 125 | and the patch might have unforeseen or hard to fix consequences that |
| 126 | there may be a call for testers on quagga-dev, and that the patch |
| 127 | may be blocked until test results appear. |
| 128 | |
| 129 | If there are no users for a platform on quagga-dev who are able and |
| 130 | willing to verify -current occasionally, that platform may be |
| 131 | dropped from the "should be checked" list. |
| 132 | |
| 133 | PATCH APPLICATION TO CVS |
| 134 | |
| 135 | * Only apply patches that meet the submission guidelines. |
| 136 | |
| 137 | * If a patch is large (perhaps more than 100 new/changed lines), tag |
| 138 | the repository before and after the change with e.g. before-foo-fix |
| 139 | and after-foo-fix. |
| 140 | |
| 141 | * If the patch might break something, issue a call for testing on the |
| 142 | mailinglist. |
| 143 | |
paul | 4134ceb | 2004-05-13 13:38:06 +0000 | [diff] [blame] | 144 | * Give an appropriate commit message, eg the ChangeLog entry should suffice, |
paul | 1f8f61a | 2004-11-05 23:38:20 +0000 | [diff] [blame] | 145 | if it does not, then the ChangeLog entry itself needs to be corrected. The |
| 146 | commit message text should be identical to that added to the ChangeLog |
| 147 | message. (One suggestion: when commiting, use your editor to read in the |
| 148 | ChangeLog and delete all previous ChangeLogs.) |
paul | 4134ceb | 2004-05-13 13:38:06 +0000 | [diff] [blame] | 149 | |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 150 | * By committing a patch, you are responsible for fixing problems |
| 151 | resulting from it (or backing it out). |
| 152 | |
| 153 | STABLE PLATFORMS AND DAEMONS |
| 154 | |
| 155 | The list of platforms that should be tested follow. This is a list |
| 156 | derived from what quagga is thought to run on and for which |
| 157 | maintainers can test or there are people on quagga-dev who are able |
| 158 | and willing to verify that -current does or does not work correctly. |
| 159 | |
| 160 | BSD (Free, Net or Open, any platform) # without capabilities |
| 161 | GNU/Linux (any distribution, i386) |
paul | 1f8f61a | 2004-11-05 23:38:20 +0000 | [diff] [blame] | 162 | Solaris (strict alignment, any platform) |
gdt | 18323bb | 2004-11-05 13:17:20 +0000 | [diff] [blame] | 163 | [future: NetBSD/sparc64] |
gdt | d9fd04c | 2003-12-19 19:20:25 +0000 | [diff] [blame] | 164 | |
| 165 | The list of daemons that are thought to be stable and that should be |
| 166 | tested are: |
| 167 | |
| 168 | zebra |
| 169 | bgpd |
| 170 | ripd |
| 171 | ospfd |
| 172 | ripngd |
gdt | 1f431d2 | 2003-12-22 15:45:01 +0000 | [diff] [blame] | 173 | |
gdt | 18323bb | 2004-11-05 13:17:20 +0000 | [diff] [blame] | 174 | Daemons which are in a testing phase are |
| 175 | |
| 176 | ospf6d |
| 177 | isisd |
ajs | 8035e9f | 2004-12-22 03:16:59 +0000 | [diff] [blame] | 178 | watchquagga |
gdt | 18323bb | 2004-11-05 13:17:20 +0000 | [diff] [blame] | 179 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 180 | IMPORT OR UPDATE VENDOR SPECIFIC ROUTING PROTOCOLS |
| 181 | |
| 182 | The source code of Quagga is based on two vendors: |
| 183 | |
| 184 | zebra_org (http://www.zebra.org/) |
| 185 | isisd_sf (http://isisd.sf.net/) |
| 186 | |
gdt | 18323bb | 2004-11-05 13:17:20 +0000 | [diff] [blame] | 187 | [20041105: Is isisd.sf.netf still where isisd word is happening, or is |
| 188 | the quagga repo now the canonical place? The last tarball on sf is |
| 189 | two years old. --gdt] |
| 190 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 191 | In order to import source code, the following procedure should be used: |
| 192 | |
| 193 | * Tag the Current Quagga CVS repository: |
| 194 | |
| 195 | cvs tag import_isisd_sf_20031223 |
| 196 | |
| 197 | * Import the source code into the Quagga's framework. You must not modified |
| 198 | this source code. It will be merged later. |
| 199 | |
| 200 | cd dir_isisd |
| 201 | export CVSROOT=:pserver:LOGIN@anoncvs.quagga.net:/var/cvsroot |
| 202 | cvs import quagga/isisd isisd_sf isisd_sf_20031223 |
| 203 | ---COMMENTS--- |
| 204 | Vendor: [isisd_sf] Sampo's ISISd from Sourceforge |
| 205 | Tag: [isisd_sf_20031217] Current CVS release |
| 206 | --- |
| 207 | |
| 208 | * Update your Quagga's directory: |
| 209 | |
| 210 | cd dir_quagga |
| 211 | cvs update -dP |
| 212 | |
| 213 | or |
| 214 | |
| 215 | cvs co -d quagga_isisd quagga |
| 216 | |
| 217 | * Merge the code, then commit: |
| 218 | |
| 219 | cvs commit |
| 220 | |