Perl-Repository-APC

 view release on metacpan or  search on metacpan

scripts/perlpatch2svn  view on Meta::CPAN

#!/usr/bin/perl -- -*- cperl-indent-level: 4 -*- vi:nowrap:


#line 4

=head1 NAME

perlpatch2svn - Import bleadperl patches into a Subversion repository

=head1 SYNOPSIS

    perlpatch2svn [-f] [patchfiles...]

=head1 *** DEPRECATED ***

This script is currently not maintained. It seems like an inferior
approach to what svk and VCP.pm are going to provide. The script is
kept in the distribution because it contains a lot of interesting and
helpful code for people interested in getting *something* going.

=head1 DESCRIPTION

This program reads a list of patches applied to the bleadperl source
trunk or a branch and applies them to a local Subversion repository.

The patches can be retrieved via the perl5-changes mailing list, or from one of
the URLs documented in perlhack(3). Alternatively, if you have access to the
bleadperl Perforce repository, they can be created with Andreas Koenig's
p4genpatch utility.

You must run this program from the root of source tree in the subversion
working copy you want to update. The patchfiles can be given on the
command-line; if not, perlpatch2svn reads patches from the standard input.

perlpatch2svn will skip the patches that have been already applied. To do this,
he scans the changelog of the Subversion working copy for the last Perforce
patch number. This means that you should apply patches from Perforce in order.
The -f (force) option disables this behavior.

=head2 Create the Subversion repository

See apc2svn. The following description predates apc2svn and is only
left here to explain the principle.

Here's the list of commands I used to create a Subversion repository with perl
5.8.0 in it :

    $ cd /home/rafael
    $ tar zxf perl-5.8.0.tar.gz
    $ svnadmin create bleadperl-svn
    $ svn import file:///home/rafael/bleadperl-svn perl-5.8.0 perl \
	-m 'Import Perl 5.8.0'
    $ svn co file:///home/rafael/bleadperl-svn/perl bleadperl-wc
    $ cd bleadperl-wc

Then, I set the property C<svn:eol-type> to C<native> on files that contain
CRLF line endings : (warning, shell hackery involved -- ^M is a real ctrl-M
character)

    $ svn propset svn:eol-style native `grep -rl '^M' * | fgrep -v .svn`
    $ svn commit -m 'Force CRLF files as LF'

This previous command marks the said files as being always checked out with
the line endings native to the current platform. On Unices, they will thus
have LF line endings. This is necessary for patches to be applied to them.
CRLF line endings must be restored when a source tarball is to be released
(see Porting/makerel in the perl source distribution).

And then, to import the patches :

    $ zcat /path/to/bleadperl-patches/* | perlpatch2svn

=head1 BINARY FILES

During the course of the perforce repository evolution a number of
files have been checked in that were marked as binary for some reason
and therefore are not available via the patch set. perlpatch2svn
corrects that by including all those files within itself and checking
them into subversion. Whenever it does so, it sends a message to
STDERR saying something like

    Info: inserting our own //depot/perl/lib/Bundle/CPAN.pm#1

=head1 BUGS

As of bleadperl @18039, you can't build perl from within your Subversion
working copy, because the installation process of perl corrupts it, by
creating spurious C<.svn> directories.

Similarly, C<make distclean> removes too much files, including a few files
in the C<.svn> directories, thus corrupting the working copy.

Until MakeMaker is fixed, a workaround, if your system supports it, is to
build outside the source tree, via the C<-Dmksymlinks> Configure option.

=head1 AUTHOR

Written by Rafael Garcia-Suarez and Andreas Koenig.

This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.

C<$Id: perlpatch2svn 135 2005-06-23 08:13:30Z k $>

=head1 SEE ALSO

perlhack(3), svn(1), and Porting/p4genpatch in the perl source distribution.

=cut

use strict;
use warnings;

use Getopt::Long;
use File::Basename;
use File::Temp;
use IPC::Open3 qw(open3);

use Perl::Repository::APC2SVN qw(latest_change get_dirs_to_add
get_dirs_to_delete delete_empty_dirs);



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