Make cmew command usable with ruby19.

pkgsrc change: add comments to patch files.

Bump PKGREVISION.
This commit is contained in:
taca 2011-09-12 16:27:18 +00:00
parent 6b79674599
commit 096fa84761
4 changed files with 53 additions and 14 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.82 2011/07/11 14:54:38 ryoon Exp $
# $NetBSD: Makefile,v 1.83 2011/09/12 16:27:18 taca Exp $
DISTNAME= mew-6.3
PKGNAME= ${EMACS_PKGNAME_PREFIX}${DISTNAME}
PKGREVISION= 2
PKGREVISION= 3
CATEGORIES= mail
MASTER_SITES= http://www.mew.org/Release/

View file

@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.39 2011/07/11 14:54:38 ryoon Exp $
$NetBSD: distinfo,v 1.40 2011/09/12 16:27:18 taca Exp $
SHA1 (mew-6.3.tar.gz) = 206709f9423c787d94e120f9bac606b975d6aab1
RMD160 (mew-6.3.tar.gz) = da816f4c7679a968b1765192a8eda78118d179a6
Size (mew-6.3.tar.gz) = 976352 bytes
SHA1 (patch-aa) = 649f3b8fb9fdbd80bfe2b324599aff9dd45c4232
SHA1 (patch-ac) = 8f993fd86774f2ae725cbbe81338862f08dfdfbf
SHA1 (patch-aa) = 7d98b2408108ef93137677373b289e7658949209
SHA1 (patch-ac) = 6bcbb0988dd00cc30f5cd1a8717a7f816e5cbf63
SHA1 (patch-mew-ssl.el) = 2697e2f12bd4639538c1adadfc5151261c4e7381

View file

@ -1,4 +1,6 @@
$NetBSD: patch-aa,v 1.7 2011/07/11 14:54:38 ryoon Exp $
$NetBSD: patch-aa,v 1.8 2011/09/12 16:27:18 taca Exp $
* Specify default icon directory for pkgsrc.
--- mew-key.el.orig 2009-01-21 05:54:56.000000000 +0000
+++ mew-key.el

View file

@ -1,13 +1,50 @@
$NetBSD: patch-ac,v 1.1 2010/10/06 12:29:42 taca Exp $
$NetBSD: patch-ac,v 1.2 2011/09/12 16:27:18 taca Exp $
Two fixes for cmew problem:
* Portability with Ruby 1.9 and later:
Use own class to get mail header instead of using mailread.
* Two fixes for cmew problem:
http://www.mew.org/pipermail/mew-dist/2010-August/028963.html
http://www.mew.org/pipermail/mew-dist/2010-August/028962.html
--- bin/cmew.orig 2009-09-09 00:57:27.000000000 +0000
+++ bin/cmew
@@ -127,6 +127,8 @@ def register(db, maildir, ignore_regex,
@@ -13,7 +13,31 @@ require 'sqlite3'
require 'time'
require 'fileutils'
require 'find'
-require 'mailread'
+
+################################################################
+##
+## mail_header
+##
+## Get header from mail message. If multiple header field
+## exists, last one will be used.
+##
+def mail_header(path)
+ @header = {}
+ value = nil
+ File.open(path) do |f|
+ while l = f.gets.chomp
+ next if /^From / =~ l
+ break if /^$/ =~ l
+ if /^\s+/ !~ l
+ (name, value) = l.split(/:\s+/, 2)
+ @header[name.downcase] = value
+ else
+ value << $'
+ end
+ end
+ end
+ return @header
+end
################################################################
##
@@ -127,6 +151,8 @@ def register(db, maildir, ignore_regex,
deleted = 0
skipdir = ''
@ -16,7 +53,7 @@ Two fixes for cmew problem:
Find.find(target) do |fpath|
if fpath =~ ignore_regex
if FileTest.directory?(fpath)
@@ -135,7 +137,7 @@ def register(db, maildir, ignore_regex,
@@ -135,7 +161,7 @@ def register(db, maildir, ignore_regex,
end
# next
else
@ -25,12 +62,12 @@ Two fixes for cmew problem:
if st.symlink?
if FileTest.directory?(fpath)
print fpath, " (ignored)\n"
@@ -159,14 +161,14 @@ def register(db, maildir, ignore_regex,
@@ -159,14 +185,14 @@ def register(db, maildir, ignore_regex,
elsif st.file? and fpath =~ /\/[0-9]+(\.mew)?$/
next if File.dirname(fpath) == skipdir
next if last_mod > st.ctime.tv_sec
- m = Mail.new(fpath)
+ m = Mail.new(fpath) rescue next
+ m = mail_header(fpath) rescue next
id = get_id(m)
parid = get_parid(m)
date = get_date(m)
@ -42,7 +79,7 @@ Two fixes for cmew problem:
past_path = row['path']
unless File.exist?(past_path)
del_entry.execute(id, past_path)
@@ -183,10 +185,16 @@ def register(db, maildir, ignore_regex,
@@ -183,10 +209,16 @@ def register(db, maildir, ignore_regex,
end
end
end
@ -59,7 +96,7 @@ Two fixes for cmew problem:
end
################################################################
@@ -209,7 +217,7 @@ OptionParser.new {|opt|
@@ -209,7 +241,7 @@ OptionParser.new {|opt|
db_file = ARGV[0] || File.expand_path('~/Mail/id.db')
maildir = ARGV[1] || File.expand_path('~/Mail')