Packaging perl modules

Alexander E. Patrakov patrakov at gmail.com
Sat Dec 8 23:46:22 PST 2007


[Credit for asking the "how to uninstall a perl module?" question goes
to Archaic]

Hello,

there was a decision to add DESTDIR support to all LFS and then
eventually BLFS packages. However, there is a problem applying this
approach to typical perl modules (let me use "Want" as a small
example, you can download it from
http://cpan.makeperl.org/authors/id/R/RO/ROBIN/Want-0.16.tar.gz). Try
installing it naively into a DESTDIR:

tar xf Want-0.16.tar.gz
cd Want-0.16
perl Makefile.pl
make
make test
make DESTDIR=/tmp/Want install

This seems to work:

$ find /tmp/Want -type f
/tmp/Want/usr/lib/perl5/site_perl/5.8.8/i486-linux/auto/Want/Want.so
/tmp/Want/usr/lib/perl5/site_perl/5.8.8/i486-linux/auto/Want/Want.bs
/tmp/Want/usr/lib/perl5/site_perl/5.8.8/i486-linux/auto/Want/.packlist
/tmp/Want/usr/lib/perl5/site_perl/5.8.8/i486-linux/Want.pm
/tmp/Want/usr/lib/perl5/5.8.8/i486-linux/perllocal.pod
/tmp/Want/usr/share/man/man3/Want.3

but actually doesn't work quite well:

1) it instals a /tmp/Want/usr/lib/perl5/5.8.8/i486-linux/perllocal.pod
file, while the intent was to append to the existing file.

2) it writes a /tmp/Want/usr/lib/perl5/site_perl/5.8.8/i486-linux/auto/Want/.packlist
file. Looking in this file, one finds that each line starts with
/tmp/Want

In fact, with package management in place, both files are useless: one
can use his package manager instead of "perldoc perllocal" to see the
list of locally-installed modules, and the same package manager works
well for uninstalling the module (instead of calling ExtUtils
directly) once it is no longer needed.

I.e.:

1) perllocal.pod should not be packaged as it is. It should be either
removed completely or converted into a pair post-installation and
post-removal scripts.

2) .packlist should be either adjusted or (better, as double package
management is a bad idea) removed completely.

In fact, Debian patches their perl (or, more precisely, the MakeMaker
module) so that for "vendor" installs (see below), such files are not
produced at all:

perl Makefile.pl INSTALLDIRS=vendor  # on Debian
make
make test
make DESTDIR=/tmp/Want install

$ find /tmp/Want -type f  # on Debian
/tmp/Want/usr/share/man/man3/Want.3pm
/tmp/Want/usr/lib/perl5/auto/Want/Want.so
/tmp/Want/usr/lib/perl5/auto/Want/Want.bs
/tmp/Want/usr/lib/perl5/Want.pm

OTOH, RedHat simply removes the uneeded files when packaging:

http://cvs.fedoraproject.org/viewcvs/devel/perl-Want/perl-Want.spec?view=markup

find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';'
(not sure what they do with perllocal.pod, but it is not in the
resulting package either)

So here are the questions:

1) where should such issues be explained?

2) should LFS apply the MakeMaker perl patch that suppresses
installation of .packlist and perllocal.pod files for vendor installs,
or rely on the packager to remove them?

-- 
Alexander E. Patrakov



More information about the lfs-dev mailing list