Fetching contributors…
Cannot retrieve contributors at this time
138 lines (88 sloc) 4.14 KB

Patching Module::Build in bleadperl


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

$ cd ~/git
$ git clone git://
$ git checkout blead
$ git clean -dxf

The rest of the instructions assume your perl git repo is ~/git/perl

Creating a perl branch with changes

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.:

$ git checkout 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 patch_blead ~/git/perl

Verifying and editing the branch

After finishes, ~/git/perl will be on the a new branch. Verify that and see what changes have been made:

$ git branch
$ git status

Examine changes and determine if they should be staged or if an error occurred.

If any files are being added or removed, be sure to edit Perl's MANIFEST file and stage it to be committed.

$ git add MANIFEST

Next, modify the Module::Build section of Porting/ to indicate 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.

$ vim Porting/
$ git add Porting/

Commiting the branch

Commit the branch and use the editor to create a commit message. The first line should be like this: "Update Module::Build to 0.33_02". (Use the correct version, of course.) The rest of the file should contain an excerpt from the Changes file since the last version in blead (i.e. the old version number in Porting/

$ git commit

### In editor ###
Update Module::Build to 0.33_02

0.33_02 - Mon Jun 15 12:23:55 EDT 2009

- Fixed tests for bleadperl

0.33_01 - Sat Jun 13 20:24:42 EDT 2009

[... rest of Changes ...]

Testing the branch

Build and test Perl to confirm the changes don't break anything. This takes a while, but saves embarassment posting a buggy patch to perl5-porters. For example:

$ ./Configure -des -Dusedevel
$ make && make test

Creating and sending the patch

Git can automatically create the patch email for perl5-porters:

$ git format-patch origin

This creates a single '0001...' email message file. If you have configured your perl git repository for sending email direct to perl5-porters, you can send it with this command:

$ git send-email 0001-Updating-Module-Build-to-0.33_02.patch

Special tips

Configuring git to send email

In your ~/git/perl repository, set the destination email:

$ git config

You may need to set some configuration for your particular email/ISP setup. For example, to set global git config to send email via a gmail account:

$ git config --global sendemail.smtpserver
$ git config --global sendemail.smtpssl 1
$ git config --global sendemail.smtpuser

With this setup, you will be prompted for your gmail password when you run 'git send-email'.

Fixing a branch and regenerating a patch


If something breaks in the test or after committing you realize you need to tweak the branch, you can go ahead and make changes and commit them to the branch as normal.

Then, before regenerating the patch, squash them into a single patch using interactive rebase:

$ 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'. 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.

Afterwards, regenerate and send the patch as described above.