Best practice for releasing Perl modules to staging and live

Minty mintywalker at
Tue May 19 13:43:59 BST 2009

On Tue, May 19, 2009 at 1:21 PM, Minty <mintywalker at> wrote:

[ snip, see

> It isn't the same as building a deb for a module that exists
> already as a .deb and which you want a newer CPAN version.

And here's what I do to upgrade from CPAN a deb that already exists

# Find your tarball
/bin/zgrep "Template::Declare" ~/.MINICPAN/modules/02packages.details.txt.gz

# Get the exising deb
/usr/bin/apt-get source libtemplate-declare-perl

# Unbundle the newer cpan tarball
/bin/tar zxvf ~/.MINICPAN/authors/id/A/AL/ALEXMV/Template-Declare-0.39.tar.gz

# Rename dirs and create a .test dir for me to play in manually
/bin/mv Template-Declare-0.39 libtemplate-declare-perl-0.39
/bin/cp -ai libtemplate-declare-perl-0.39 libtemplate-declare-perl-0.39.test

# Apply any diffs/patches from the existing .deb file
cd libtemplate-declare-perl-0.39 && /bin/gzip -dc
../libtemplate-declare-perl*.diff.gz | patch -p1

Those patches are *generally* just the debian meta packaging files,
but sometimes contain actual patches agains the code.  Sometimes there
are alternative packaging approaches to applying diffs.  $hurt++

You need to get to the point where the diffs apply cleanly by hook or by crook

# I need this, but I assume it's probably a sign I've got something wrong
/bin/chmod u+x libtemplate-declare-perl-0.39/debian/rules

# Update libtemplate-declare-perl-0.39/debian/changelog file
# It should already exist, so use that as a reference.

This next bit could be tackled in other ways -- but we're trying to
get a sane libtemplate-declare-perl-0.39/debian/control

# First, have dh-make-perl auto generate a debian/control file in our .test dir.
# It uses the various cpan meta files to stab a wild guess in the dark
/usr/bin/dh-make-perl libtemplate-declare-perl-0.39.test

# Compare, contrast, manually merge
vi -o2 libtemplate-declare-perl-0.39/debian/control

# As before, manually check things aren't going to burn
cd libtemplate-declare-perl-0.39.test && perl Makefile.PL && make && make test

Again, this normally shows up dependency issues.  Lather, rinse,
repeat ... again

# Now build your deb
cd libtemplate-declare-perl-0.39
 dpkg-buildpackage -rfakeroot

Note that we've not got -sa here which we did have when building a new
.deb from scratch.  You want the source included the first time you
build a .deb, but subsequently you don't need it (in fact, i believe
you actively don't want it).  man dpkg-buildpackage

More information about the mailing list