Re: [PATCH] cli: crypto: tell gmime to use gpg-agent
[notmuch-archives.git] / 68 / 7758f84fabd8a123e9b674d2b68997d1f1e9c2
1 Return-Path: <bremner@tesseract.cs.unb.ca>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 9A264431FBF\r
6         for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 11:57:36 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id aQRV8C1u27ur for <notmuch@notmuchmail.org>;\r
16         Mon,  9 Jul 2012 11:57:34 -0700 (PDT)\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
18         (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 4A36E431FAE\r
21         for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 11:57:34 -0700 (PDT)\r
22 Received: from remotemail by tesseract.cs.unb.ca with local (Exim 4.72)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1SoJ9J-00057m-Bh; Mon, 09 Jul 2012 15:57:33 -0300\r
25 Received: (nullmailer pid 17673 invoked by uid 1000);\r
26         Mon, 09 Jul 2012 18:57:26 -0000\r
27 From: david@tethera.net\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH v3] contrib/nmbug: add nmbug-status script\r
30 Date: Mon,  9 Jul 2012 12:57:23 -0600\r
31 Message-Id: <1341860243-17376-1-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.7.10\r
33 In-Reply-To: <1341810546-28857-1-git-send-email-david@tethera.net>\r
34 References: <1341810546-28857-1-git-send-email-david@tethera.net>\r
35 Cc: David Bremner <bremner@debian.org>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Mon, 09 Jul 2012 18:57:37 -0000\r
49 \r
50 From: David Bremner <bremner@debian.org>\r
51 \r
52 This is (almost) the same script as has been used for\r
53 http://nmbug.tethera.net/status for a while now. The only change is\r
54 that the configuration is not hardcoded anymore. By default the config\r
55 is fetched from a special branch in the nmbug repo that contains only\r
56 config info. The idea is that push access to this branch can be\r
57 restricted a bit more than the tags, since it will change the\r
58 appearence of the web pages.\r
59 ---\r
60 \r
61 This revised version tries to be more clever about getting the config\r
62 from git, so the local user doesn't need to fiddle with the nmbug git\r
63 repo.\r
64 \r
65  contrib/nmbug/nmbug-status       |  147 ++++++++++++++++++++++++++++++++++++++\r
66  contrib/nmbug/status-config.json |   65 +++++++++++++++++\r
67  2 files changed, 212 insertions(+)\r
68  create mode 100755 contrib/nmbug/nmbug-status\r
69  create mode 100644 contrib/nmbug/status-config.json\r
70 \r
71 diff --git a/contrib/nmbug/nmbug-status b/contrib/nmbug/nmbug-status\r
72 new file mode 100755\r
73 index 0000000..dcbe588\r
74 --- /dev/null\r
75 +++ b/contrib/nmbug/nmbug-status\r
76 @@ -0,0 +1,147 @@\r
77 +#!/usr/bin/python\r
78 +#\r
79 +# Copyright (c) 2011-2012 David Bremner <david@tethera.net>\r
80 +# License: Same as notmuch\r
81 +# dependencies\r
82 +#       - python 2.6 for json\r
83 +#       - argparse; either python 2.7, or install seperately\r
84 +\r
85 +import datetime\r
86 +import notmuch\r
87 +import sys\r
88 +import rfc822\r
89 +import urllib\r
90 +import json\r
91 +import argparse\r
92 +import os\r
93 +import subprocess\r
94 +\r
95 +# parse command line arguments\r
96 +\r
97 +parser = argparse.ArgumentParser()\r
98 +parser.add_argument("--text", help="output plain text format",\r
99 +                   action="store_true")\r
100 +\r
101 +parser.add_argument("--config", help="load config from given file")\r
102 +\r
103 +\r
104 +args = parser.parse_args()\r
105 +\r
106 +# read config from json file\r
107 +\r
108 +if args.config != None:\r
109 +    fp = open(args.config)\r
110 +else:\r
111 +    nmbhome = os.getenv('NMBGIT',os.path.expanduser("~/.nmbug"))\r
112 +\r
113 +    # read only the first line from the pipe\r
114 +    sha1 =  subprocess.Popen(['git','--git-dir',nmbhome,\r
115 +                     'show-ref','-s','config'],\r
116 +                      stdout=subprocess.PIPE).stdout.readline()\r
117 +    sha1=sha1.rstrip()\r
118 +\r
119 +    fp =  subprocess.Popen(['git','--git-dir',nmbhome,\r
120 +                            'cat-file','blob',sha1+':status-config.json'],\r
121 +                           stdout=subprocess.PIPE).stdout\r
122 +\r
123 +config=json.load(fp)\r
124 +\r
125 +if args.text:\r
126 +    format = 'text'\r
127 +else:\r
128 +    format = 'html'\r
129 +\r
130 +headers = ['date', 'from', 'subject']\r
131 +last = {}\r
132 +\r
133 +def clear_last():\r
134 +    for header in headers:\r
135 +       last[header] = ''\r
136 +\r
137 +def print_view(title, query, comment):\r
138 +\r
139 +    query_string = " and ".join(query)\r
140 +    q_new = notmuch.Query(db, query_string)\r
141 +    q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)\r
142 +\r
143 +\r
144 +    last['thread_id'] = ''\r
145 +\r
146 +    if format == 'html':\r
147 +       print '<h3>%s</h3>' % title\r
148 +       print comment\r
149 +       print 'The view is generated from the following query:'\r
150 +       print '<blockquote>'\r
151 +       print query_string\r
152 +       print '</blockquote>'\r
153 +       print '<table>\n'\r
154 +\r
155 +    for m in q_new.search_messages():\r
156 +\r
157 +       out = {};\r
158 +\r
159 +       thread_id = m.get_thread_id()\r
160 +       if thread_id != last['thread_id']:\r
161 +           clear_last()\r
162 +\r
163 +       for header in headers:\r
164 +           val = m.get_header(header)\r
165 +\r
166 +           if header == 'date':\r
167 +               val = str.join(' ', val.split(None)[1:4])\r
168 +               val = str(datetime.datetime.strptime(val, '%d %b %Y').date())\r
169 +           elif header == 'from':\r
170 +               val = rfc822.parseaddr(val)[0]\r
171 +\r
172 +           if last[header] == val:\r
173 +               out[header] = ""\r
174 +           else:\r
175 +               out[header] = val.encode('utf-8')\r
176 +               last[header] = val\r
177 +\r
178 +       mid = m.get_message_id()\r
179 +       out['id'] = 'id:"%s"' % mid\r
180 +\r
181 +       if format == 'html':\r
182 +           # XXX using <br /> is a hack, but ... // 20111216 too\r
183 +           if thread_id != last['thread_id']:\r
184 +               br = '<br />'\r
185 +           else:\r
186 +               br = ''\r
187 +           out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' % (urllib.quote(mid), out['subject'])\r
188 +           print " <tr><td>%s %s" % (br, out['date'])\r
189 +           print "</td><td>%s %s" % (br, out['id'])\r
190 +           print "</td></tr>"\r
191 +           print " <tr><td>%s" % out['from']\r
192 +           print "</td><td>%s" % out['subject']\r
193 +           print "</td></tr>\n"\r
194 +       else:\r
195 +           print '%(date)-10.10s %(from)-20.20s %(subject)-40.40s\n%(id)72s\n' % out\r
196 +\r
197 +       last['thread_id'] = thread_id\r
198 +\r
199 +    if format == 'html':\r
200 +       print '</table>'\r
201 +\r
202 +# main program\r
203 +\r
204 +db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
205 +\r
206 +if format == 'html':\r
207 +    print '''<?xml version="1.0" encoding="utf-8" ?>\r
208 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
209 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
210 +<head>\r
211 +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
212 +<title>Notmuch Patches</title>\r
213 +</head>\r
214 +<body>''';\r
215 +    print '<h2>Notmuch Patches</h2>'\r
216 +    print 'Generated: %s<br />' % datetime.datetime.utcnow().date()\r
217 +    print 'For more infomation see <a href="http://notmuchmail.org/nmbug">nmbug</a>'\r
218 +\r
219 +for view in config['views']:\r
220 +    print_view(**view)\r
221 +\r
222 +if format == 'html':\r
223 +    print '</body>\n</html>'\r
224 diff --git a/contrib/nmbug/status-config.json b/contrib/nmbug/status-config.json\r
225 new file mode 100644\r
226 index 0000000..6b4934f\r
227 --- /dev/null\r
228 +++ b/contrib/nmbug/status-config.json\r
229 @@ -0,0 +1,65 @@\r
230 +{\r
231 +    "views": [\r
232 +       {\r
233 +           "comment": "Unresolved bugs (or just need tag updating).",\r
234 +           "query": [\r
235 +               "tag:notmuch::bug",\r
236 +               "not tag:notmuch::fixed",\r
237 +               "not tag:notmuch::wontfix"\r
238 +           ],\r
239 +           "title": "Bugs"\r
240 +       },\r
241 +       {\r
242 +           "comment": "These patches are under consideration for pushing.",\r
243 +           "query": [\r
244 +               "tag:notmuch::patch and not tag:notmuch::pushed",\r
245 +               "not tag:notmuch::obsolete and not tag:notmuch::wip",\r
246 +               "not tag:notmuch::stale and not tag:notmuch::contrib",\r
247 +               "not tag:notmuch::moreinfo",\r
248 +               "not tag:notmuch::python",\r
249 +               "not tag:notmuch::vim",\r
250 +               "not tag:notmuch::wontfix",\r
251 +               "not tag:notmuch::needs-review"\r
252 +           ],\r
253 +           "title": "Maybe Ready (Core and Emacs)"\r
254 +       },\r
255 +       {\r
256 +           "comment": "These python related patches might be ready to push, or they might just need updated tags.",\r
257 +           "query": [\r
258 +               "tag:notmuch::patch and not tag:notmuch::pushed",\r
259 +               "not tag:notmuch::obsolete and not tag:notmuch::wip",\r
260 +               "not tag:notmuch::stale and not tag:notmuch::contrib",\r
261 +               "not tag:notmuch::moreinfo",\r
262 +               "not tag:notmuch::wontfix",\r
263 +               " tag:notmuch::python",\r
264 +               "not tag:notmuch::needs-review"\r
265 +           ],\r
266 +           "title": "Maybe Ready (Python)"\r
267 +       },\r
268 +       {\r
269 +           "comment": "These vim related patches might be ready to push, or they might just need updated tags.",\r
270 +           "query": [\r
271 +               "tag:notmuch::patch and not tag:notmuch::pushed",\r
272 +               "not tag:notmuch::obsolete and not tag:notmuch::wip",\r
273 +               "not tag:notmuch::stale and not tag:notmuch::contrib",\r
274 +               "not tag:notmuch::moreinfo",\r
275 +               "not tag:notmuch::wontfix",\r
276 +               "tag:notmuch::vim",\r
277 +               "not tag:notmuch::needs-review"\r
278 +           ],\r
279 +           "title": "Maybe Ready (vim)"\r
280 +       },\r
281 +       {\r
282 +           "comment": "These patches are under review, or waiting for feedback.",\r
283 +           "query": [\r
284 +               "tag:notmuch::patch",\r
285 +               "not tag:notmuch::pushed",\r
286 +               "not tag:notmuch::obsolete",\r
287 +               "not tag:notmuch::stale",\r
288 +               "not tag:notmuch::wontfix",\r
289 +               "(tag:notmuch::moreinfo or tag:notmuch::needs-review)"\r
290 +           ],\r
291 +           "title": "Review"\r
292 +       }\r
293 +    ]\r
294 +}\r
295 -- \r
296 1.7.10\r
297 \r