Alt-App-makepatch

 view release on metacpan or  search on metacpan

script/makepatch  view on Meta::CPAN

   -exclude-regex pat   exclude files and dirs matching regex pattern
   -exclude-vc          exclude version control files (RCS, CVS, SCCS)
   -exclude-rcs         exclude version control files for RCS
   -exclude-cvs         exclude version control files for CVS
   -exclude-sccs        exclude version control files for SCCS
   -verbose		verbose output (default)
   -quiet		no verbose output
   -help		this message
EoU
    die ("Not okay 99\n") if $opt_test;
    exit $exit if defined $exit && $exit != 0;
}

1;

__END__

################ Documentation ################

=head1 NAME

makepatch - create script to update a source tree

=head1 SYNOPSIS

B<makepatch> [ I<options> ] I<old-src> I<new-src>

=for comment
B<makepatch> B<-filelist> [ I<options> ] I<manifest>

=head1 Introduction

Traditionally, source trees are updated with the B<patch> program,
processing patch information that is generated by the B<diff> program.
Although B<diff> and B<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 B<diff> and B<patch> seem to be able to create files, and
very new versions of B<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 B<makepatch> package is designed to overcome these limitations.

=head1 DESCRIPTION

The B<makepatch> package contains two Perl programs:
B<makepatch> and B<applypatch>.

B<makepatch> will generate a patch kit from two source trees. It
traverses the source directory and runs a B<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
C<patchlevel.h> exists, it is handled first, so B<patch> can check the
version of the source tree. Also, to deal with the non-perfect
versions of B<patch> that are in use, it supplies "C<Index:>" and
"C<Prereq:>" lines, so B<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 B<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! B<makepatch> also inserts some additional
information in the patch kit for use by the B<applypatch> program.

It is important to emphasize that the generated patch kit is still
valid input for B<patch>. When used with B<patch>, there are no
verifications and problems may arise when new files need to be
created. B<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 B<applypatch> for some reason, you
can run the patch kit I<as a shell script> to prepare the source
directory for the patching process.

The B<applypatch> program will do the following:

=over 4

=item *

It will extensively verify that the patch kit is complete and not
corrupted during transfer.

=item *

It will apply some heuristics to verify that the directory in
which the patch will be applied does indeed contain the expected
sources.

=item *

It creates files and directories as necessary.

=item *

It applies the patch by running the B<patch> program.

=item *

Upon completion, obsolete files, directories and C<.orig> files are
removed, file modes of new files are set, and the timestamps of
all patched files are adjusted.

=back 

Note that B<applypatch> only requires the B<patch> program. It does not
rely on a shell or shell tools. This makes it possible to apply
patches on non-Unix systems.

=head1 General usage

Suppose you have an archive `C<pkg-1.6.tar.gz>' containing the sources
for package `C<pkg>' version 1.6, and a directory tree `C<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



( run in 0.576 second using v1.01-cache-2.11-cpan-71847e10f99 )