Today at work a collegue asked help in getting the perl module
HTML::Tidy working on a newly installed Deban 5.0 "lenny" machine. The module was needed for an intranet system currently running on Debian 4.0 "Etch", but since Etch is being deprecated, the new development server needed it to, but it was unfortunately not available in the standard package repository.
I have previously always encouraged people needing non-packaged
CPAN modules to use the outstanding
dh-make-perl. A simple
dh-make-perl --install --cpan HTML::Tidy
would normally have built and installed a Debian package in seconds.
Unfortunately this time it didn't, it compiled just fine, except some warnings about signed chars, but while running the tests, it failed.
t/perfect............dubious
Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 3
Failed 1/3 tests, 66.67% okay
t/pod-coverage.......ok
t/pod................ok
t/roundtrip..........ok
t/segfault-form......ok
t/simple.............ok 1/4Unknown error type: line 2 column 5 - Info: <body> previously mentioned at t/simple.t line 17
Unknown error type: line 2 column 5 - Info: <body> previously mentioned at t/simple.t line 17
Unknown error type: line 2 column 5 - Info: <body> previously mentioned at t/simple.t line 17
t/simple.............ok
t/too-many-titles....ok 1/3Unknown error type: line 4 column 9 - Info: <head> previously mentioned at t/too-many-titles.t line 22
t/too-many-titles....ok
t/unicode............dubious
Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 7
Failed 1/7 tests, 85.71% okay
t/venus..............ok 1/3Unknown error type: line 8 column 2 - Info: <h1> previously mentioned at t/venus.t line 21
Unknown error type: line 10 column 2 - Info: <h1> previously mentioned at t/venus.t line 21
Unknown error type: line 11 column 2 - Info: <h1> previously mentioned at t/venus.t line 21
Unknown error type: line 12 column 2 - Info: <h1> previously mentioned at t/venus.t line 21
Unknown error type: line 15 column 2 - Info: <h2> previously mentioned at t/venus.t line 21
Unknown error type: line 17 column 2 - Info: <h4> previously mentioned at t/venus.t line 21
Unknown error type: line 18 column 2 - Info: <h4> previously mentioned at t/venus.t line 21
Unknown error type: line 20 column 2 - Info: <h4> previously mentioned at t/venus.t line 21
Unknown error type: line 25 column 3 - Info: <h4> previously mentioned at t/venus.t line 21
A bit of googling and searching on CPAN led me to find two patches, one to ignore the error warnings, and one to fix what turned out to be segfaulting of the script. The latter is most likely caused by Lenny having a newer snapshot of libtidy, which is according to the author of HTML::Tidy informed is not really released, but they expect people to check out their source tree and compile themselves. Luckily Debian provides a package with a corresponding version name with the date it was made.
However the author of HTML::Tidy, Andy Lester, naturally, can't only rely on a specific Debian version and expect any user to use that (Perl is available on numerous platforms and distributions), so he is planning to include a snapshot of libtidy in the HTML::Tidy module itself, but hasn't had time to do it yet. Thanks to Andy for quickly giving me some insight btw ;-)
So, to make it work do the following:
dh-make-perl --cpan HTML::Tidy
cd HTML::Tidy # possibly having to tab your way to something like HTML::Tidy.37534
wget -O - http://rt.cpan.org/Ticket/Attachment/365180/165489/tidy.patch | patch -p0
cat | patch lib/HTML/Tidy.pm
267a268,271
> elsif ( $line =~ m/^line [\d]+ column [\d]+ - Info:/ ) {
> # Info line we don't want
>
> }
Ctrl+D
dh-make-perl --build
and you should have a working debian package in the parent directory. Remember to set DEB_FULLNAME and DEB_EMAIL environment variables first so that you get a proper Author: entry for the package.
For more info about the module and the patches: