]> diplodocus.org Git - nmh/blob - docs/README.developers
Simplified m_strn() per Ralph's suggestions.
[nmh] / docs / README.developers
1 #
2 # README.developers
3 #
4
5 This file is intended to provide a few tips for anyone doing development on nmh.
6 Developers who learn things "the hard way" about the nmh codebase (as opposed to
7 local info best encoded in a comment) are encouraged to share their wisdom here.
8
9 Following a commit checklist, the topics are organized alphabetically.
10
11
12 ----------------
13 commit checklist
14 ----------------
15
16 1. code updated?
17 2. test added?
18 3. make distcheck passed?
19 4. man page and other documentation updated?
20 5. docs/pending-release-notes updated?
21 6. should commit message reference bug report?
22 7. update/close bug report (with commit id)?
23 8. notify nmh-users?
24
25 A buildbot at http://orthanc.ca:8010/waterfall polls for new commits and
26 builds them on a few platforms. Keep an eye on its progress in case
27 you've committed something non-portable. (If you can provide another
28 platform, contact the nmh-workers list.)
29
30
31 ---------------------------------
32 C library/system call usage notes
33 ---------------------------------
34
35 * Use m_mktemp2() or m_mktemp() instead of mkstemp(3) (see section on
36 nmh temporary files below).
37 * Use m_unlink() instead of unlink(3).
38 * Use done() instead of _exit(3) except after a fork(3).
39
40
41 -------------------------
42 autoconf & automake files
43 -------------------------
44
45 If you wish to change the `configure' script, the generated Makefile
46 or other related files, you'll need to first install GNU m4, available
47 from <ftp://ftp.gnu.org/pub/gnu/m4/>, then GNU autoconf
48 (<ftp://ftp.gnu.org/pub/gnu/autoconf/>) and GNU automake
49 (<ftp://ftp.gnu.org/pub/gnu/automake/>). Nmh is currently using a
50 minimum of autoconf 2.68 and automake 1.12.
51
52 Most of the configure-related files are automatically generated.
53 The only files you should need to manually edit are configure.ac
54 and any autoconf macros in the m4 directory. Don't, for instance,
55 edit config.h.in. Though it is an input file from the point of
56 view of the users (and the configure script) it is an output file
57 from the point of view of the developers (and the autoconf script).
58
59 If you wish to add a new autoconf macro, it should be placed in it's
60 own file and put in the m4 directory; aclocal will automatically pick
61 it up and automake will add it to the distribution target automatically.
62
63 If you wish to make changes to the Makefile, you will need to edit
64 Makefile.am. See the automake documentation if you need further help.
65 You should always check changes to Makefile.am by using "make distcheck".
66
67 Note that the automatically generated autotools files (such as config.h.in,
68 Makefile.in, and configure), are NOT kept in git. Thus, when you check out
69 a git tree, you need to run the autogen.sh script before you can build
70 anything:
71
72 % ./autogen.sh
73
74
75 -------------------
76 directory structure
77 -------------------
78
79 Following is a list of nmh's directories along with a brief description of the
80 purpose of each one. Meanings are given for the abbreviations, but note that
81 these meanings are just informed guesses as to what the MH developers were
82 thinking.
83
84 ./
85 The top-level directory. Contains files like README and INSTALL.
86
87 config/
88 Contains utility files for the `configure' process. Ordinarily nothing in
89 here needs to be messed with.
90
91 docs/
92 Contains more specialized documentation, such as this file and
93 the FAQ.
94
95 etc/
96 Contains files, file templates, and scripts to generate files that will be
97 installed in the ${prefix}/etc directory. Stuff like replcomps.
98
99 h/
100 Most of nmh's header (.h) files are kept not in the individual source
101 directories, but in this central location.
102
103 man/
104 Contains all the input files that are processed to generate nmh's manual
105 pages.
106
107 mts/
108 "mts" stands for "Message Transfer Service". Source files specific to the
109 different MTSs go in the subdirectories.
110
111 mts/smtp/
112 When nmh is configured to just talk to an SMTP server over TCP/IP, the
113 source in this directory is compiled.
114
115 sbr/
116 "sbr" stands for "subroutine(s)". For the most part, each source file in
117 this directory contains a single function with the same name as the source
118 file. These functions are of general use and are called from throughout
119 nmh.
120
121 SPECS/
122 Contains files such as RPM specs.
123
124 test/
125 The num unit test suite.
126
127 tools/
128 "tools" contains tools, scripts, and supporting files used by the
129 developers while writing, debugging, and testing the code.
130
131 uip/
132 "uip" stands for "User Interface Programs". Most nmh commands have a file
133 in this directory named <command>.c containing the code for that command
134 (e.g. repl.c). In some cases there is also an auxiliary file called
135 <command>sbr.c which contains additional subroutines called from <command>.c
136 (which would contain not much else besides main()).
137
138
139 ---
140 git
141 ---
142
143 As of December 2010, nmh has switched to using git for revision control
144 instead of CVS. While the topic of git is beyond the scope of this FAQ,
145 to get started with git & nmh, you can run the following command to checkout
146 the nmh repository (with read-only access to it):
147
148 % git clone git://git.savannah.nongnu.org/nmh.git
149
150 That will create a workspace called nmh. To update that workspace
151 with changes to the master, cd to it and run:
152
153 % git pull
154
155 If you are a project member and want write access to the repository,
156 you'll have to checkout with the following command instead of the one
157 above:
158
159 % git clone <username>@git.sv.nongnu.org:/srv/git/nmh.git
160
161 We suggest using git pull --rebase instead of the default merge for
162 git pull. If you don't want to add the --rebase option every time,
163 you can tell git pull to always rebase in your nmh workspace by
164 cd'ing to it and running the following command:
165
166 % git config --bool branch.master.rebase true
167
168 And you'll probably want the following, also, so that --rebase applies
169 to any new branches that you create:
170
171 % git config branch.autosetuprebase always
172
173
174 -------------------------------------------------------
175 nmh-local functions to use in preference to OS versions
176 -------------------------------------------------------
177
178 For some system functions whose availability or behavior varies from OS to OS,
179 nmh conditionally uses a local definition with the same name as the OS function
180 (e.g. snprintf()). For other functions, developers need to avoid the OS
181 versions and always use the nmh-supplied function. Here is a list of such
182 functions:
183
184 OS function nmh-local version to use instead
185 =========== ================================
186 getpass() nmh_getpass()
187
188
189 -------------------
190 nmh temporary files
191 -------------------
192
193 To create a temporary file, use m_mktemp2() or m_mktemp(). They use
194 mkstemp(3), but they also register the temporary file for removal on
195 program termination. So, do not use mkstemp() directly.
196
197 To further support this, nmh_init() must be called at the beginning of
198 main(). And, if a child process is not going to immediately call one
199 of the exec(3) functions or _exit(3) after a fork(3), it should call
200 unregister_for_removal(0). Finally, nmh_init() sets up signal handlers
201 for several signals: these signal handlers should not be disabled.
202
203
204 --------------
205 nmh test suite
206 --------------
207
208 The nmh test suite is run through the Makefile, with "make check"
209 or "make distcheck".
210
211 In the nmh test suite, nmh programs to be tested should be invoked
212 through the run_test or run_prog shell functions defined in
213 test/common.sh.
214
215 Instead of echoing test progress, use start_test()/finish_test()
216 from tests/common.sh. These will report the particular test name,
217 within the test, only if there is a failure.
218
219 To enable the use of valgrind, where available, set the environment
220 variable NMH_VALGRIND to a non-null value. However, a separate
221 environment variable, VALGRIND_ME, triggers the use of valgrind in
222 test/inc/test-eom-align because it greatly extends the duration of
223 that test.
224
225 If valgrind complains about "serious error when reading debuginfo"
226 from a library, either update or remove the debuginfo package for
227 the offending library.
228
229
230 -------------
231 releasing nmh
232 -------------
233
234 To make a public release of nmh (we'll use version 1.5 as the example
235 here; the convention for release candidates is to use something like
236 "1.5-RC1"):
237
238 1. Create a release branch. The convention is to name release branches
239 with the name "<version>-release".
240
241 % git branch 1.5-release
242
243 Note you are still on the master branch at this point. Mark the
244 current revision as the branchpoint for the new release branch:
245
246 % git tag -a -m "This tag marks the point where we started the branch for 1.5" 1.5-branchpoint
247
248 Now mark the master branch with a post-release version number (the
249 convention here is to use VERSION+dev as the version number).
250
251 % echo 1.5+dev > VERSION
252 % git commit VERSION
253 % git push
254 % git push --tags
255
256 Then do:
257
258 % git checkout 1.5-release
259
260 You are now on the 1.5 release branch.
261
262 2. % echo 1.5 > VERSION
263 % date +"%e %B %Y" > DATE
264 (DATE should contain something like "30 December 2000")
265
266 3. % git commit VERSION DATE; git push
267
268 4. % git tag -a 1.5 -m 'Releasing nmh-1.5.'
269 % git push --tags
270
271 Note that the new convention for tagging is to simply tag with the
272 version number (tag formats in the past have varied).
273
274 5. % make distcheck
275
276 If you want to check the distribution build with some particular
277 configure options, set the DISTCHECK_CONFIGURE_FLAGS variable.
278 E.g.:
279
280 % make distcheck DISTCHECK_CONFIGURE_FLAGS=--with-cyrus-sasl
281
282 6. Upload the distribution file to savannah. You can automate this process
283 by doing:
284
285 % make upload SAVANNAH_USERNAME=username
286
287 This will automatically call gpg to sign the release. You can bypass
288 this step by setting the SKIP_GPG_SIG variable.
289
290 7. Update the http://www.nongnu.org/nmh/ homepage. (It lives in the CVS
291 'webpages repository'; see https://savannah.nongnu.org/cvs/?group=nmh)
292
293 8. Add a news item to the savannah nmh page. You'll have to submit it first
294 and then separately approve it (under News->Manage).
295
296 9. Send the release announcement email to the following places:
297 nmh-workers@nongnu.org
298 nmh-announce@nongnu.org
299 exmh-users@redhat.com
300 exmh-workers@redhat.com
301 mh-e-users@lists.sourceforge.net
302
303 If the release fixes significant security holes, also send an announcement
304 to bugtraq@securityfocus.com. The exmh lists require you to be subscribed
305 in order to post. Note that you don't need to post separately to
306 comp.mail.mh, as the mh-users mailing list is apparently bidirectionally
307 gatewayed to it.
308
309 Preferably, the announcement should contain the MD5 hash generated above,
310 and should be PGP-signed. It should include the URL for the tarball as
311 well as the URL of the website. It should contain a brief summary of
312 visible changes, as well as the URL of the git diff page that would show
313 a detailed list of changes. The changes between 1.5 and 1.4 would be
314 shown by [this is just a guess, I don't know anything about cgit, and
315 it assumes that we tag with nmh-x_x-release from now on]:
316
317 http://git.savannah.gnu.org/cgit/nmh.git/diff/?h=nmh-1_5-release?h=nmh-1_4-release
318
319
320 ---------------
321 after a release
322 ---------------
323
324 Keep an eye on Debian's packaging, especially what patches they have to
325 apply, and the results of their Lintian checker, which even includes
326 spelling errors in man pages and binaries.
327
328 https://sources.debian.net/src/nmh/1.6-16/debian/patches/
329 https://lintian.debian.org/full/az@debian.org.html#nmh
330
331 Perhaps some nmh developer that uses Debian, or Ubuntu?, could provide
332 package-building commands, including lintian(1), for Makefile.am so
333 Lintian's complaints are known before release.