ports/183204: [PATCH] mail/bsfilter: update to 1.0.18.rc5 and etc.
Yasuhiro KIMURA
yasu at utahime.org
Tue Oct 22 15:40:01 UTC 2013
>Number: 183204
>Category: ports
>Synopsis: [PATCH] mail/bsfilter: update to 1.0.18.rc5 and etc.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Tue Oct 22 15:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Yasuhiro KIMURA
>Release: FreeBSD 9.2-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD xxxx 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255921: Sat Sep 28 23:09:21 JST 2013 xxxx amd64
>Description:
- Update to 1.0.18.rc5 (+ patch) to support Ruby 1.9.
- Use more proper EXAMPLES option instead of DOCS.
- Support staging.
>How-To-Repeat:
>Fix:
--- patch-bsfilter begins here ---
Index: Makefile
===================================================================
--- Makefile (revision 331260)
+++ Makefile (working copy)
@@ -2,10 +2,11 @@
# $FreeBSD$
PORTNAME= bsfilter
-PORTVERSION= 1.0.17
+PORTVERSION= 1.0.18.r5
CATEGORIES= mail ruby
MASTER_SITES= SFJP
-MASTER_SITE_SUBDIR= bsfilter/49795
+MASTER_SITE_SUBDIR= bsfilter/58302
+DISTNAME= ${PORTNAME}-1.0.18.ruby1.9.rc5
EXTRACT_SUFX= .tgz
MAINTAINER= info at otsune.com
@@ -17,12 +18,12 @@
NO_BUILD= yes
USE_RUBY= yes
+RUBY_REQUIRE= Ruby >= 193
-OPTIONS_DEFINE= DOCS MECAB
+OPTIONS_DEFINE= EXAMPLES MECAB
MECAB_DESC= Part-of-Speech and Morphological Analyzer
-NO_STAGE= yes
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MMECAB}
@@ -30,18 +31,13 @@
.endif
do-install:
- @${INSTALL_SCRIPT} ${WRKSRC}/bsfilter/${PORTNAME} ${PREFIX}/bin/${PORTNAME}
-.if ${PORT_OPTIONS:MDOCS}
- @${MKDIR} ${EXAMPLESDIR}
+ @${INSTALL_SCRIPT} ${WRKSRC}/bsfilter/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+ @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
.for FILE in bsfilter.conf.sample dot-qmail.sample
- @${INSTALL_DATA} ${FILESDIR}/${FILE} ${EXAMPLESDIR}
+ @${INSTALL_DATA} ${FILESDIR}/${FILE} ${STAGEDIR}${EXAMPLESDIR}
.endfor
.for DIR in mda mua
- @${CP} -r ${WRKSRC}/${DIR} ${EXAMPLESDIR}/${DIR}
+ @${CP} -r ${WRKSRC}/${DIR} ${STAGEDIR}${EXAMPLESDIR}/${DIR}
.endfor
-.endif
-post-install:
- @${CAT} ${PKGMESSAGE}
-
.include <bsd.port.mk>
Index: distinfo
===================================================================
--- distinfo (revision 331260)
+++ distinfo (working copy)
@@ -1,2 +1,2 @@
-SHA256 (bsfilter-1.0.17.tgz) = 80aff0cc641894d9292be3c76d5ff7b074382a89057bdf4d42cd79eb459245c7
-SIZE (bsfilter-1.0.17.tgz) = 1348493
+SHA256 (bsfilter-1.0.18.ruby1.9.rc5.tgz) = bcd3504f425d1290668b4eb451e5efc683828239348ef5ced42799598b60506f
+SIZE (bsfilter-1.0.18.ruby1.9.rc5.tgz) = 80184
Index: files/patch-bsfilter
===================================================================
--- files/patch-bsfilter (revision 0)
+++ files/patch-bsfilter (working copy)
@@ -0,0 +1,192 @@
+Index: bsfilter/bsfilter
+===================================================================
+RCS file: /cvsroot/bsfilter/bsfilter/bsfilter,v
+retrieving revision 1.86.2.8
+retrieving revision 1.86.2.10
+diff -u -r1.86.2.8 -r1.86.2.10
+--- bsfilter/bsfilter 9 Mar 2013 18:03:03 -0000 1.86.2.8
++++ bsfilter/bsfilter 14 Jul 2013 18:41:40 -0000 1.86.2.10
+@@ -1,5 +1,5 @@
+ #! /usr/bin/env ruby
+-## -*-Ruby-*- $Id: bsfilter,v 1.86.2.8 2013/03/09 18:03:03 nabeken Exp $
++## -*-Ruby-*- $Id: bsfilter,v 1.86.2.10 2013/07/14 18:41:40 nabeken Exp $
+ ## Copyright (C) 2003, 2004, 2005, 2006 NABEYA Kenichi
+ ##
+ ## This program is free software; you can redistribute it and/or modify
+@@ -31,7 +31,7 @@
+
+ Release = "$Name: $".split[1].sub(/\A[^\d]*/, '').gsub(/_/, '.')
+ Release.concat("-") if (Release == "")
+- Revision = "$Revision: 1.86.2.8 $".gsub(/[^\.\d]/, '')
++ Revision = "$Revision: 1.86.2.10 $".gsub(/[^\.\d]/, '')
+ Languages = ["C", "ja"]
+ Default_Language = "C"
+
+@@ -281,9 +281,9 @@
+
+ def latin2ascii(str)
+ str.force_encoding('ASCII-8BIT')
+- newstr = str.tr("\x92\x93\x94", "'''")
+- newstr.tr!("\xc0-\xc5\xc8-\xcb\xcc-\xcf\xd2-\xd6\xd9-\xdc", "AAAAAAEEEEIIIIOOOOOUUUU")
+- newstr.tr!("\xe0-\xe5\xe8-\xeb\xec-\xef\xf2-\xf6\xf9-\xfc", "aaaaaaeeeeiiiiooooouuuu")
++ newstr = str.tr("\x92\x93\x94".force_encoding('ASCII-8BIT'), "'''")
++ newstr.tr!("\xc0-\xc5\xc8-\xcb\xcc-\xcf\xd2-\xd6\xd9-\xdc".force_encoding('ASCII-8BIT'), "AAAAAAEEEEIIIIOOOOOUUUU")
++ newstr.tr!("\xe0-\xe5\xe8-\xeb\xec-\xef\xf2-\xf6\xf9-\xfc".force_encoding('ASCII-8BIT'), "aaaaaaeeeeiiiiooooouuuu")
+ return newstr
+ end
+
+@@ -901,7 +901,7 @@
+ end
+ end
+ end
+- return nil
++ return [nil, nil]
+ end
+
+ def get_lang_from_buf(buf, html_flag)
+@@ -916,6 +916,7 @@
+
+ ## reg_utf8 = Regexp::compile("[\xe3\x80\x80-\xe3\x80\x82\xe3\x81\x81-\xe3\x82\x93\xe3\x82\xa1-\xe3\x83\xb6]{4}", nil, 'u') # kana in utf8
+ reg_utf8 = Regexp::compile("[\xe3\x80\x80-\xe3\x80\x82\xe3\x81\x81-\xe3\x82\x93\xe3\x82\xa1-\xe3\x83\xb6]{4}".force_encoding('UTF-8'))
++
+ ## reg_jis = Regexp::compile("\\x1b\\x24[\\x42\\x40]", nil, 'n') # escape sequence to jisx0208 new and old
+ reg_jis = Regexp::compile("\\x1b\\x24[\\x42\\x40]".force_encoding('ASCII-8BIT'))
+ ## reg_gb18030_possible = Regexp::compile('[\x80-\x9f]', nil, 'n')
+@@ -934,16 +935,20 @@
+ gb18030_possible = true
+ end
+
+- if (str.encode('UTF-8', 'UTF-8') =~ reg_utf8)
++ str_utf8 = str.encode('UTF-16BE', 'UTF-8', :undef => :replace, :invalid => :replace).encode('UTF-8', 'UTF-16BE', :undef => :replace, :invalid => :replace)
++ str_sjis = str.encode('UTF-16BE', 'SHIFT_JIS', :undef => :replace, :invalid => :replace).encode('SHIFT_JIS', 'UTF-16BE', :undef => :replace, :invalid => :replace)
++ str_euc = str.encode('UTF-16BE', 'EUC-JP', :undef => :replace, :invalid => :replace).encode('EUC-JP', 'UTF-16BE', :undef => :replace, :invalid => :replace)
++
++ if (str_utf8 =~ reg_utf8)
+ @options["message-fh"].printf("lang ja utf8\n") if (@options["debug"])
+ return ["ja", "utf8"]
+ elsif (str.force_encoding('ASCII-8BIT') =~ reg_jis)
+ @options["message-fh"].printf("lang ja jis\n") if (@options["debug"])
+ return ["ja", "jis"]
+- elsif (str.encode('SHIFT_JIS', 'SHIFT_JIS') =~ reg_sjis)
++ elsif (str_sjis =~ reg_sjis)
+ @options["message-fh"].printf("lang ja sjis\n") if (@options["debug"])
+ return ["ja", "sjis"]
+- elsif (str.encode('EUC-JP', 'EUC-JP') =~ reg_euc)
++ elsif (str_euc =~ reg_euc)
+ if (gb18030_possible)
+ @options["message-fh"].printf("lang ja gb18030\n") if (@options["debug"])
+ return ["ja", "gb18030"]
+@@ -1041,10 +1046,27 @@
+ @method = Proc::new {|s| block(s)}
+ when "mecab"
+ @method = Proc::new {|s| mecab(s)}
++ meishi_euc = "\xcc\xbe\xbb\xec".force_encoding('ASCII-8BIT')
++ meishi_sjis = meishi_euc.encode('SHIFT_JIS', 'EUC-JP').force_encoding('ASCII-8BIT')
++ meishi_utf8 = meishi_euc.encode('UTF-8', 'EUC-JP').force_encoding('ASCII-8BIT')
+ if (defined?(MeCab::VERSION)) # defined after 0.90
+ @m = MeCab::Tagger.new("-Ochasen")
++ node = @m.parseToNode('this is a pen')
++ hinshi = node.next.feature.force_encoding('ASCII-8BIT').split(/,/)[0]
+ else
+- @m = MeCab::Tagger.new([$0, "-Ochasen"])
++ @m = MeCab::Tagger.new("-Ochasen")
++ node = @m.parseToNode('this is a pen')
++ hinshi = node.next.getFeature.force_encoding('ASCII-8BIT').split(/,/)[0]
++ end
++ case hinshi
++ when meishi_euc
++ @m_dic_enc = Encoding::EUC_JP
++ when meishi_sjis
++ @m_dic_enc = Encoding::SHIFT_JIS
++ when meishi_utf8
++ @m_dic_enc = Encoding::UTF_8
++ else
++ @m_dic_enc = Encoding::default_external
+ end
+ when "chasen"
+ Chasen.getopt("-F", '%H %m\n', "-j")
+@@ -1089,8 +1111,9 @@
+ end
+
+ def mecab(str)
++ str = str.encode(@m_dic_enc, :invalid => :replace, :undef => :replace, :replace => ' ')
+ str = str.gsub(/[\x00-\x7f]/, ' ')
+- if (str =~ /\A +\z/)
++ if (str.length == 0 || str =~ /\A +\z/)
+ return []
+ end
+ array = Array::new
+@@ -1098,21 +1121,30 @@
+ while (node &&
+ (defined?(MeCab::VERSION) || (node.hasNode == 1)))
+ if defined?(MeCab::VERSION)
+- token = node.surface.force_encoding('EUC-JP')
+- hinshi = node.feature.force_encoding('EUC-JP').split(/,/)[0]
++ token = node.surface.encode('EUC-JP', @m_dic_enc)
++ hinshi = node.feature.encode('EUC-JP', @m_dic_enc).split(/,/)[0]
+ else
+- token = node.getSurface
+- hinshi = node.getFeature.split(/,/)[0]
++ token = node.getSurface.encode('EUC-JP', @m_dic_enc)
++ hinshi = node.getFeature.encode('EUC-JP', @m_dic_enc).split(/,/)[0]
+ end
+- if (hinshi == "\xcc\xbe\xbb\xec".force_encoding('EUC-JP'))
+- if ((token.force_encoding('EUC-JP') =~ Reg_kanji_katakana) || (token.length > 2))
++ unless (token.valid_encoding?)
++ # Scrub token
++ token = token.each_char.map { |c| (c.valid_encoding?) ? c : "" }.join
++ end
++ case hinshi
++ when "BOS/EOS"
++ # Skip BOS/EOS
++ when "\xb5\xad\xb9\xe6".force_encoding('EUC-JP')
++ # Skip KIGOU
++ when "\xcc\xbe\xbb\xec".force_encoding('EUC-JP')
++ # MEISHI
++ if ((token =~ Reg_kanji_katakana) || (token.bytesize > 2))
+ array.push(token)
+ end
+ else
+- token.force_encoding('EUC-JP').gsub!(Reg_not_kanji_katakana, '')
+- if ((token.force_encoding('EUC-JP') =~ Reg_kanji) || (token.length > 2))
++ token.gsub!(Reg_not_kanji_katakana, '')
++ if ((token =~ Reg_kanji) || (token.bytesize > 2))
+ array.push(token)
+- else
+ end
+ end
+ node = node.next
+@@ -1215,6 +1247,12 @@
+ else
+ content = latin2ascii(content)
+ end
++
++ unless (content.valid_encoding?)
++ # Scrub str
++ content = content.each_char.map { |c| (c.valid_encoding?) ? c : "" }.join
++ end
++
+ content.scan(reg_token).each do |token|
+ head_db.add_scalar(header, token, 1) if (token.length < 20)
+ @options["message-fh"].printf("tokenizer %s %s\n", header, token) if (@options["debug"])
+@@ -1362,6 +1400,11 @@
+ reg_token2 = Regexp::compile('\b\d[\d\.]+\d\b|[\w%]+')
+ reg_noret = Regexp::compile('[\r\n]*\z')
+
++ unless (str.valid_encoding?)
++ # Scrub str
++ str = str.each_char.map { |c| (c.valid_encoding?) ? c : "" }.join
++ end
++
+ str.scan(reg_token).each do |token|
+ if (token =~ reg_url)
+ token.scan(reg_token2).each do |token2|
+@@ -1454,7 +1497,7 @@
+ buf = buf.join.gsub(/[\r\n]/, '').unpack("m*")
+ end
+ when /quoted-printable/i
+- buf.map! {|str| str.unpack("M*").to_s}
++ buf.map! {|str| str.unpack("M*").join}
+ end
+
+ lang_backup = lang
Index: pkg-plist
===================================================================
--- pkg-plist (revision 331260)
+++ pkg-plist (working copy)
@@ -1,24 +1,26 @@
bin/bsfilter
-%%PORTDOCS%%share/examples/bsfilter/bsfilter.conf.sample
-%%PORTDOCS%%share/examples/bsfilter/dot-qmail.sample
-%%PORTDOCS%%share/examples/bsfilter/mda/maildrop/mailfilter.header
-%%PORTDOCS%%share/examples/bsfilter/mda/procmail/procmailrc.black_gray
-%%PORTDOCS%%share/examples/bsfilter/mda/procmail/procmailrc.header
-%%PORTDOCS%%share/examples/bsfilter/mda/procmail/procmailrc.status
-%%PORTDOCS%%share/examples/bsfilter/mua/mew3/bs_clean
-%%PORTDOCS%%share/examples/bsfilter/mua/mew3/bs_mark
-%%PORTDOCS%%share/examples/bsfilter/mua/mew3/bs_spam
-%%PORTDOCS%%share/examples/bsfilter/mua/mew3/mew.el
-%%PORTDOCS%%share/examples/bsfilter/mua/mew4/emacs.el
-%%PORTDOCS%%share/examples/bsfilter/mua/mew4/mew.el
-%%PORTDOCS%%share/examples/bsfilter/mua/mew5/mew.el
-%%PORTDOCS%%share/examples/bsfilter/mua/mew6/mew.el
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mda/maildrop
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mda/procmail
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mda
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mua/mew6
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mua/mew5
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mua/mew4
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mua/mew3
-%%PORTDOCS%%@dirrm share/examples/bsfilter/mua
-%%PORTDOCS%%@dirrm share/examples/bsfilter
+%%PORTEXAMPLES%%share/examples/bsfilter/bsfilter.conf.sample
+%%PORTEXAMPLES%%share/examples/bsfilter/dot-qmail.sample
+%%PORTEXAMPLES%%share/examples/bsfilter/mda/maildrop/mailfilter.header
+%%PORTEXAMPLES%%share/examples/bsfilter/mda/procmail/procmailrc.black_gray
+%%PORTEXAMPLES%%share/examples/bsfilter/mda/procmail/procmailrc.header
+%%PORTEXAMPLES%%share/examples/bsfilter/mda/procmail/procmailrc.status
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew3/bs_clean
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew3/bs_mark
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew3/bs_spam
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew3/mew.el
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew4/emacs.el
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew4/mew.el
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew5/mew.el
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew6/mew.el
+%%PORTEXAMPLES%%share/examples/bsfilter/mua/mew6.4/mew.el
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mda/maildrop
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mda/procmail
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mda
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mua/mew6.4
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mua/mew6
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mua/mew5
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mua/mew4
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mua/mew3
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter/mua
+%%PORTEXAMPLES%%@dirrm share/examples/bsfilter
--- patch-bsfilter ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list