[libhtml-tidy-perl] 04/10: d/p/tidy-not-tidyp.patch: alter to support either tidyp or tidy-html5

gregor herrmann gregoa at debian.org
Sat Jul 23 13:30:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libhtml-tidy-perl.

commit 357626ff2e00753b2980f86e3884eed3b092c7f4
Author: Simon McVittie <smcv at debian.org>
Date:   Fri Jul 22 10:38:10 2016 +0100

    d/p/tidy-not-tidyp.patch: alter to support either tidyp or tidy-html5
    
    This reinstates the (now somewhat misleadingly named) _tidyp_version
    function by using tidy-html5's tidyLibraryVersion(). This is hopefully
    more palatable to upstream.
    
    d/p/remove-tidy_version.patch: drop, no longer needed.
---
 debian/changelog                                   |   5 +
 debian/patches/fix-error-message-in-webtidy        |   2 +-
 ...tidy-html5-s-differently-formatted-summar.patch |   4 +-
 debian/patches/remove-tidy_version.patch           | 106 -------------------
 debian/patches/series                              |   1 -
 debian/patches/tidy-not-tidyp.patch                | 115 +++++++++++++++------
 6 files changed, 94 insertions(+), 139 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2101180..3eb2bbe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,11 @@ libhtml-tidy-perl (1.56-2) UNRELEASED; urgency=medium
     d/p/t-venus.t-adjust-expected-result-for-tidy-html5.patch:
     add patches to make the tests pass with tidy-html5 providing libtidy
     (Closes: #829409)
+  * d/p/tidy-not-tidyp.patch: alter to support either tidyp or
+    tidy-html5, reinstating the (now somewhat misleadingly named)
+    _tidyp_version function by using tidy-html5's tidyLibraryVersion().
+    This is hopefully more palatable to upstream.
+    - d/p/remove-tidy_version.patch: drop
 
  -- gregor herrmann <gregoa at debian.org>  Thu, 27 Feb 2014 22:36:29 +0100
 
diff --git a/debian/patches/fix-error-message-in-webtidy b/debian/patches/fix-error-message-in-webtidy
index 0efb8d3..1f808ce 100644
--- a/debian/patches/fix-error-message-in-webtidy
+++ b/debian/patches/fix-error-message-in-webtidy
@@ -8,7 +8,7 @@ Forwarded: not-needed
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/bin/webtidy b/bin/webtidy
-index be57814..4a92423 100755
+index dc1a979..5338d09 100755
 --- a/bin/webtidy
 +++ b/bin/webtidy
 @@ -29,7 +29,7 @@ for my $url ( @ARGV ) {
diff --git a/debian/patches/lib-ignore-tidy-html5-s-differently-formatted-summar.patch b/debian/patches/lib-ignore-tidy-html5-s-differently-formatted-summar.patch
index 04801b2..31c6042 100644
--- a/debian/patches/lib-ignore-tidy-html5-s-differently-formatted-summar.patch
+++ b/debian/patches/lib-ignore-tidy-html5-s-differently-formatted-summar.patch
@@ -8,10 +8,10 @@ Signed-off-by: Simon McVittie <smcv at debian.org>
  1 file changed, 4 insertions(+)
 
 diff --git a/lib/HTML/Tidy.pm b/lib/HTML/Tidy.pm
-index a172ea2..aa16c79 100644
+index e19a33d..e527f94 100644
 --- a/lib/HTML/Tidy.pm
 +++ b/lib/HTML/Tidy.pm
-@@ -265,6 +265,10 @@ sub _parse_errors {
+@@ -266,6 +266,10 @@ sub _parse_errors {
              # Summary line we don't want
  
          }
diff --git a/debian/patches/remove-tidy_version.patch b/debian/patches/remove-tidy_version.patch
deleted file mode 100644
index 7b553f2..0000000
--- a/debian/patches/remove-tidy_version.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-From: gregor herrmann <gregoa at debian.org>
-Date: Sat, 20 Feb 2010 09:50:30 -0500
-Subject: remove tidyVersion
-
-It is a special call to Andy Lester's modified version of libtidy. Also
-remove the corresponding call from Perl, the documentation, and the tests.
-
-Reviewed-by: Jonathan Yu <jawnsy at cpan.org>
-Origin: vendor
-Forwarded: not-needed
----
- Tidy.xs          | 11 -----------
- bin/webtidy      |  2 +-
- lib/HTML/Tidy.pm | 17 -----------------
- t/00-load.t      |  2 +-
- t/version.t      |  5 +++++
- 5 files changed, 7 insertions(+), 30 deletions(-)
-
-diff --git a/Tidy.xs b/Tidy.xs
-index 2238b0b..630b550 100644
---- a/Tidy.xs
-+++ b/Tidy.xs
-@@ -189,14 +189,3 @@ _tidy_clean(input, configfile, tidy_options)
-         if ( rc < 0 ) {
-             XSRETURN_UNDEF;
-         }
--
--
--SV*
--_tidyp_version()
--    PREINIT:
--        const char* version;
--    CODE:
--        version = tidyVersion();
--        RETVAL = newSVpv(version,0); /* will be automatically "mortalized" */
--    OUTPUT:
--        RETVAL
-diff --git a/bin/webtidy b/bin/webtidy
-index dc1a979..be57814 100755
---- a/bin/webtidy
-+++ b/bin/webtidy
-@@ -19,7 +19,7 @@ GetOptions(
- ) or $help = 1;
- 
- if ( !@ARGV || $help ) {
--    print "webtidy v$HTML::Tidy::VERSION using tidyp v" . HTML::Tidy::tidyp_version() . "\n";
-+    print "webtidy v$HTML::Tidy::VERSION \n";
-     print <DATA>;
-     exit 1;
- }
-diff --git a/lib/HTML/Tidy.pm b/lib/HTML/Tidy.pm
-index 32a5005..a172ea2 100644
---- a/lib/HTML/Tidy.pm
-+++ b/lib/HTML/Tidy.pm
-@@ -341,23 +341,6 @@ sub _is_keeper {
-     return 1;
- }
- 
--=head2 tidyp_version()
--
--=head2 libtidyp_version()
--
--Returns the version of the underling tidyp library.
--
--=cut
--
--# backcompat
--sub libtidyp_version { return shift->tidyp_version }
--
--sub tidyp_version {
--    my $version_str = _tidyp_version();
--
--    return $version_str;
--}
--
- require XSLoader;
- XSLoader::load('HTML::Tidy', $VERSION);
- 
-diff --git a/t/00-load.t b/t/00-load.t
-index b40452d..d10902e 100644
---- a/t/00-load.t
-+++ b/t/00-load.t
-@@ -8,5 +8,5 @@ use Test::More tests => 1;
- use HTML::Tidy;
- use HTML::Tidy::Message;
- 
--diag( "Testing HTML::Tidy $HTML::Tidy::VERSION, Perl $]; tidyp " . HTML::Tidy->tidyp_version() );
-+diag( "Testing HTML::Tidy $HTML::Tidy::VERSION, Perl $];" );
- pass( 'Modules loaded' );
-diff --git a/t/version.t b/t/version.t
-index f225e3e..b05a7da 100644
---- a/t/version.t
-+++ b/t/version.t
-@@ -7,7 +7,12 @@ use Test::More tests => 4;
- 
- use HTML::Tidy;
- 
-+SKIP: {
-+    skip 'libtidy_version has been removed in Debian', 4;
-+
- for my $version_string (HTML::Tidy->tidyp_version, HTML::Tidy->libtidyp_version) {
-     like( $version_string, qr/^\d\.\d{2,}$/, 'Valid version string' );
-     cmp_ok( $version_string, '>=', '0.90', 'Version is greater than 0.90, which is the one I maintain' );
- }
-+
-+}
diff --git a/debian/patches/series b/debian/patches/series
index 0fa4da0..51603c6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-remove-tidy_version.patch
 tidy-not-tidyp.patch
 lib-ignore-tidy-html5-s-differently-formatted-summar.patch
 t-allow-tidy-html5-as-generator.patch
diff --git a/debian/patches/tidy-not-tidyp.patch b/debian/patches/tidy-not-tidyp.patch
index 9875169..554c6a0 100644
--- a/debian/patches/tidy-not-tidyp.patch
+++ b/debian/patches/tidy-not-tidyp.patch
@@ -1,47 +1,104 @@
-From: Florian Schlichting <fsfs at debian.org>
-Date: Fri, 4 Oct 2013 23:39:39 +0200
-Subject: look for and use tidy.h in /usr/include/tidy (from libtidy-dev)
+From: Simon McVittie <smcv at debian.org>
+Date: Fri, 22 Jul 2016 10:33:50 +0100
+Subject: Look for tidy if tidyp is not found
 
-Forwarded: not-needed
+tidy-html5 is an actively-maintained, HTML5-supporting variant of
+the tidy library from which tidyp was forked.
+
+Based on Debian-specific patches by Florian Schlichting and
+gregor herrmann, which unconditionally switched from tidyp to tidy.
 ---
- Makefile.PL | 6 +++---
- Tidy.xs     | 2 +-
- 2 files changed, 4 insertions(+), 4 deletions(-)
+ Makefile.PL      |  6 ++++++
+ Tidy.xs          | 15 +++++++++++++--
+ lib/HTML/Tidy.pm |  7 +++++++
+ t/version.t      |  2 +-
+ 4 files changed, 27 insertions(+), 3 deletions(-)
 
 diff --git a/Makefile.PL b/Makefile.PL
-index 1bca2ef..6ad1b7f 100644
+index 1bca2ef..e3f64a0 100644
 --- a/Makefile.PL
 +++ b/Makefile.PL
-@@ -10,7 +10,7 @@ use ExtUtils::Liblist;
- use Config;
- 
- my $libs = '-ltidyp';
--my $inc = "-I. -I/usr/include/tidyp -I/usr/local/include/tidyp -I$Config{usrinc}/tidyp";
-+my $inc = "-I. -I/usr/include/tidy -I/usr/local/include/tidy -I$Config{usrinc}/tidy";
- 
- eval { require Alien::Tidyp; };
- 
-@@ -20,8 +20,8 @@ if ( !$@ ) {
-     $inc = Alien::Tidyp->config('INC');
- }
- else {
--    print "Alien::Tidyp not found. Looking for for tidyp on your system.\n";
--    my @vars = ExtUtils::Liblist->ext( '-L/usr/lib -L/usr/local/lib -ltidyp', 0, 1 );
-+    print "Alien::Tidyp not found. Looking for for tidy on your system.\n";
-+    my @vars = ExtUtils::Liblist->ext( '-L/usr/lib -L/usr/local/lib -ltidy', 0, 1 );
+@@ -25,6 +25,12 @@ else {
      $libs = $vars[2];
  
      if ( !$libs ) {
++        @vars = ExtUtils::Liblist->ext( '-L/usr/lib -L/usr/local/lib -ltidy', 0, 1 );
++        $libs = $vars[2];
++        $inc = "-I. -I/usr/include/tidy -I/usr/local/include/tidy -I$Config{usrinc}/tidy -DWITH_TIDY";
++    }
++
++    if ( !$libs ) {
+         $libs = '-ltidyp';
+         print <<'EOF';
+ 
 diff --git a/Tidy.xs b/Tidy.xs
-index 630b550..a8bbe82 100644
+index 2238b0b..0b86116 100644
 --- a/Tidy.xs
 +++ b/Tidy.xs
-@@ -2,7 +2,7 @@
+@@ -2,8 +2,14 @@
  #include "perl.h"
  #include "XSUB.h"
  
 -#include <tidyp.h>
-+#include <tidy.h>
- #include <buffio.h>
+-#include <buffio.h>
++#ifdef WITH_TIDY
++# include <tidy.h>
++# include <tidybuffio.h>
++#else
++# include <tidyp.h>
++# include <buffio.h>
++#endif
++
  #include <stdio.h>
  #include <errno.h>
+ 
+@@ -196,7 +202,12 @@ _tidyp_version()
+     PREINIT:
+         const char* version;
+     CODE:
++#ifdef WITH_TIDY
++        /* tidy-html5 is required */
++        version = tidyLibraryVersion();
++#else
+         version = tidyVersion();
++#endif
+         RETVAL = newSVpv(version,0); /* will be automatically "mortalized" */
+     OUTPUT:
+         RETVAL
+diff --git a/lib/HTML/Tidy.pm b/lib/HTML/Tidy.pm
+index 32a5005..e19a33d 100644
+--- a/lib/HTML/Tidy.pm
++++ b/lib/HTML/Tidy.pm
+@@ -4,6 +4,7 @@ use 5.008;
+ use strict;
+ use warnings;
+ use Carp ();
++use version 0.77 ();
+ 
+ use HTML::Tidy::Message;
+ 
+@@ -355,6 +356,12 @@ sub libtidyp_version { return shift->tidyp_version }
+ sub tidyp_version {
+     my $version_str = _tidyp_version();
+ 
++    # Convert tidy-html5 versions to the 5.002001 form so they work
++    # with naive numeric comparison
++    if ($version_str !~ m/^0\./) {
++        $version_str = version->parse("v$version_str")->numify;
++    }
++
+     return $version_str;
+ }
+ 
+diff --git a/t/version.t b/t/version.t
+index f225e3e..c2528cd 100644
+--- a/t/version.t
++++ b/t/version.t
+@@ -8,6 +8,6 @@ use Test::More tests => 4;
+ use HTML::Tidy;
+ 
+ for my $version_string (HTML::Tidy->tidyp_version, HTML::Tidy->libtidyp_version) {
+-    like( $version_string, qr/^\d\.\d{2,}$/, 'Valid version string' );
++    like( $version_string, qr/^\d\.\d+$/, 'Valid version string' );
+     cmp_ok( $version_string, '>=', '0.90', 'Version is greater than 0.90, which is the one I maintain' );
+ }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libhtml-tidy-perl.git



More information about the Pkg-perl-cvs-commits mailing list