玄箱+debian-etch+trac-ja

以前,debiantractrac-jaパッケージを使ってうまく日本語化できなかったので,tar.gzを落としてインストールすることに。


1.trac-jaのダウンロード

# wget http://www.i-act.co.jp/project/products/downloads/trac-0.10.4-ja-1.zip
# unzip trac-0.10.4-ja-1.zip
# cd trac-0.10.4-ja-1/


2.INSTALLの中のRequirementsを読む

Requirements
                      • -
To install Trac, the following software packages must be installed: * Python, version >= 2.3. + Please keep in mind, that for RPM-based systems you will also need python-devel and python-xml packages. * Subversion, version >= 1.0. (>= 1.1.x recommended) * Subversion SWIG Python bindings (not PySVN). * PySQLite, version 1.x (for SQLite 2.x) or version 2.x (for SQLite 3.x) * Clearsilver, version >= 0.9.3 (0.9.14 recommended) * A web server capable of executing CGI/FastCGI scripts, or Apache HTTPD with mod_python. (Trac also comes with a standalone server, but its use is not recommended for use in a production environment.)


3.いろいろインストール

# apt-get install python python-dev
# apt-get install python-xml python-subversion
# apt-get install sqlite3
# apt-get install python-pysqlite2
# apt-get install python-clearsilver
# apt-get install libapache2-mod-fcgid
# apt-get install libapache2-mod-python


4.trac-jaのインストール

# python ./setup.py install


5.tracの設定

# mkdir /mnt/trac
# trac-admin /mnt/trac/private initenv
Project Name [My Project]> private    <==== 入力
Database connection string [sqlite:db/trac.db]>    <====[Enter]
Repository type [svn]>    <====[Enter]
Path to repository [/path/to/repos]> /mnt/svn/private    <==== 入力
Templates directory [/usr/share/trac/templates]>    <====[Enter]
# chown -R www-data:www-data /mnt/trac/private
# chmod -R g+w /mnt/trac/private/db


6.apache2の設定

# vi /etc/apache2/sites-available/default
# diff -u /etc/apache2/sites-available/default.org /etc/apache2/sites-available/default
--- /etc/apache2/sites-available/default.org    2008-01-17 21:51:42.000000000 +0900
+++ /etc/apache2/sites-available/default        2008-01-17 21:57:05.000000000 +0900
@@ -16,6 +16,19 @@
                 # in /apache2-default/, but still have / go to the right place
                 RedirectMatch ^/$ /apache2-default/
        </Directory>
+       <Location /trac>
+               SetHandler mod_python
+               PythonHandler trac.web.modpython_frontend
+               PythonOption TracEnvParentDir /mnt/trac
+               PythonOption TracUriRoot /trac
+       </Location>
+       <LocationMatch "/trac/[^/]+/login">
+               AuthType Basic
+               AuthName "trac"
+               AuthUserFile /etc/apache2/dav_svn.passwd
+               Require valid-user
+       </LocationMatch>
+

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">


7.mod_pythonを有効化

# a2enmod mod_python


8.apache2再起動

# /etc/init.d/apache2 force-reload


9.trac権限の設定

# trac-admin /mnt/trac/private permission add USER TRAC_ADMIN    <=自分にadmin
# trac-admin /mnt/trac/private permission remove anonymous CHANGESET_VIEW FILE_VIEW LOG_VIEW REPORT_SQL_VIEW SEARCH_VIEW TICKET_CREATE TICKET_MODIFY TIMELINE_VIEW WIKI_CREATE WIKI_MODIFY

こんな感じになってたらOK

# trac-admin /mnt/trac/private permission list

User       Action
                                                • -
anonymous BROWSER_VIEW anonymous MILESTONE_VIEW anonymous REPORT_VIEW anonymous ROADMAP_VIEW anonymous TICKET_VIEW anonymous WIKI_VIEW USER TRAC_ADMIN


10.commitとチケットクローズの連携
英語版のパッケージをダウンロードして日本語版には含まれていないツールを取り出す。

# wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
# tar zxvf trac-0.10.4.tar.gz
# cp trac-0.10.4/contrib/trac-post-commit-hook /mnt/svn/private/hooks/

# cp trac-0.10.4-ja-1/contrib/trac-post-commit-hook /mnt/svn/private/hooks/
# vi /mnt/svn/private/hooks/post-commit
#!/bin/sh

# post commit scripts

REPOS="$1"
REV="$2"
LOG=`/usr/bin/svnlook log -r $REV $REPOS`
AUTHOR=`/usr/bin/svnlook author -r $REV $REPOS`
TRAC_ENV='/mnt/trac/private/'
TRAC_URL='http://hogehoge/trac/private/'

/usr/bin/python /mnt/svn/private/hooks/trac-post-commit-hook \
 -p "$TRAC_ENV"  \
 -r "$REV"       \
 -u "$AUTHOR"    \
 -m "$LOG"       \
 -s "$TRAC_URL"

# It searches commit messages for text in the form of:
#   command #1
#   command #1, #2
#   command #1 & #2
#   command #1 and #2
#
# You can have more then one command in a message. The following commands
# are supported. There is more then one spelling for each command, to make
#
#   closes, fixes
#     The specified issue numbers are closed with the contents of this
#     commit message being added to it.
#   references, refs, addresses, re
#     The specified issue numbers are left in their current status, but
#     the contents of this commit message are added to their notes.
#
# A fairly complicated example of what you can do is with a commit message
# of:
#
#    Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.
#
# This will close #10 and #12, and add a note to #12.
# chown www-data:www-data /mnt/svn/private/hooks/post-commit
# chmod 755 /mnt/svn/private/hooks/post-commit


11.tracの設定ファイルをちょこちょこいじる。

# vi /mnt/trac/private/conf/trac.ini


玄人志向 KURO-BOX/HG NAS組み立てキット
玄人志向
売り上げランキング: 1099
おすすめ度の平均: 4.5
5 家庭用サーバにぴったりです
4 余ったハードディスクでいろいろできる
4 パワーPCでのLinux