[Rt-commit] rt branch, 4.4/optional-deps, created. rt-4.4.0-261-g87528e1

Alex Vandiver alexmv at bestpractical.com
Thu Jun 9 21:11:19 EDT 2016


The branch, 4.4/optional-deps has been created
        at  87528e14819ef677f80d22c31b3798e6beb52220 (commit)

- Log -----------------------------------------------------------------
commit 08db4ddb1f6f49945af2f7e714db907b1ab9460a
Author: Alex Vandiver <alex at chmrr.net>
Date:   Thu Jun 9 14:44:16 2016 -0700

    Encode::Guess is included in Encode 1.60 and above; RT requires 2.64
    
    This is not an optional dependency; it is guaranteed to be included in
    the Encode distribution that RT requires.

diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index 60a6622..60ccaba 100644
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -65,6 +65,7 @@ use base 'Locale::Maketext::Fuzzy';
 use MIME::Entity;
 use MIME::Head;
 use File::Glob;
+use Encode::Guess;
 
 # I decree that this project's first language is English.
 
@@ -506,11 +507,11 @@ sub _FindOrGuessCharset {
 
 =head2 _GuessCharset STRING
 
-use Encode::Guess to try to figure it out the string's encoding.
+Use Encode::Guess, and optionally Encode::Detect::Detector, to try to
+figure it out the string's encoding.
 
 =cut
 
-use constant HAS_ENCODE_GUESS => Encode::Guess->require;
 use constant HAS_ENCODE_DETECT => Encode::Detect::Detector->require;
 
 sub _GuessCharset {
@@ -551,11 +552,6 @@ sub _GuessCharset {
         return $fallback;
     }
 
-    unless ( HAS_ENCODE_GUESS ) {
-        $RT::Logger->error("We couldn't load Encode::Guess module, fallback to $fallback");
-        return $fallback;
-    }
-
     Encode::Guess->set_suspects( @encodings );
     my $decoder = Encode::Guess->guess( $_[0] );
     unless ( defined $decoder ) {
diff --git a/t/api/i18n_guess.t b/t/api/i18n_guess.t
index 0a99011..870ab95 100644
--- a/t/api/i18n_guess.t
+++ b/t/api/i18n_guess.t
@@ -4,7 +4,6 @@ use warnings;
 
 use RT::Test tests => 16;
 
-use constant HAS_ENCODE_GUESS => Encode::Guess->require;
 use constant HAS_ENCODE_DETECT => Encode::Detect::Detector->require;
 
 my $string = "\x{442}\x{435}\x{441}\x{442} \x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";
@@ -24,7 +23,6 @@ SKIP: {
 
 RT->Config->Set(EmailInputEncodings => qw(UTF-8 cp1251 koi8-r));
 SKIP: {
-    skip "No Encode::Guess", 4 unless HAS_ENCODE_GUESS;
     guess('utf-8', $string);
     guess('cp1251', $string);
     guess('windows-1251', $string, 'cp1251');
@@ -36,7 +34,6 @@ SKIP: {
 
 RT->Config->Set(EmailInputEncodings => qw(UTF-8 koi8-r cp1251));
 SKIP: {
-    skip "No Encode::Guess", 3 unless HAS_ENCODE_GUESS;
     guess('utf-8', $string);
     guess('koi8-r', $string);
     {
@@ -49,7 +46,6 @@ SKIP: {
 RT->Config->Set(EmailInputEncodings => qw(UTF-8 windows-1251 koi8-r));
 RT->Config->PostLoadCheck;
 SKIP: {
-    skip "No Encode::Guess", 3 unless HAS_ENCODE_GUESS;
     guess('utf-8', $string);
     guess('cp1251', $string);
     {

commit 87528e14819ef677f80d22c31b3798e6beb52220
Author: Alex Vandiver <alex at chmrr.net>
Date:   Sun Jun 5 17:20:25 2016 -0700

    Add configure-time flags for existing optional runtime dependencies
    
    RT has some optional runtime dependencies, which are not currently
    well-sourced to users at installation time.  They include:
    
     - HTML::FormatExternal alters RT's behavior when downgrading
       HTML-only messages (both incoming and outgoing) into plain text.
       If it is installed, it attempts to use a variety of textual
       browsers and HTML converters before falling back to the built-in
       rendering engine.  This optional dependency is mentioned in
       etc/UPGRADING-4.2 and RT_Config.pm.
    
     - HTML::Gumbo ensures that HTML content is well-balanced.  With it
       installed, it is thus safe for RT to render a larger variety of
       HTML in transaction histories, including HTML tables.  This
       optional dependency is mentioned in RT_Config.pm.
    
     - Encode::HanExtra adds more encodings, including `big5` and gb18030,
       character sets which are used for Chinese.  This optional
       dependency is mentioned in error logs if messages it is necessary
       for are encountered.
    
     - Encode::Detector::Detect is an alternative to the built-in
       Encode::Guess, based on Mozilla's character set detection code;
       unlike Encode::Guess, it does not require an ordered list of
       potential encodings, and uses a more sophisticated algorithm than
       simply attempting to decode with each potential character set.
       This optional dependency is mentioned in RT_Config.pm.
    
    These optional dependencies are split into two configure-time flags.
    The `--enable-better-html-email` flag will be removed in 4.6, when the
    modules become non-optional.

diff --git a/configure.ac b/configure.ac
index 6b9e88c..51acdcc 100755
--- a/configure.ac
+++ b/configure.ac
@@ -348,6 +348,22 @@ else
 fi
 AC_SUBST(RT_EXTERNALAUTH)
 
+dnl Optional HTML email dependencies
+AC_ARG_ENABLE(better-html-email,
+            AC_HELP_STRING([--enable-better-html-email],
+                           [Add dependencies needed for better HTML email rendering]),
+            BETTER_HTML_EMAIL=1,
+            BETTER_HTML_EMAIL=0)
+AC_SUBST(BETTER_HTML_EMAIL)
+
+dnl Optional encoding dependencies
+AC_ARG_ENABLE(extra-email-encodings,
+            AC_HELP_STRING([--enable-extra-email-encodings],
+                           [Add dependencies for more Chinese character sets, and better character set detection]),
+            EXTRA_EMAIL_ENCODINGS=1,
+            EXTRA_EMAIL_ENCODINGS=0)
+AC_SUBST(EXTRA_EMAIL_ENCODINGS)
+
 dnl ExternalStorage
 AC_ARG_WITH(attachment-store,
 	    AC_HELP_STRING([--with-attachment-store=TYPE],
diff --git a/etc/cpanfile b/etc/cpanfile
index 354114f..a47c4a1 100644
--- a/etc/cpanfile
+++ b/etc/cpanfile
@@ -206,3 +206,16 @@ feature 's3' => sub {
 feature 'dropbox' => sub {
     requires 'File::Dropbox';
 };
+
+
+# Better HTML email rendering
+feature 'better-html-email' => sub {
+    requires 'HTML::FormatExternal';
+    requires 'HTML::Gumbo';
+};
+
+# Support for more obscure Chinese character sets
+feature 'extra-email-encodings' => sub {
+    requires 'Encode::HanExtra';
+    requires 'Encode::Detect::Detector';
+};
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 9e812e4..0c45e66 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -74,6 +74,9 @@ GetOptions(
 
     'with-S3', 'with-DROPBOX',
 
+    'with-BETTER-HTML-EMAIL',
+    'with-EXTRA-EMAIL-ENCODING',
+
     'siteinstall!',
     'help|h',
 
@@ -100,6 +103,8 @@ my %default = (
     'with-EXTERNALAUTH' => @RT_EXTERNALAUTH@,
     'with-S3'           => (uc(q{@ATTACHMENT_STORE@}) eq 'S3'),
     'with-DROPBOX'      => (uc(q{@ATTACHMENT_STORE@}) eq 'DROPBOX'),
+    'with-BETTER-HTML-EMAIL'     => @BETTER_HTML_EMAIL@,
+    'with-EXTRA-EMAIL-ENCODINGS' => @EXTRA_EMAIL_ENCODINGS@,
 );
 
 $default{"with-".uc("@DB_TYPE@")} = 1 unless grep {$args{"with-$_"}} qw/MYSQL PG SQLITE ORACLE/;

-----------------------------------------------------------------------


More information about the rt-commit mailing list