dh-make-perl 0.50

Tom Metro tmetro+pkg-perl-maintainers at gmail.com
Thu Feb 4 19:36:07 UTC 2010


I had the thought that I'd create a simple wrapper around dh-make-perl 
(v0.50 on Ubuntu 9.04) as a substitute for the cpan command to encourage 
use of Debian packages locally, and I ran into some unexpected problems 
on the first run.

Here are some highlights of what was logged, if you want to see it in 
context, otherwise scroll past for comments about specific parts:

% cpan WWW::Mechanize::Plugin::FollowMetaRedirect
/usr/local/bin/cpan: Running dh-make-perl...
/usr/local/bin/cpan: Run /usr/bin/cpan to get the real cpan.
Script started, file is 
/etc/log/2010-02-02-WWW::Mechanize::Plugin::FollowMetaRedirect.txt
Dispatching deprecated method 'CPAN::Config::load' to CPAN::HandleConfig
Going to read /home/tmetro/.cpan/Metadata
   Database was generated on Sat, 12 Dec 2009 00:38:40 GMT
CPAN: Time::HiRes loaded ok (v1.9711)
[...]
Going to read /home/tmetro/.cpan/source/authors/01mailrc.txt.gz
Going to read /home/tmetro/.cpan/build/
DONE
Found no old builds, restored the state of none
............................................................................DONE
Fetching with LWP:
   http://www.perl.org/CPAN/modules/02packages.details.txt.gz
Going to read /home/tmetro/.cpan/source/modules/02packages.details.txt.gz
   Database was generated on Tue, 02 Feb 2010 18:33:00 GMT
...............
   New CPAN.pm version (v1.9402) available.
   [Currently running version is v1.9205]
   You might want to try
     install CPAN
     reload cpan
   to both upgrade CPAN.pm and run the new version without leaving
   the current session.
.............................................................DONE
Fetching with LWP:
   http://www.perl.org/CPAN/modules/03modlist.data.gz
Going to read /home/tmetro/.cpan/source/modules/03modlist.data.gz
............................................................................DONE
Going to write /home/tmetro/.cpan/Metadata
Fetching with LWP:
 
http://www.perl.org/CPAN/authors/id/R/RY/RYOCHIN/WWW-Mechanize-Plugin-FollowMetaRedirect/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01.tar.gz
CPAN: Digest::SHA loaded ok (v5.45)
Fetching with LWP:
http://www.perl.org/CPAN/authors/id/R/RY/RYOCHIN/WWW-Mechanize-Plugin-FollowMetaRedirect/CHECKSUMS
Checksum for 
/home/tmetro/.cpan/source/authors/id/R/RY/RYOCHIN/WWW-Mechanize-Plugin-FollowMetaRedirect/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01.tar.gz 
ok
WWW-Mechanize-Plugin-FollowMetaRedirect-0.01/
[...]
WWW-Mechanize-Plugin-FollowMetaRedirect-0.01/t/waiting_01.html
CPAN: File::Temp loaded ok (v0.18)
CPAN: Module::Build loaded ok (v0.280801)
Use of uninitialized value $_[1] in string eq at 
/usr/share/perl/5.10/File/Copy.pm line 71.
Use of uninitialized value $to in stat at 
/usr/share/perl/5.10/File/Copy.pm line 104.
Use of uninitialized value $to in -d at 
/usr/share/perl/5.10/File/Copy.pm line 112.
Use of uninitialized value $to in pattern match (m//) at 
/usr/share/perl/5.10/File/Copy.pm line 169.
Use of uninitialized value $to in concatenation (.) or string at 
/usr/share/perl/5.10/File/Copy.pm line 171.
Use of uninitialized value $ENV{"PWD"} in concatenation (.) or string at 
/usr/bin/dh-make-perl line 381.
Use of uninitialized value $ENV{"PWD"} in concatenation (.) or string at 
/usr/bin/dh-make-perl line 384.
Found: WWW-Mechanize-Plugin-FollowMetaRedirect 0.01 
(libwww-mechanize-plugin-followmetaredirect-perl arch=all)
Parsing apt-file Contents...
Needs the following debian packages: libhtml-parser-perl, 
libwww-mechanize-perl
Using maintainer: root <root@[...]>
Found changelog: Changes
Found docs: README
Use of uninitialized value $desc in pattern match (m//) at 
/usr/bin/dh-make-perl line 977.
Using rules: /usr/share/dh-make-perl/rules.dh7.noxs
make: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
dh clean
    dh_testdir
    dh_auto_clean
    dh_clean
make: Leaving directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
make: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
dh build
    dh_testdir
    dh_auto_configure
Checking if your kit is complete...
Looks good
Writing Makefile for WWW::Mechanize::Plugin::FollowMetaRedirect
    dh_auto_build
make[1]: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
cp lib/WWW/Mechanize/Plugin/FollowMetaRedirect.pm 
blib/lib/WWW/Mechanize/Plugin/FollowMetaRedirect.pm
Manifying blib/man3/WWW::Mechanize::Plugin::FollowMetaRedirect.3pm
make[1]: Leaving directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
    dh_auto_test
make[1]: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" 
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_load................# Testing 
WWW::Mechanize::Plugin::FollowMetaRedirect 0.01, Perl 5.010000, 
/usr/bin/perl
t/00_load................ok 

t/01_meta-format.........ok 

t/02_waiting.............ok 

[...]
All tests successful, 4 tests skipped.
make[1]: Leaving directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
touch build-stamp
dh install
    dh_testroot
    dh_prep
    dh_installdirs
    dh_auto_install
make[1]: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
Installing 
/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01/debian/libwww-mechanize-plugin-followmetaredirect-perl/usr/share/perl5/WWW/Mechanize/Plugin/FollowMetaRedirect.pm
Installing 
/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01/debian/libwww-mechanize-plugin-followmetaredirect-perl/usr/share/man/man3/WWW::Mechanize::Plugin::FollowMetaRedirect.3pm
make[1]: Leaving directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
    dh_install
    dh_installdocs
    dh_installchangelogs
    dh_installexamples
    dh_installman
ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be 
preloaded: ignored.
    dh_installcatalogs
[...]
    dh_compress
    dh_fixperms
touch install-stamp
dh binary-indep
    dh_installdeb -i
    dh_gencontrol -i
dpkg-gencontrol: warning: unknown substitution variable ${misc:Depends}
    dh_md5sums -i
    dh_builddeb -i
dpkg-deb: building package 
`libwww-mechanize-plugin-followmetaredirect-perl' in 
`../libwww-mechanize-plugin-followmetaredirect-perl_0.01-1_all.deb'.
make: Leaving directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
dpkg: error processing 
/home/tmetro/libwww-mechanize-plugin-followmetaredirect-perl_0.01-1_all.deb 
(--install):
  cannot access archive: No such file or directory
Errors were encountered while processing:
/home/tmetro/libwww-mechanize-plugin-followmetaredirect-perl_0.01-1_all.deb
Cannot install package 
/home/tmetro/libwww-mechanize-plugin-followmetaredirect-perl_0.01-1_all.deb
Script done, file is 
/etc/log/2010-02-02-WWW::Mechanize::Plugin::FollowMetaRedirect.txt


The first bit of trouble seem to show up here:

> Use of uninitialized value $_[1] in string eq at /usr/share/perl/5.10/File/Copy.pm line 71.
> Use of uninitialized value $to in stat at /usr/share/perl/5.10/File/Copy.pm line 104.
> Use of uninitialized value $to in -d at /usr/share/perl/5.10/File/Copy.pm line 112.
> Use of uninitialized value $to in pattern match (m//) at /usr/share/perl/5.10/File/Copy.pm line 169.
> Use of uninitialized value $to in concatenation (.) or string at /usr/share/perl/5.10/File/Copy.pm line 171.
> Use of uninitialized value $ENV{"PWD"} in concatenation (.) or string at /usr/bin/dh-make-perl line 381.
> Use of uninitialized value $ENV{"PWD"} in concatenation (.) or string at /usr/bin/dh-make-perl line 384.

I'm guessing that is from dh-make-perl and not from the module build.

And then there is this:

> Use of uninitialized value $desc in pattern match (m//) at /usr/bin/dh-make-perl line 977.

which I'm assuming is just dh-make-perl having problems extracting a 
package description from the module's POD. I assume a non-critical error 
that should have been trapped and displayed as a warning.

Here's where things get more problematic:

> Using rules: /usr/share/dh-make-perl/rules.dh7.noxs
> make: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'

It seems this combination of dh-make-perl and cpan running under sudo 
resulted in the build directory being created under the file system root 
(/), rather than some more appropriate location.

Is the code being thrown off by the mix of environment variables caused 
by sudo (I noticed cpan used my non-root $HOME as the basis for finding 
config and cached files), or do I need to do a cpan run separate from 
dh-make-perl and get it fully configured first? (It looks like I've 
previously used cpan on this box, so the latter should already be done.)


The module itself seemed to build fine and pass its tests:

> make[1]: Entering directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
> PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/00_load................# Testing WWW::Mechanize::Plugin::FollowMetaRedirect 0.01, Perl 5.010000, /usr/bin/perl
> t/00_load................ok                                                  
> t/01_meta-format.........ok                                                  
> t/02_waiting.............ok                                                  
> [...]
> All tests successful, 4 tests skipped.

which I confirmed by repeating the make/make test steps afterwards.

I assume these are ignorable:

> ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded: ignored.
> dpkg-gencontrol: warning: unknown substitution variable ${misc:Depends}

and this seems to be where the path confusion trips up dh-make-perl:

> dpkg-deb: building package `libwww-mechanize-plugin-followmetaredirect-perl' in `../libwww-mechanize-plugin-followmetaredirect-perl_0.01-1_all.deb'.
> make: Leaving directory `/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01'
> dpkg: error processing /home/tmetro/libwww-mechanize-plugin-followmetaredirect-perl_0.01-1_all.deb (--install):
>  cannot access archive: No such file or directory

as the .deb ended up in / instead of /home/tmetro/.

There's also some residual fallout from the mix up:

% dh-make-perl
Found: WWW-Mechanize-Plugin-FollowMetaRedirect 0.01 
(libwww-mechanize-plugin-followmetaredirect-perl arch=all)
Using cached Contents from Tue Feb  2 14:26:18 2010
can't create /home/tmetro/.dh-make-perl/Contents.cache.new: Permission 
denied at /usr/bin/dh-make-perl line 774

due to ~/.dh-make-perl being created by root, but that's easy enough to fix.

I'm guessing I can probably work around this in the wrapper script by 
setting $HOME to match what cpan is using, or something similar to that. 
Ideally, I'd like both to use /usr/local/src/cpan (or $CWD, and I'll cd 
to that directory in my wrapper).

My wrapper currently calls "sudo dh-make-perl --install --cpan $@", but 
a better approach might be to call it without sudo and use --build 
instead, and then separately call "sudo dpkg -i ...", though that adds 
the complication of needing to extract the .deb file name from the 
dh-make-perl output.

On a related note, I'm using 'script' in the wrapper to log the session, 
and ideally I'd like to use the Debian package name as part of the file 
name, rather than the Perl module name, which is being supplied on the 
command line. It would be handy if dh-make-perl had a command line 
option to return the Debian package name for a given module name. 
Perhaps there is an existing library that could be accessed with a 
one-liner to do this, like:

PACKAGE=`perl -Mmodule -e 'print module::method("$MODULE"),"\n";'`

Perhaps a similar approach could be used to programmatically extract the 
full .deb file name for a given source directory.


Also, I'm confused why one of these command lines doesn't build the .deb 
using the existing ./debian files:

/usr/local/src/cpan/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01% 
dh-make-perl
Found: WWW-Mechanize-Plugin-FollowMetaRedirect 0.01 
(libwww-mechanize-plugin-followmetaredirect-perl arch=all)
The directory ./debian is already present and I won't overwrite it: 
remove it yourself.

/usr/local/src/cpan/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01% 
dh-make-perl --build
Found: WWW-Mechanize-Plugin-FollowMetaRedirect 0.01 
(libwww-mechanize-plugin-followmetaredirect-perl arch=all)
The directory ./debian is already present and I won't overwrite it: 
remove it yourself.

Shouldn't there be a command to build the .deb using an existing 
./debian? (Sure, there are the usual Debian packaging commands, but why 
not have dh-make-perl do the expected thing?)


And I noticed this:

/usr/local/src/cpan% dh-make-perl --refresh 
WWW-Mechanize-Plugin-FollowMetaRedirect-0.01/
Engaging refresh mode
Cannot open ./Makefile.PL: No such file or directory

doesn't work, while this:

/usr/local/src/cpan/WWW-Mechanize-Plugin-FollowMetaRedirect-0.01% 
dh-make-perl --refresh
Engaging refresh mode
Found: WWW-Mechanize-Plugin-FollowMetaRedirect 0.01 
(libwww-mechanize-plugin-followmetaredirect-perl arch=all)
Found changelog: Changes
Found docs: README 
debian/libwww-mechanize-plugin-followmetaredirect-perl/usr/share/doc/libwww-mechanize-plugin-followmetaredirect-perl/README
Using rules: /usr/share/dh-make-perl/rules.dh7.noxs
--- Done

does. Technically the man page does reflect that, but it seems 
inconsistent with the other operational modes.

  -Tom



More information about the pkg-perl-maintainers mailing list