Tue Mar 11 17:41:45 2014 UTC ()
Add patch to avoid exception in git browser.

The underlying issue seems to be a race; if the spawned git log
command finishes before trac kills it, the os.kill() throws an
exception which is not caught.  Simply catch and ignore the exception.
I sent the patch to trac-devel@.


(gdt)
diff -r1.63 -r1.64 pkgsrc/www/trac/Makefile
diff -r1.32 -r1.33 pkgsrc/www/trac/distinfo
diff -r0 -r1.1 pkgsrc/www/trac/patches/patch-tracopt_versioncontrol_git_PyGIT.py

cvs diff -r1.63 -r1.64 pkgsrc/www/trac/Makefile (switch to unified diff)

--- pkgsrc/www/trac/Makefile 2014/01/25 10:45:22 1.63
+++ pkgsrc/www/trac/Makefile 2014/03/11 17:41:44 1.64
@@ -1,75 +1,76 @@ @@ -1,75 +1,76 @@
1# $NetBSD: Makefile,v 1.63 2014/01/25 10:45:22 wiz Exp $ 1# $NetBSD: Makefile,v 1.64 2014/03/11 17:41:44 gdt Exp $
2 2
3DISTNAME= Trac-1.0.1 3DISTNAME= Trac-1.0.1
4PKGNAME= ${DISTNAME:tl} 4PKGNAME= ${DISTNAME:tl}
 5PKGREVISION= 1
5CATEGORIES= devel www 6CATEGORIES= devel www
6MASTER_SITES= http://ftp.edgewall.org/pub/trac/ \ 7MASTER_SITES= http://ftp.edgewall.org/pub/trac/ \
7 ftp://ftp.edgewall.org/pub/trac/ 8 ftp://ftp.edgewall.org/pub/trac/
8 9
9MAINTAINER= gdt@NetBSD.org 10MAINTAINER= gdt@NetBSD.org
10HOMEPAGE= http://trac.edgewall.org/ 11HOMEPAGE= http://trac.edgewall.org/
11COMMENT= Repository browser, wiki, and issue tracking system 12COMMENT= Repository browser, wiki, and issue tracking system
12LICENSE= modified-bsd 13LICENSE= modified-bsd
13 14
14# Maintainer notes: 15# Maintainer notes:
15# 16#
16# This package is similar to wip/trac, which in turn structurally 17# This package is similar to wip/trac, which in turn structurally
17# matches www/ja-trac. Ideally, www/trac and ja-trac would converge. 18# matches www/ja-trac. Ideally, www/trac and ja-trac would converge.
18# This note outlines the known differences and proposed resolution. 19# This note outlines the known differences and proposed resolution.
19# Besides bringing the packages closer, a goal is to avoid breaking 20# Besides bringing the packages closer, a goal is to avoid breaking
20# existing trac installations that blindly upgrade, to the extent that 21# existing trac installations that blindly upgrade, to the extent that
21# this is reasonable. 22# this is reasonable.
22# 23#
23# www/trac options are not in options.mk (to be fixed). 24# www/trac options are not in options.mk (to be fixed).
24# 25#
25# This package supports sqlite3 or postgresql. 26# This package supports sqlite3 or postgresql.
26# ja-trac supports sqlite3, postgresql, and mysql. 27# ja-trac supports sqlite3, postgresql, and mysql.
27# ja-trac uses py-sqlite2 (separate Python DB API 2.0 support for sqlite3) 28# ja-trac uses py-sqlite2 (separate Python DB API 2.0 support for sqlite3)
28# while this package uses py-sqlite3 (bundled support for sqlite3). 29# while this package uses py-sqlite3 (bundled support for sqlite3).
29 30
30DEPENDS+= ${PYPKGPREFIX}-genshi>=0.6:../../www/py-genshi 31DEPENDS+= ${PYPKGPREFIX}-genshi>=0.6:../../www/py-genshi
31# Arguably there should be a trac-svn package that depends on 32# Arguably there should be a trac-svn package that depends on
32# subversion and trac. This line is residual from when trac always 33# subversion and trac. This line is residual from when trac always
33# included subversion support. 34# included subversion support.
34#DEPENDS+= ${PYPKGPREFIX}-subversion>=1.6:../../devel/py-subversion 35#DEPENDS+= ${PYPKGPREFIX}-subversion>=1.6:../../devel/py-subversion
35 36
36USE_TOOLS+= pax 37USE_TOOLS+= pax
37 38
38PKG_OPTIONS_VAR= PKG_OPTIONS.trac 39PKG_OPTIONS_VAR= PKG_OPTIONS.trac
39PKG_OPTIONS_REQUIRED_GROUPS= db 40PKG_OPTIONS_REQUIRED_GROUPS= db
40PKG_OPTIONS_GROUP.db= sqlite psycopg2 41PKG_OPTIONS_GROUP.db= sqlite psycopg2
41PKG_SUGGESTED_OPTIONS= sqlite 42PKG_SUGGESTED_OPTIONS= sqlite
42 43
43.include "../../mk/bsd.options.mk" 44.include "../../mk/bsd.options.mk"
44 45
45PYDISTUTILSPKG= YES 46PYDISTUTILSPKG= YES
46PY_PATCHPLIST= YES 47PY_PATCHPLIST= YES
47REPLACE_PYTHON= contrib/cgi-bin/trac.* contrib/*.py contrib/*-hook 48REPLACE_PYTHON= contrib/cgi-bin/trac.* contrib/*.py contrib/*-hook
48REPLACE_PYTHON+= trac/tests/functional/*.py 49REPLACE_PYTHON+= trac/tests/functional/*.py
49PYTHON_VERSIONS_INCOMPATIBLE= 33 # not yet ported as of 1.0 50PYTHON_VERSIONS_INCOMPATIBLE= 33 # not yet ported as of 1.0
50 51
51.include "../../lang/python/application.mk" 52.include "../../lang/python/application.mk"
52 53
53.if !empty(PKG_OPTIONS:Msqlite) 54.if !empty(PKG_OPTIONS:Msqlite)
54DEPENDS+= ${PYPKGPREFIX}-sqlite3>=0:../../databases/py-sqlite3 55DEPENDS+= ${PYPKGPREFIX}-sqlite3>=0:../../databases/py-sqlite3
55.endif 56.endif
56# trac 0.12 dropped support for py-PgSQL. Switching to py-psycopg2 with 57# trac 0.12 dropped support for py-PgSQL. Switching to py-psycopg2 with
57# an existing database that used to be accessed by py-PgSQL worked. 58# an existing database that used to be accessed by py-PgSQL worked.
58.if !empty(PKG_OPTIONS:Mpsycopg2) 59.if !empty(PKG_OPTIONS:Mpsycopg2)
59DEPENDS+= ${PYPKGPREFIX}-psycopg2>=2:../../databases/py-psycopg2 60DEPENDS+= ${PYPKGPREFIX}-psycopg2>=2:../../databases/py-psycopg2
60.endif 61.endif
61# MySQL is sort of supported but not recommended by upstream and hence 62# MySQL is sort of supported but not recommended by upstream and hence
62# omitted. 63# omitted.
63 64
64EGDIR= ${PREFIX}/share/examples/trac 65EGDIR= ${PREFIX}/share/examples/trac
65CGIBINDIR= ${PREFIX}/libexec/trac 66CGIBINDIR= ${PREFIX}/libexec/trac
66 67
67post-install: 68post-install:
68 ${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR} 69 ${INSTALL_DATA_DIR} ${DESTDIR}${EGDIR}
69 ${INSTALL_PROGRAM_DIR} ${DESTDIR}${CGIBINDIR} 70 ${INSTALL_PROGRAM_DIR} ${DESTDIR}${CGIBINDIR}
70 ${INSTALL_SCRIPT} ${WRKSRC}/contrib/cgi-bin/trac.* ${DESTDIR}${CGIBINDIR} 71 ${INSTALL_SCRIPT} ${WRKSRC}/contrib/cgi-bin/trac.* ${DESTDIR}${CGIBINDIR}
71 cd ${WRKSRC}/contrib && pax -rwppm -s ',./rpm/.*$$,,' -s ',./rpm$$,,' \ 72 cd ${WRKSRC}/contrib && pax -rwppm -s ',./rpm/.*$$,,' -s ',./rpm$$,,' \
72 . ${DESTDIR}${EGDIR} 73 . ${DESTDIR}${EGDIR}
73 74
74.include "../../lang/python/egg.mk" 75.include "../../lang/python/egg.mk"
75.include "../../mk/bsd.pkg.mk" 76.include "../../mk/bsd.pkg.mk"

cvs diff -r1.32 -r1.33 pkgsrc/www/trac/distinfo (switch to unified diff)

--- pkgsrc/www/trac/distinfo 2014/01/21 22:29:33 1.32
+++ pkgsrc/www/trac/distinfo 2014/03/11 17:41:44 1.33
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
1$NetBSD: distinfo,v 1.32 2014/01/21 22:29:33 gdt Exp $ 1$NetBSD: distinfo,v 1.33 2014/03/11 17:41:44 gdt Exp $
2 2
3SHA1 (Trac-1.0.1.tar.gz) = b4fffeb171a64299597be616002aee44054673f6 3SHA1 (Trac-1.0.1.tar.gz) = b4fffeb171a64299597be616002aee44054673f6
4RMD160 (Trac-1.0.1.tar.gz) = db9abe8f7e52b28aa933187fd2be40bb4a544617 4RMD160 (Trac-1.0.1.tar.gz) = db9abe8f7e52b28aa933187fd2be40bb4a544617
5Size (Trac-1.0.1.tar.gz) = 3479896 bytes 5Size (Trac-1.0.1.tar.gz) = 3479896 bytes
 6SHA1 (patch-tracopt_versioncontrol_git_PyGIT.py) = e0ccdbe2c6a0dc83009460a214763d9d5eccdf04

File Added: pkgsrc/www/trac/patches/Attic/patch-tracopt_versioncontrol_git_PyGIT.py
$NetBSD: patch-tracopt_versioncontrol_git_PyGIT.py,v 1.1 2014/03/11 17:41:44 gdt Exp $

The git browser can fail if the git log process has already exited when
trac tries to terminate it (resulting in a python exception).

This patch should be applied upstream; Reported to trac-devel@ on 2014-03-11.

--- tracopt/versioncontrol/git/PyGIT.py.orig	2013-02-01 00:47:41.000000000 +0000
+++ tracopt/versioncontrol/git/PyGIT.py
@@ -913,7 +913,11 @@ class Storage(object):
                         except ValueError:
                             break
             f.close()
-            terminate(p[0])
+            # The process may or may not have finished.
+            try:
+                terminate(p[0])
+            except:
+                pass
             p[0].wait()
             p[:] = []
             while True:
@@ -930,7 +934,10 @@ class Storage(object):
 
         if p:
             p[0].stdout.close()
-            terminate(p[0])
+            try:
+                terminate(p[0])
+            except:
+                pass
             p[0].wait()
 
     def last_change(self, sha, path, historian=None):