|
NAMEmakepatch - create script to update a source treeSYNOPSISmakepatch [ options ] old-src new-srcIntroductionTraditionally, source trees are updated with the patch program, processing patch information that is generated by the diff program. Although diff and patch do a very good job at patching file contents, most versions do not handle creating and deleting files and directories, and adjusting of file modes and time stamps. Newer versions of diff and patch seem to be able to create files, and very new versions of patch can remove files. But that's about it.Another typical problem is that patch kits are typically downloaded from the Internet, or transmitted via electronic mail. It is often desirable to verify the correctness of a patch kit before even attempting to apply it. The makepatch package is designed to overcome these limitations. DESCRIPTIONThe makepatch package contains two Perl programs: makepatch and applypatch.makepatch will generate a patch kit from two source trees. It traverses the source directory and runs a diff on each pair of corresponding files, accumulating the output into a patch kit. It knows about the conventions for patch kits: if a file named "patchlevel.h" exists, it is handled first, so patch can check the version of the source tree. Also, to deal with the non-perfect versions of patch that are in use, it supplies ""Index:"" and ""Prereq:"" lines, so patch can correctly locate the files to patch, and it relocates the patch to the current directory to avoid problems with creating new files. The list of files can be specified in a so called MANIFEST file, but it can also be generated by recursively traversing the source tree. Files can be excluded using shell style wildcards and Perl regex patterns. But that is not it! makepatch also inserts some additional information in the patch kit for use by the applypatch program. It is important to emphasize that the generated patch kit is still valid input for patch. When used with patch, there are no verifications and problems may arise when new files need to be created. makepatch prepends a small shell script in front of the patch kit that creates the necessary files and directories for the patch process. If you can not run applypatch for some reason, you can run the patch kit as a shell script to prepare the source directory for the patching process. The applypatch program will do the following:
Note that applypatch only requires the patch program. It does not rely on a shell or shell tools. This makes it possible to apply patches on non-Unix systems. General usageSuppose you have an archive `"pkg-1.6.tar.gz"' containing the sources for package `"pkg"' version 1.6, and a directory tree `"pkg-1.7"' containing the sources for version 1.7. The following command will generate a patch kit that updates the 1.6 sources into their 1.7 versions:makepatch pkg-1.6.tar.gz pkg-1.7 > pkg-1.6-1.7.patch To apply this script, go to the directory containing the 1.6 sources and feed the script to applypatch: cd old/pkg-1.6 applypatch pkg-1.6-1.7.patch applypatch will verify that it is executing in the right place and make all necessary updates. By default, makepatch will provide a few lines of progress information, for example: Extracting pkg-1.6.tar.gz to /tmp/mp21575.d/old... Manifest MANIFEST for pkg-1.6 contains 1083 files. Manifest MANIFEST for pkg-1.7 contains 1292 files. Processing the filelists ... Collecting patches ... 266 files need to be patched. 216 files and 8 directories need to be created. 7 files need to be removed. applypatch will provide no feedback information by default. Makepatch argumentsmakepatch requires two arguments: old_src and new_src.
The patch script generated by makepatch will take care of creating new files and directories, update existing files, and remove files and directories that are no longer present in the new-src directory. MANIFEST filesThe purpose of a manifest file is to provide the list of files that constitute a package. Manifest files are traditionally called ""MANIFEST"" and reside in the top level directory of the package.Although there is no formal standard for the contents of manifest files, makepatch uses the following rules:
Default treatmentBy default, makepatch looks for files named ""MANIFEST"" in the top level directories of the old and the new source trees. If these files (or one of them) are found, they are used. If no manifest file could be found, the package is assumed to consist of all files in the directory.The default name of the default manifest file can be modified with the command line option ""-automanifest"", see Section "Command line options". Explicitly naming of manifest filesCommand line options ""-oldmanifest"" and ""-newmanifest"" can be used to explicitly designate old and new manifest files. Option ""-manifest"" is a short way to set one manifest file for both the old and new source trees.Suppress manifest file processingCommand line option ""-nomanifest"" can be used to suppress all manifest file processing. The package is assumed to consist of all files in the source directories.Makepatch optionsmakepatch takes several options to control its behaviour. Options are usually specified on the command line, but makepatch can take options from three sources in the following order:
Command line optionsOptions are matched case insensitive, and may be abbreviated to uniqueness.
Standard Exclude PatternsThe following file patterns are always excluded:*~ *.a *.bak *.BAK *.elc *.exe *.gz *.ln *.o *.obj *.olb *.old *.orig *.rej *.so *.Z .del-* .make.state .nse_depinfo core tags TAGS Option -exclude-sccs adds: p.* s.* SCCS Option -exclude-rcs adds: ,* *,v RCS RCSLOG Option -exclude-cvs adds ".cvsignore" patterns, and: .#* #* _$* *$ CVS CVS.adm cvslog.* Please let me know if I missed some. Environment variables
ExamplesSuppose you have a directory tree `"pkg-1.6"' containing the sources for package `"pkg"' version 1.6, and a directory tree `"pkg-1.7"' containing the sources for version 1.7. The following command will generate a patch kit that updates the 1.6 sources into their 1.7 versions:makepatch pkg-1.6 pkg-1.7 > pkg-1.6-1.7.patch To apply this script, go to the pkg-1.6 directory and feed the script to applypatch: cd old/pkg-1.6 applypatch pkg-1.6-1.7.patch applypatch will verify that it is executing in the right place and make all necessary updates. This is one way to generate and use manifest files: (cd pkg-1.6; find . -type f -print > OLDMANIFEST) (cd pkg-1.7; find . -type f -print > NEWMANIFEST) makepatch \ -oldmanifest pkg-1.6/OLDMANIFEST \ -newmanifest pkg-1.7/NEWMANIFEST \ pkg-1.6 pkg-1.7 > pkg-1.6-1.7.diff Bugs and restrictionsMuch of the job of makepatch is processing file names. makepatch has been tested extensively on Unix systems, but it is not guaranteed to work on other systems.applypatch is repeatedly reported to correctly process makepatch generated patch kits on modern 32-bit Windows systems as well. makepatch does not know about symbolic links. These will be treated like plain files. Wrong results can be generated if the file lists that are used or generated use different path separators. SEE ALSOapplypatch(1), diff(1), patch(1), perl(1), rm(1).AUTHOR AND CREDITSJohan Vromans (jvromans@squirrel.nl) wrote the program, with a little help and inspiration from: Jeffery Small, Ulrich Pfeifer, Nigel Metheringham, Julian Yip, Tim Bunce, Gurusamy Sarathy, Hugo van der Sanden, Rob Browning, Joshua Pritikin, and others.COPYRIGHT AND DISCLAIMERThis program is Copyright 1992,2004,2006 by Squirrel Consultancy. All rights reserved.This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" which comes with Perl. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.
Visit the GSP FreeBSD Man Page Interface. |