[Trapaas] Simple script for dropping emails in db
by Maros Zatko
commit 9872c6420ed19ece85b6d58d25559467a260235b
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Wed Jul 20 16:51:13 2011 +0200
Simple script for dropping emails in db
drop_db.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/drop_db.rb b/drop_db.rb
new file mode 100644
index 0000000..e1be0c2
--- /dev/null
+++ b/drop_db.rb
@@ -0,0 +1,3 @@
+require 'mail-eater'
+MailEater.clean_processed
+MailEater.clean_raw
12 years, 11 months
[Trapaas] Improved repository and ack/nak recognition
by Maros Zatko
commit 9c339f84e854762fc9592d5ec1fae2da4147d3c3
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Wed Jul 20 16:50:12 2011 +0200
Improved repository and ack/nak recognition
mail-eater.rb | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/mail-eater.rb b/mail-eater.rb
index 76ab636..9673a85 100644
--- a/mail-eater.rb
+++ b/mail-eater.rb
@@ -35,8 +35,7 @@ module MailEater
puts " \e[34min_reply_to:\e[0m #{mail.in_reply_to.inspect}"
puts " \e[34mdate:\e[0m #{mail.date}"
if gited or gitreply
- #repo = mail.subject.grep(/\[PATCH (.*)\]/)[0] if mail.subject
- repo = mail.subject.match(/\[PATCH\ *(\S*[^\/\d\ ]).*\]/) if mail.subject
+ repo = mail.subject.match(/\[PATCH\ *([^\/\d\ \]]*).*/) if mail.subject
repo = repo[1] if repo
puts " \e[33mrepo:\e[0m #{repo}"
end
@@ -46,8 +45,8 @@ module MailEater
naked = false
reviw = false
# if (not gited) and gitreply
- acked = ! (mail.body.raw_source.grep(/ACK|ack/).empty?)
- naked = ! (mail.body.raw_source.grep(/NAK|nak/).empty?)
+ acked = ! (mail.body.raw_source.grep(/\b(ACK|ack)\b/).empty?)
+ naked = ! (mail.body.raw_source.grep(/\b(NAK|nak)\b/).empty?)
reviw = ! (mail.body.raw_source.grep(/I'll do a review/).empty?)
puts " \e[31mACKED\e[0m" if acked
12 years, 11 months
[Trapaas] fix 2
by Maros Zatko
commit c1fa2d69a8a7ba49e29754ee9bc9bd9a2d6307d2
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 17:42:45 2011 +0200
fix 2
mail-eater.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/mail-eater.rb b/mail-eater.rb
index 9d04f53..76ab636 100644
--- a/mail-eater.rb
+++ b/mail-eater.rb
@@ -60,7 +60,7 @@ module MailEater
# end
m = ProcessedMails.new
- m.subject = Iconv('utf8', DEFAULT_ENC, mail.subject.to_s)
+ m.subject = Iconv.conv('utf8', DEFAULT_ENC, mail.subject.to_s)
m.m_id = mail.message_id
m.in_reply_to = mail.in_reply_to
m.repo = (repo || 'UNKNOWN').downcase
12 years, 11 months
[Trapaas] fix
by Maros Zatko
commit 82f3896eba0894ba315892ece146aa46ebd07c9b
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 17:40:16 2011 +0200
fix
mail-eater.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/mail-eater.rb b/mail-eater.rb
index 840bd06..9d04f53 100644
--- a/mail-eater.rb
+++ b/mail-eater.rb
@@ -65,7 +65,7 @@ module MailEater
m.in_reply_to = mail.in_reply_to
m.repo = (repo || 'UNKNOWN').downcase
m.from_git = gited
- m.from = Iconv('utf8', DEFAULT_ENC, mail.from.to_s)
+ m.from = Iconv.conv('utf8', DEFAULT_ENC, mail.from.to_s)
m.status = ("ack" if acked) || ("nak" if naked) || ("rev" if reviw) || 'unk'
m.date = mail.date
m.body = mail.body.raw_source
12 years, 11 months
[Trapaas] added missing require
by Maros Zatko
commit 3ff573c212cb8d1684d8045cb61e33dab1c873e3
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 17:32:42 2011 +0200
added missing require
mail-eater.rb | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/mail-eater.rb b/mail-eater.rb
index c4b105e..840bd06 100644
--- a/mail-eater.rb
+++ b/mail-eater.rb
@@ -1,6 +1,7 @@
require 'rubygems'
require 'db'
require 'mail'
+require 'iconv'
module MailEater
12 years, 11 months
[Trapaas] added default email's source encoding
by Maros Zatko
commit 947f836ce27f2339dcf23877e60d79a7416dd81e
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 17:28:44 2011 +0200
added default email's source encoding
mail-eater.rb | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/mail-eater.rb b/mail-eater.rb
index 4b3ecf7..c4b105e 100644
--- a/mail-eater.rb
+++ b/mail-eater.rb
@@ -3,6 +3,9 @@ require 'db'
require 'mail'
module MailEater
+
+ DEFAULT_ENC = 'iso-8859-2'
+
def self.clean_processed
ProcessedMails.destroy_all
MailRefs.destroy_all
@@ -56,12 +59,12 @@ module MailEater
# end
m = ProcessedMails.new
- m.subject = mail.subject
+ m.subject = Iconv('utf8', DEFAULT_ENC, mail.subject.to_s)
m.m_id = mail.message_id
m.in_reply_to = mail.in_reply_to
m.repo = (repo || 'UNKNOWN').downcase
m.from_git = gited
- m.from = mail.from.to_s
+ m.from = Iconv('utf8', DEFAULT_ENC, mail.from.to_s)
m.status = ("ack" if acked) || ("nak" if naked) || ("rev" if reviw) || 'unk'
m.date = mail.date
m.body = mail.body.raw_source
12 years, 11 months
[Trapaas] minor bugfix
by Maros Zatko
commit a6c75904769887f00f1d6aa3e4adbc7fd748d882
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 16:24:15 2011 +0200
minor bugfix
import_archives.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/import_archives.sh b/import_archives.sh
index bd9d343..ce4fe51 100644
--- a/import_archives.sh
+++ b/import_archives.sh
@@ -26,6 +26,6 @@ for file in $1/*.gz ; do
iconv -t utf8 "$file_in_dir" > /dev/null
done
- ruby rawinput.rb $file_n -d
+ ruby rawinput.rb ${file_n}_/ -d
done
12 years, 11 months
[Trapaas] import tool - fixed iconv flood
by Maros Zatko
commit a4cd506a90c67ccf915ac443e8ca09bc5431c87a
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 16:20:46 2011 +0200
import tool - fixed iconv flood
import_archives.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/import_archives.sh b/import_archives.sh
index 954f5f9..bd9d343 100644
--- a/import_archives.sh
+++ b/import_archives.sh
@@ -23,7 +23,7 @@ for file in $1/*.gz ; do
for file_in_dir in ${file_n}_/* ; do
echo $file_in_dir
sed -i "1s/^/$STRING\n/" "$file_in_dir"
- iconv -t utf8 "$file_in_dir"
+ iconv -t utf8 "$file_in_dir" > /dev/null
done
ruby rawinput.rb $file_n -d
12 years, 11 months
[Trapaas] Import tool ability to use production db, fixed invalid input char
by Maros Zatko
commit 1afda3c6b941ea7bdedcf0b0ea3e1497b817e0bf
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 16:14:16 2011 +0200
Import tool ability to use production db, fixed invalid input char
db.rb | 2 +-
import_archives.sh | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/db.rb b/db.rb
index a94f0c3..9aa7b34 100644
--- a/db.rb
+++ b/db.rb
@@ -6,7 +6,7 @@ require 'yaml'
#load db config
yml = YAML.load_file('web/trapaas/config/database.yml')
-develcfg = yml["development"]
+develcfg = yml[ENV['RAILS_ENV'] || 'development']
#connect to db
#develcfg["database"] = 'tmp/db.sqlite' #File.join('web/trapaas/', develcfg["database"].dup)
diff --git a/import_archives.sh b/import_archives.sh
index 1a0081b..954f5f9 100644
--- a/import_archives.sh
+++ b/import_archives.sh
@@ -23,6 +23,7 @@ for file in $1/*.gz ; do
for file_in_dir in ${file_n}_/* ; do
echo $file_in_dir
sed -i "1s/^/$STRING\n/" "$file_in_dir"
+ iconv -t utf8 "$file_in_dir"
done
ruby rawinput.rb $file_n -d
12 years, 11 months
[Trapaas] Ability to specify working directory during import
by Maros Zatko
commit b0c870a18cbf60b1422285e209db1ba2fc70ed6f
Author: Maros Zatko <mzatko(a)redhat.com>
Date: Tue Jul 19 14:28:39 2011 +0200
Ability to specify working directory during import
import_archives.sh | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/import_archives.sh b/import_archives.sh
index 4b029ec..1a0081b 100644
--- a/import_archives.sh
+++ b/import_archives.sh
@@ -1,19 +1,19 @@
#!/bin/sh
function usage() {
- echo "$0 [pipermail archive] [mailing list email address]"
+ echo "$0 [working directory] [pipermail archive] [mailing list email address]"
}
-if [ $# -ne 2 ] ; then
+if [ $# -ne 3 ] ; then
usage
exit 1
fi
-wget -r $1 -l 1 -nd --accept=gz,txt
+wget -P $1 -r $2 -l 1 -nd --accept=gz,txt
-STRING="To: $2"
+STRING="To: $3"
-for file in *.gz ; do
+for file in $1/*.gz ; do
gunzip $file
file_n=`echo $file | sed 's/\.gz$//'`
12 years, 11 months