Next: , Previous: Distribution tar Files, Up: Distributions


9.2 Distribution Patches

If the program is large, it is useful to make a set of diffs for each release, against the previous important release.

At the front of the set of diffs, put a short explanation of which version this is for and which previous version it is relative to. Also explain what else people need to do to update the sources properly (for example, delete or rename certain files before installing the diffs).

The purpose of having diffs is that they are small. To keep them small, exclude files that the user can easily update. For example, exclude info files, DVI files, tags tables, output files of Bison or Flex. In Emacs diffs, we exclude compiled Lisp files, leaving it up to the installer to recompile the patched sources.

When you make the diffs, each version should be in a directory suitably named—for example, gcc-2.3.2 and gcc-2.3.3. This way, it will be very clear from the diffs themselves which version is which.

If you use GNU diff to make the patch, use the options ‘-rc2P’. That will put any new files into the output as “entirely different.” Also, the patch's context diff headers should have dates and times in Universal Time using traditional Unix format, so that patch recipients can use GNU patch's ‘-Z’ option. For example, you could use the following Bourne shell command to create the patch:

     LC_ALL=C TZ=UTC0 diff -rc2P gcc-2.3.2 gcc-2.3.3 | \
     gzip -9 >gcc-2.3.2-2.3.3.patch.gz

If the distribution has subdirectories in it, then the diffs probably include some files in the subdirectories. To help users install such patches reliably, give them precise directions for how to run patch. For example, say this:

     To apply these patches, cd to the main directory of the program
     and then use `patch -p1'.   `-p1' avoids guesswork in choosing
     which subdirectory to find each file in.

It's wise to test your patch by applying it to a copy of the old version, and checking that the result exactly matches the new version.