Author: dagolden Date: Sat Nov 21 04:28:13 2009 New Revision: 13578 Modified: Module-Build/trunk/devtools/patching_blead.pod Module-Build/trunk/inc/ModuleBuildBuilder.pm
Log: automate some of blead patching Modified: Module-Build/trunk/devtools/patching_blead.pod ============================================================================== --- Module-Build/trunk/devtools/patching_blead.pod (original) +++ Module-Build/trunk/devtools/patching_blead.pod Sat Nov 21 04:28:13 2009 @@ -2,7 +2,7 @@ =head2 Prerequisites -These instructions assume you have already cloned the perl git +These instructions assume you have already cloned the perl git repository and have checked out the blead branch. The blead branch should be clean of extraneous files @@ -15,54 +15,37 @@ =head2 Creating a perl branch with changes -Start in the Module-Build directory. This would be the distdir left -behind right after publishing a new release, or could be an unpacked -tarball from CPAN. - - $ cd Module-Build-0.33_02 - -Run the add-packages.pl program from ~/git/perl/Porting to create a -new git branch and copy in Module::Build files. Be sure to exclude -files with the '-e' flag: - - $ perl ~/git/perl/Porting/add-package.pl -v -r ~/git/perl \ - -e 'par\.t|signature\.t' - -There may be prompts about deleting read-only files. These are the excluded -files. (add-packages.pl does a recursive copy, then deletes excluded files -from the destination. Why it does so is a mystery.) Say "yes" to deleting -these files. +Start in the Module-Build source directory. This should *NOT* be the +distdir -- you need the custom Module::Build subclass in inc/. Checkout +a fresh copy from the release tag, e.g.: -Module::Build::ConfigData is created during build, so must be generated and -copied by hand: + $ svn checkout http://svn.perl.org/modules/Module-Build/tags/0.35_09 + $ cd 0.35_09 + +Next, run the "Build.PL" file and then the "patch_blead" action, giving the +git repository directory as an argument: $ perl Build.PL - $ Build - $ cp blib/lib/Module/Build/ConfigData.pm ~/git/perl/lib/Module/Build/ + $ Build patch_blead ~/git/perl =head2 Verifying and editing the branch -After add-packages.pl finishes, ~/git/perl will be on the new branch. Verify +After add-packages.pl finishes, ~/git/perl will be on the a new branch. Verify that and see what changes have been made: $ git branch $ git status -ConfigData.pm will be marked modified, so add it to the index: - - $ git add lib/Module/Build/ConfigData.pm +Examine changes and determine if they should be staged or if an error occurred. -If there are other changes made but not staged, examine them individually and -determine if they should be staged or if an error occurred. - -If any files are being removed, be sure to edit Perl's MANIFEST file and stage -it to be committed. +If any files are being added or removed, be sure to edit Perl's MANIFEST file +and stage it to be committed. $ vim MANIFEST $ git add MANIFEST Next, modify the Module::Build section of Porting/Maintainers.pl to indicate -the distribution file on which the patch is based. Note the version that +the distribution file on which the patch is based. Note the version that is being replaced -- you'll need this later when creating the commit message. Update any other metadata necessary, then add this file to the index. @@ -86,7 +69,7 @@ Bug-fixes: - Fixed tests for bleadperl - + 0.33_01 - Sat Jun 13 20:24:42 EDT 2009 [... rest of Changes ...] @@ -144,7 +127,7 @@ $ git rebase -i origin In the editor, you will have the option to choose how commits are rebased. -Leave the first entry as 'pick' and make all subsequent entries 'squash'. +Leave the first entry as 'pick' and make all subsequent entries 'squash'. After you leave the editor, a new editor window will open and you will have the opportunity to combine all commit messages. Generally, you'll want to keep the initial Changes list and just delete the other commit messages. Modified: Module-Build/trunk/inc/ModuleBuildBuilder.pm ============================================================================== --- Module-Build/trunk/inc/ModuleBuildBuilder.pm (original) +++ Module-Build/trunk/inc/ModuleBuildBuilder.pm Sat Nov 21 04:28:13 2009 @@ -5,10 +5,11 @@ use vars qw(@ISA); @ISA = qw(Module::Build); + sub ACTION_distdir { my $self = shift; $self->SUPER::ACTION_distdir(@_); - + my $build_pl = File::Spec->catfile($self->dist_dir, qw(Build.PL)); my $build_pm = File::Spec->catfile($self->dist_dir, qw(lib Module Build.pm)); my $base_pm = File::Spec->catfile($self->dist_dir, qw(lib Module Build Base.pm)); @@ -41,4 +42,56 @@ 1 while unlink "$file.bak"; } +sub ACTION_patch_blead { + my $self = shift; + my $git_dir = $ARGV[1]; + die "Usage: Build patch_blead <perl-git-directory>\n" + unless $git_dir && -d "$git_dir/.git" && -f "$git_dir/perl.h"; + + $self->depends_on('build'); + + $self->log_info( "Updating $git_dir\n" ); + $self->{properties}{verbose} = 1; + + # create a branch + my $cwd = $self->cwd; + chdir $git_dir; + $self->do_system("git checkout -b " . $self->dist_dir) + or die "Couldn't create git branch" . $self->dist_dir . "\n"; + chdir $cwd; + + # copy files + (my $git_mb_dir = $git_dir) =~ s{/?$}{/cpan/Module-Build}; + my $files; + + $files = $self->rscan_dir('blib/lib'); + for my $file (@$files) { + next unless -f $file; + next if $file =~ /\.svn/; + (my $dest = $file) =~ s{^blib}{$git_mb_dir}; + $self->copy_if_modified(from => $file, to => $dest); + } + + $files = $self->rscan_dir('blib/script'); + for my $file (@$files) { + next unless -f $file; + next if $file =~ /\.svn/; + (my $dest = $file) =~ s{^blib/script}{$git_mb_dir/scripts}; + $self->copy_if_modified(from => $file, to => $dest); + } + + my @skip = qw{ t/par.t t/signature.t }; + $files = $self->rscan_dir('t'); + for my $file (@$files) { + next unless -f $file; + next if $file =~ /\.svn/; + next if grep { $file eq $_ } @skip; + my $dest = "$git_mb_dir/$file"; + $self->copy_if_modified(from => $file, to => $dest); + } + + $self->copy_if_modified(from => 'Changes', to => "$git_mb_dir/Changes"); + return 1; +} + 1;
