ページ更新: 2009-11-06 (金) (4578日前)
関連: ../RedHat (RedHat 8/9), Linux/CentOS (2008-09-23 新規作成) CentOS にTrac (+mod_python + apache), Subversion (+mod_dav_svn) をインストールする手順のメモ。 この文書は、不具合の追試「CentOS 4.x + Python 2.3.x で GanttCalendarPlugin が動作しない(エラーが出る)」のための環境を作って、 そのついでに作成したもの。 なお、CentOS 5.2の環境 (Python 2.4.3, Subversion 1.4.2, Apache 2.2.3) も用意してあるので、そのうち追記するかも。 (2009-04-01にCentOS 5.3が出たようなので、5.3にするかも) 目次 はじめに #
CentOS 4.7 + Dag Repository、Trac 0.11.1.ja1 インストール (2008-09-23) #[編集]使用環境 (2008-09-28) #
CentOS 4.7のインストール #CentOS-4.7-i386-binDVD.iso を使用した。ミラーサイトが豊富にあり、ダウンロードも高速でありがたい。 (CentOS 4.x系って、netinstall ないのかな?) インストール手順は省略。次のようにした:
インストールが完了した後の作業は全てssh経由で行う。 とりあえず、アップデートしておく: # yum update 再起動が必要な場合(例:カーネルが入れ替えられたなど)、OSを再起動しておく。 ついでに、.bashrcに自分のお気に入りの設定を追加しておく: alias pd="pushd" alias pp="popd" bind '"\C-n": history-search-forward' bind '"\C-p": history-search-backward' HISTFILESIZE=30000 HISTSIZE=5000 HISTCONTROL=ignoredups export PS1='\n$?:[\u@\h \t] \w\n\$ ' VMware-toolsはインストールしてない(手抜き)。なので時間が狂いまくる(ホストはWinXP Pro SP3, Core2Quad Q6700, SpeedStep有効) [編集]rpmforge-releaseパッケージ #あらかじめ、次のページを読んでおく:
今回は出来るだけ yumでインストールすることにした。 念のため、tracパッケージは存在しないことを確かめる(自分はCentOSに疎いので): # yum search trac | grep '^trac\.' # RPMforge/Using - RPMRepo WikiとDAG: Frequently Asked Questionsを参考にして、rpmforge-releaseパッケージをインストールする: # rpm -Uhv http://apt.sw.be/redhat/el4/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el4.rf.i386.rpm : : rpmforge-releaseパッケージのことをよく知らないので、ファイル一覧を見ておく。 apt, smart, up2date, yumの設定が更新されるようだ: # rpm -ql rpmforge-release /etc/apt /etc/apt/sources.list.d /etc/apt/sources.list.d/rpmforge.list /etc/pki/rpm-gpg /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dries /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-matthias /etc/smart /etc/smart/channels /etc/smart/channels/rpmforge.channel /etc/sysconfig/rhn /etc/sysconfig/rhn/sources.rpmforge.txt /etc/yum.repos.d /etc/yum.repos.d/mirrors-rpmforge /etc/yum.repos.d/rpmforge.repo /usr/share/doc/rpmforge-release-0.3.6 /usr/share/doc/rpmforge-release-0.3.6/RPM-GPG-KEY-rpmforge-dag /usr/share/doc/rpmforge-release-0.3.6/RPM-GPG-KEY-rpmforge-dries /usr/share/doc/rpmforge-release-0.3.6/RPM-GPG-KEY-rpmforge-matthias /usr/share/doc/rpmforge-release-0.3.6/mirrors-rpmforge.yum /usr/share/doc/rpmforge-release-0.3.6/rpmforge.apt /usr/share/doc/rpmforge-release-0.3.6/rpmforge.smart /usr/share/doc/rpmforge-release-0.3.6/rpmforge.up2date /usr/share/doc/rpmforge-release-0.3.6/rpmforge.yum Subversionはbaseが1.1.4 (bdbがデフォルト(fsfsも使えるだろうけど), ロック機能がない、svnsyncがない)ってことで、rpmforgeの1.4.6を使うことにする。 yum search したり、yum install tracで依存パッケージを調べたり、実際にインストールしてrpm -qlで ファイルを調べた。 Apache + Trac + Subversion (mod_dav_svn) + Python (mod_python) の組み合わせを使うので、以下のようにしてみた: # yum install apr apr-util httpd subversion mod_dav_svn mod_python : : Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: apr i386 0.9.4-24.9 base 93 k apr-util i386 0.9.4-22.el4 base 51 k httpd i386 2.0.52-41.ent.centos4 base 902 k mod_dav_svn i386 1.4.6-0.1.el4.rf rpmforge 188 k mod_python i386 3.1.3-5.1 base 568 k subversion i386 1.4.6-0.1.el4.rf rpmforge 4.1 M Installing for dependencies: httpd-suexec i386 2.0.52-41.ent.centos4 base 30 k Transaction Summary ============================================================================= Install 7 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 5.9 M Is this ok [y/N]: y ★ Downloading Packages: : : Installed: apr.i386 0:0.9.4-24.9 apr-util.i386 0:0.9.4-22.el4 httpd.i386 0:2.0.52-41.ent.centos4 mod_dav_svn.i386 0:1.4.6-0.1.el4.rf mod_python.i386 0:3.1.3-5.1 subversion.i386 0:1.4.6-0.1.el4.rf Dependency Installed: httpd-suexec.i386 0:2.0.52-41.ent.centos4 [編集]setuptoolsとPythonモジュールをインストールする #EasyInstall - The PEAK Developers' Center に従い、setuptoolsをインストールする。エラー回避のために-Zでeggを展開する (= Genshiはegg-cacheを使わなくなる): # wget http://peak.telecommunity.com/dist/ez_setup.py # python ez_setup.py Downloading http://pypi.python.org/packages/2.3/s/setuptools/setuptools-0.6c8-py2.3.egg Processing setuptools-0.6c8-py2.3.egg creating /usr/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg Extracting setuptools-0.6c8-py2.3.egg to /usr/lib/python2.3/site-packages Adding setuptools 0.6c8 to easy-install.pth file Installing easy_install script to /usr/bin Installing easy_install-2.3 script to /usr/bin Installed /usr/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg Processing dependencies for setuptools==0.6c8 Finished processing dependencies for setuptools==0.6c8 Genshi (テンプレートエンジン) をインストールする: # easy_install -Z genshi Searching for genshi Reading http://pypi.python.org/simple/genshi/ Couldn't find index page for 'genshi' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://pypi.python.org/simple/ Reading http://pypi.python.org/simple/Genshi/ Reading http://genshi.edgewall.org/ Reading http://genshi.edgewall.org/wiki/Download Best match: Genshi 0.5.1 Downloading http://ftp.edgewall.com/pub/genshi/Genshi-0.5.1-py2.3-linux-i686.egg Processing Genshi-0.5.1-py2.3-linux-i686.egg creating /usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg Extracting Genshi-0.5.1-py2.3-linux-i686.egg to /usr/lib/python2.3/site-packages Adding Genshi 0.5.1 to easy-install.pth file Installed /usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg Processing dependencies for genshi Finished processing dependencies for genshi ついでに、Pygments (ソースコードの構文強調表示処理エンジン) をインストールする: # easy_install pygments Searching for pygments Reading http://pypi.python.org/simple/pygments/ Couldn't find index page for 'pygments' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading http://pypi.python.org/simple/ Reading http://pypi.python.org/simple/Pygments/ Reading http://pygments.pocoo.org/ Best match: Pygments 0.11.1 Downloading http://pypi.python.org/packages/2.3/P/Pygments/Pygments-0.11.1-py2.3.egg #md5=4802519f36d9c6027534a45a8e6bcc68 Processing Pygments-0.11.1-py2.3.egg creating /usr/lib/python2.3/site-packages/Pygments-0.11.1-py2.3.egg Extracting Pygments-0.11.1-py2.3.egg to /usr/lib/python2.3/site-packages Adding Pygments 0.11.1 to easy-install.pth file Installing pygmentize script to /usr/bin Installed /usr/lib/python2.3/site-packages/Pygments-0.11.1-py2.3.egg Processing dependencies for pygments Finished processing dependencies for pygments[編集] Trac-0.11.1.ja1をインストールする #インタアクト株式会社--業務内容--公開資料 から、Trac-0.11.1.ja1.zipを入手して、インストールする: # wget http://www.i-act.co.jp/project/products/downloads/Trac-0.11.1.ja1.zip # unzip Trac-0.11.1.ja1.zip Archive: Trac-0.11.1.ja1.zip creating: Trac-0.11.1.ja1/ : # cd Trac-0.11.1.ja1 # python setup.py install running install running bdist_egg : : Processing Trac-0.11.1.ja1-py2.3.egg creating /usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg Extracting Trac-0.11.1.ja1-py2.3.egg to /usr/lib/python2.3/site-packages Adding Trac 0.11.1.ja1 to easy-install.pth file Installing trac-admin script to /usr/bin Installing tracd script to /usr/bin Installed /usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg Processing dependencies for Trac==0.11.1.ja1 Searching for Genshi==0.5.1 Best match: Genshi 0.5.1 Processing Genshi-0.5.1-py2.3-linux-i686.egg Genshi 0.5.1 is already the active version in easy-install.pth Using /usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg Searching for setuptools==0.6c8 Best match: setuptools 0.6c8 Processing setuptools-0.6c8-py2.3.egg setuptools 0.6c8 is already the active version in easy-install.pth Installing easy_install script to /usr/bin Installing easy_install-2.3 script to /usr/bin Using /usr/lib/python2.3/site-packages/setuptools-0.6c8-py2.3.egg Finished processing dependencies for Trac==0.11.1.ja1[編集] tracdを使って動作を確認する #仮のSubversionリポジトリを作る。念のためverifyもしておく: # svnadmin create /tmp/svn # svnadmin verify /tmp/svn * リビジョン 0 を検証しました。 仮のTrac環境を作る。★以外の入力項目はすべてEnterのみ入力する: # trac-admin /tmp/trac initenv : Path to repository [/path/to/repos]> /tmp/svn ★先ほど作ったリポジトリを指定 : # tracd --port 8000 /tmp/trac Server starting in PID 3794. Serving on 0.0.0.0:8000 view at http://127.0.0.1:8000/ : : Webブラウザでアクセスして動作を確認する。ただし、ユーザを用意していないので、閲覧しかできないけど。 確認が終わったら、ctrl-Cを入力してtracdを止める。 さらに、仮のSubversionリポジトリとTrac環境を削除する: # rm -rf /tmp/svn /tmp/trac[編集] Apache httpdの確認 #CentOSのApache httpdのことはよく知らないので、設定ファイルの位置・内容、実効ユーザ・グループなどを調べておく。 設定ファイルの位置とディレクトリの構成: # rpm -ql httpd | grep httpd.conf /etc/httpd/conf /etc/httpd/conf.d /etc/httpd/conf.d/README /etc/httpd/conf.d/welcome.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf/magic プロセス。インストール直後には起動していない: # ps aux | grep http # netstat -an | grep :80 起動スクリプトのオプション: # /etc/init.d/httpd 使い方: httpd {start|stop|restart|condrestart|reload|statusfullstatus|graceful|help|configtest}
httpdの実効ユーザ・グループを調べる: # grep /var/www /etc/passwd apache:x:48:48:Apache:/var/www:/sbin/nologin # grep apache /etc/group apache:x:48: ログファイルの位置を調べる: # grep ErrorLog /etc/httpd/conf/httpd.conf # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> ErrorLog logs/error_log # ErrorLog logs/dummy-host.example.com-error_log # ls -al /etc/httpd/ 合計 20 drwxr-xr-x 4 root root 4096 9月 23 17:14 . drwxr-xr-x 80 root root 4096 9月 23 17:14 .. drwxr-xr-x 2 root root 4096 9月 23 17:14 conf drwxr-xr-x 2 root root 4096 9月 23 17:15 conf.d lrwxrwxrwx 1 root root 19 9月 23 17:14 logs -> ../../var/log/httpd lrwxrwxrwx 1 root root 27 9月 23 17:14 modules -> ../../usr/lib/httpd/modules lrwxrwxrwx 1 root root 13 9月 23 17:14 run -> ../../var/run # httpd -l Compiled in modules: core.c prefork.c http_core.c mod_so.c /etc/httpd/conf.d/ を調べておく(コメント行以外を調べる): # grep -v '^#' /etc/httpd/conf.d/*.conf | uniq /etc/httpd/conf.d/python.conf: /etc/httpd/conf.d/python.conf:LoadModule python_module modules/mod_python.so ★ /etc/httpd/conf.d/python.conf: /etc/httpd/conf.d/python.conf:<Directory "/var/www/manual/mod/mod_python"> /etc/httpd/conf.d/python.conf: <Files *.html> /etc/httpd/conf.d/python.conf: SetHandler default-handler /etc/httpd/conf.d/python.conf: </Files> /etc/httpd/conf.d/python.conf:</Directory> /etc/httpd/conf.d/python.conf: /etc/httpd/conf.d/subversion.conf: /etc/httpd/conf.d/subversion.conf:LoadModule dav_svn_module modules/mod_dav_svn.so ★ /etc/httpd/conf.d/subversion.conf:LoadModule authz_svn_module modules/mod_authz_svn.so ★ /etc/httpd/conf.d/subversion.conf: /etc/httpd/conf.d/welcome.conf:<LocationMatch "^/+$"> /etc/httpd/conf.d/welcome.conf: Options -Indexes /etc/httpd/conf.d/welcome.conf: ErrorDocument 403 /error/noindex.html /etc/httpd/conf.d/welcome.conf:</LocationMatch> /etc/httpd/conf.d/welcome.conf: #
起動して、ログファイルを眺めてみる: # /etc/init.d/httpd start httpd を起動中: [ OK ] # lsof -i | grep apache httpd 3961 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3962 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3963 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3964 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3965 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3966 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3969 apache 3u IPv6 11712 TCP *:http (LISTEN) httpd 3970 apache 3u IPv6 11712 TCP *:http (LISTEN) # /etc/init.d/httpd status httpd (pid 3970 3969 3966 3965 3964 3963 3962 3961 3960) を実行中... ログファイルを眺めてみる: # ls -l /var/log/httpd/ 合計 8 -rw-r--r-- 1 root root 1162 9月 23 17:54 access_log -rw-r--r-- 1 root root 1008 9月 23 17:54 error_log # cat /var/log/httpd/error_log [Tue Sep 23 17:39:10 2008] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Tue Sep 23 17:39:10 2008] [notice] Digest: generating secret for digest authentication ... [Tue Sep 23 17:39:10 2008] [notice] Digest: done [Tue Sep 23 17:39:10 2008] [notice] LDAP: Built with OpenLDAP LDAP SDK [Tue Sep 23 17:39:10 2008] [notice] LDAP: SSL support unavailable [Tue Sep 23 17:39:10 2008] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads. [Tue Sep 23 17:39:10 2008] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations : : Webブラウザでアクセスして、ちゃんと初期画面が見えることを確認しておく。 [編集]SubversionリポジトリとTrac環境を作成し、httpdを設定する (2008-09-28訂正) #訂正:
方針:
資料:自分はApache 2.0を最近使っていないので(Apache 1.3と2.2を使っている)、以下の文書を読んでおく:
Subversionリポジトリを1つ作成する: # mkdir /var/trac /var/svn # svnadmin create /var/svn/sandbox Trac環境を1つ作成する: # trac-admin /var/trac/sandbox initenv Creating a new Trac environment at /var/trac/sandbox : Project Name [My Project]> Sandbox ★Tracプロジェクト名 : Path to repository [/path/to/repos]> /var/svn/sandbox ★先ほど作ったリポジトリを指定 : httpdからアクセスするので、ユーザとグループをapacheに変更する: # chown -R apache:apache /var/trac /var/svn /etc/httpd/conf.d/svntrac.conf を新たに作成し、ここに今回の設定を全て記入する。 (1) 最初にSubversionだけを有効にしておき、他の設定はコメントアウトしておく: <Location "/svn"> DAV svn SVNParentPath "/var/svn" SVNListParentPath on # AuthType Digest # AuthName trac # AuthDigestFile "/var/trac/htdigest" # Require valid-user </Location> #<Location "/trac"> # SetHandler mod_python # PythonHandler trac.web.modpython_frontend # PythonOption TracEnvParentDir "/var/trac/" # PythonOption TracUriRoot /trac # PythonOption PYTHON_EGG_CACHE "/var/cache/egg" #</Location> #<LocationMatch "/[^/]+/login"> # AuthType Digest # AuthName trac # AuthDigestFile "/var/trac/htdigest" # Require valid-user #</LocationMatch> Syntaxを検査して: # /etc/init.d/httpd configtest Syntax OK httpdに読み込ませて、ログを確認する: # /etc/init.d/httpd reload httpd を再読み込み中: [ OK ] # tail /var/log/httpd/error_log : : [Tue Sep 23 20:04:45 2008] [notice] SIGHUP received. Attempting to restart [Tue Sep 23 20:04:45 2008] [notice] Digest: generating secret for digest authentication ... [Tue Sep 23 20:04:45 2008] [notice] Digest: done [Tue Sep 23 20:04:45 2008] [notice] LDAP: Built with OpenLDAP LDAP SDK [Tue Sep 23 20:04:45 2008] [notice] LDAP: SSL support unavailable [Tue Sep 23 20:04:45 2008] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads. [Tue Sep 23 20:04:45 2008] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations # Webブラウザで http://host/svn/sandbox/ にアクセスしてみる。問題なく表示されればOK。 (2) 次に、Digest認証ファイルを作って: # htdigest -c /var/trac/htdigest trac admin Adding password for admin in realm trac. New password: Re-type new password: # chown apache:apache /var/trac/htdigest Location "/svn"の認証処理部分も有効にして: <Location "/svn"> DAV svn SVNParentPath "/var/svn" SVNListParentPath on AuthType Digest AuthName trac AuthDigestFile "/var/trac/htdigest" Require valid-user </Location> : : Syntaxの確認、httpdへの反映、ログの検査を行う: # /etc/init.d/httpd configtest # /etc/init.d/httpd reload # tail /var/log/httpd/error_log Webブラウザで http://host/svn/sandbox/ にアクセスして、認証ダイアログが表示され、さらに認証にパスできればOK。 (3) 次に、Location "/trac"の設定を全て有効にして: <Location "/trac"> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir "/var/trac/" PythonOption TracUriRoot /trac PythonOption PYTHON_EGG_CACHE "/var/cache/egg" </Location> egg_cacheのディレクトリを作って: # mkdir /var/cache/egg # chown apache:apache /var/cache/egg/ Syntaxの確認、httpdへの反映、ログの検査を行う: # /etc/init.d/httpd configtest # /etc/init.d/httpd reload # tail /var/log/httpd/error_log http://ホスト/trac/ にアクセスして、プロジェクト一覧と先ほど作成したプロジェクトが表示されることと、http://ホスト/trac/sandbox/ にアクセスして、Tracの画面が表示されることと、そしてリポジトリブラウザでSubverionリポジトリが閲覧できることを確認する。 (4) 最後に、Tracの認証の設定を有効にして: <LocationMatch "/[^/]+/login"> AuthType Digest AuthName trac AuthDigestFile "/var/trac/htdigest" Require valid-user </LocationMatch> adminユーザにTRAC_ADMIN権限を付与して: # trac-admin /var/trac/sandbox permission add admin TRAC_ADMIN # chown -R apache:apache /var/trac Syntaxの確認、httpdへの反映、ログの検査を行う: # /etc/init.d/httpd configtest # /etc/init.d/httpd reload # tail /var/log/httpd/error_log http://ホスト/trac/sandbox/ にアクセスして、Tracにログインして、一通りの操作をしてみる。 Subversionリポジトリからのチェックアウト、コミットや、Tracのチケット作成、Wiki編集、Tracの「管理」メニューの動作を確認しておく。 [編集]trac-post-commit-hook の設定 #trac-post-commit-hookの設定を行う。この設定は必須ではないけど、せっかくTracとSubversionを使うなら設定しておきたい。 Trac-0.11.1.ja1.zipからcontrib/trac-post-commit-hookを取りだして、/usr/local/sbin/ にコピーする。 # cp Trac-0.11.1.ja1/contrib/trac-post-commit-hook /usr/local/sbin/ 先ほど作ったSubversionリポジトリに、以下の内容のpost-commitフックスクリプト /var/svn/sandbox/hooks/post-commit を作成する: #!/bin/sh REPOS="$1" REV="$2" TRAC_ENV=/var/trac/sandbox /usr/bin/python /usr/local/sbin/trac-post-commit-hook -p "$TRAC_ENV" -r "$REV" 実行権限を付与し、所有者をapacheにする: # chmod +x /var/svn/sandbox/hooks/post-commit # chown apache:apache /var/svn/sandbox/hooks/post-commit Tracチケットを1つ作成し、assignedにして、Subversionリポジトリにコミットして(コミットログに refs #xx や fixed #xxを記入して)、動作を確認しておく。 [編集]IniAdminPluginのインストール (2008-09-28) #IniAdminプラグインをインストールする (Trac 0.11系用のプラグインをSubversionリポジトリから直接得てインストール): # easy_install http://trac-hacks.org/svn/iniadminplugin/0.11 Downloading http://trac-hacks.org/svn/iniadminplugin/0.11 Doing subversion checkout from http://trac-hacks.org/svn/iniadminplugin/0.11 to /tmp/easy_install-LOJ5s-/0.11 Processing 0.11 Running setup.py -q bdist_egg --dist-dir /tmp/easy_install-LOJ5s-/0.11/egg-dist-tmp-NTgrD8 zip_safe flag not set; analyzing archive contents... Adding IniAdmin 0.2 to easy-install.pth file Installed /usr/lib/python2.3/site-packages/IniAdmin-0.2-py2.3.egg Processing dependencies for IniAdmin==0.2 Finished processing dependencies for IniAdmin==0.2 Trac (Apache) を再起動する: # /etc/init.d/httpd restart httpd を停止中: [ OK ] httpd を起動中: [ OK ] IniAdminプラグインを有効にする。Tracにアクセスし、TRAC_ADMIN権限を持つユーザ(先ほど作った「admin」ユーザ)でログインして、画面右上の「管理」を選んで以下の画面の用に操作する: [編集] SubversionリポジトリとTrac環境の追加 #以後は、Apache httpdの設定は不要。 次の手順でいくつでも環境を作成できる。(注: TRAC_ADMIN権限を割り当てるユーザーは適宜変更し、htdigestコマンドで追加しておくこと) # svnadmin create /var/svn/project_n # trac-admin /var/trac/project_n initenv # trac-admin /var/trac/sandbox permission add admin TRAC_ADMIN /var/svn/project_n/hooks/post-commit-hook を作成 (既存のものをコピーし、TRAC_ENV変数を書き換える) # chown -R apache:apache /var/trac /var/svn[編集] Python 2.3.x で GanttCalendarPlugin が動作しない(エラーが出る)件について #CentOS 4.x + Python 2.3.x で plugins/GanttCalendarPlugin - Shibuya.trac Wiki でエラーが出る件について。
以下、自分で調べるために環境を作ったときのメモ。VMware Workstation 6.5.1(jp)を使用。 [編集]r144 #最新版をSubverisonリポジトリから入手し、インストールする: $ svn co http://svn.sourceforge.jp/svnroot/shibuya-trac/plugins/ganttcalendarplugin/trunk / A trunk/README.ja A trunk/ganttcalendar A trunk/ganttcalendar/htdocs A trunk/ganttcalendar/htdocs/csshover2.htc A trunk/ganttcalendar/htdocs/img A trunk/ganttcalendar/htdocs/img/arrow_to.png A trunk/ganttcalendar/htdocs/img/arrow_from.png A trunk/ganttcalendar/htdocs/img/arrow_bw.png A trunk/ganttcalendar/htdocs/img/package.png A trunk/ganttcalendar/ticketcalendar.py A trunk/ganttcalendar/__init__.py A trunk/ganttcalendar/setup.py A trunk/ganttcalendar/ticketgantt.py A trunk/ganttcalendar/templates A trunk/ganttcalendar/templates/gantt.html A trunk/ganttcalendar/templates/calendar.html A trunk/setup.py A trunk/setup.cfg リビジョン 144 をチェックアウトしました。 $ su Password: # easy_install trunk Processing trunk Running setup.py -q bdist_egg --dist-dir /home/username/trunk/egg-dist-tmp-0NkSqL zip_safe flag not set; analyzing archive contents... Adding TracGanttCalendarPlugin 0.1-r144 to easy-install.pth file Installed /usr/lib/python2.3/site-packages/TracGanttCalendarPlugin-0.1_r144-py2.3.egg Processing dependencies for TracGanttCalendarPlugin==0.1-r144 Finished processing dependencies for TracGanttCalendarPlugin==0.1-r144 動作確認用にTracプロジェクトを作成し、tracd で起動する: $ trac-admin sample initenv ... $ htdigest -c htdigest sample admin ... $ tracd --port 8000 --auth sample,/home/username/htdigest,sample /home/username/sample Server starting in PID 5513. ... プロジェクトにアクセスすると、以下のエラーが発生する: [編集] r145 #2009-01-20 ganttcalendarplugin r145で試してみた。エラーが発生する。今回はWebブラウザのスクリーンショットではなく、Tracのログを提示した: conf/trac.ini のログ設定部分: [logging] log_file = trac.log log_level = DEBUG log_type = file log/trac.log の該当エラー個所: 2009-01-20 22:22:05,862 Trac[main] ERROR: "timedelta" not defined Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg/trac/web/main.py", line 424, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg/trac/web/main.py", line 220, in dispatch data, content_type) File "/usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg/trac/web/chrome.py", line 715, in render_template return stream.render(method, doctype=doctype) File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 179, in render return encode(generator, method=method, encoding=encoding, out=out) File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 60, in encode return _encode(u''.join(list(iterator))) File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 311, in __call__ for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 753, in __call__ for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 592, in __call__ for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 698, in __call__ for kind, data, pos in chain(stream, [(None, None, None)]): File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/output.py", line 532, in __call__ for ev in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg/trac/web/chrome.py", line 767, in _strip_accesskeys for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/usr/lib/python2.3/site-packages/Trac-0.11.1.ja1-py2.3.egg/trac/web/chrome.py", line 756, in _generate for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 569, in _include for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 298, in _match ctxt, start=idx + 1, **vars): File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 298, in _match ctxt, start=idx + 1, **vars): File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 245, in _match for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 543, in _exec for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 533, in _eval for event in substream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 496, in _eval for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 551, in _flatten for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/path.py", line 141, in _generate subevent = stream.next() File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 569, in _include for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 234, in _strip event = stream.next() File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 543, in _exec for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 533, in _eval for event in substream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 496, in _eval for kind, data, pos in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 551, in _flatten for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/core.py", line 283, in _ensure for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/path.py", line 141, in _generate subevent = stream.next() File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 569, in _include for event in stream: File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/markup.py", line 234, in _strip event = stream.next() File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 545, in _exec _exec_suite(event[1], ctxt, **vars) File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/base.py", line 302, in _exec_suite suite.execute(_ctxt2dict(ctxt)) File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/eval.py", line 201, in execute exec self.code in _globals, data File "/home/username/.python-eggs/TracGanttCalendarPlugin-0.1_r145-py2.3.egg-tmp/ganttcalendar/templates/gantt.html", line 1, in <Suite u'cur = cur + timedelta(days=1) ...'> <html xmlns="http://www.w3.org/1999/xhtml" File "/usr/lib/python2.3/site-packages/Genshi-0.5.1-py2.3-linux-i686.egg/genshi/template/eval.py", line 279, in _die raise UndefinedError(self._name, self._owner) UndefinedError: "timedelta" not defined[編集] r147 #(2009-01-26) 修正したとのこと。エラーが発生しないことを確認した。以下、確認手順を示す。 手元のワーキングコピーを r147 (最新) に更新、easy_installで上書きインストール: $ svn up gantt ... $ sudo easy_install -U gantt Processing gantt Running setup.py -q bdist_egg --dist-dir /home/username/gantt/egg-dist-tmp-ZFJ-6J zip_safe flag not set; analyzing archive contents... ganttcalendar.ticketcalendar: module references __file__ ganttcalendar.ticketgantt: module references __file__ Removing TracGanttCalendarPlugin 0.1-r145 from easy-install.pth file Adding TracGanttCalendarPlugin 0.1-r147 to easy-install.pth file Installed /usr/lib/python2.3/site-packages/TracGanttCalendarPlugin-0.1_r147-py2.3.egg Processing dependencies for TracGanttCalendarPlugin==0.1-r147 Finished processing dependencies for TracGanttCalendarPlugin==0.1-r147 確認用にtracdで起動: $ tracd --port 8000 --auth sample,/home/username/htdigest,sample /home/username/sample Server starting in PID 21611. Serving on 0.0.0.0:8000 view at http://127.0.0.1:8000/ このtracのhttp://ホスト:8000/sample/ticketgantt にアクセスすると……エラーがなくなった! trac.log (DEBUG) はこんなの: 2009-01-26 22:42:22,916 Trac[main] DEBUG: Dispatching <Request "GET u'/ticketgantt'"> 2009-01-26 22:42:22,916 Trac[ticketgantt] DEBUG: process_request /usr/lib/python2.3/site-packages/ TracGanttCalendarPlugin-0.1_r147-py2.3.egg/ganttcalendar/ticketgantt.pyc 2009-01-26 22:42:22,917 Trac[ticketgantt] DEBUG: SELECT id, type, summary, owner, t.description, status, a.value, c.value, cmp.value, milestone, component FROM ticket t JOIN ticket_custom a ON a.ticket = t.id AND a.name = 'due_assign' JOIN ticket_custom c ON c.ticket = t.id AND c.name = 'due_close' JOIN ticket_custom cmp ON cmp. ticket = t.id AND cmp.name = 'complete' WHERE status <> 'closed' ORDER by component , a.value 2009-01-26 22:42:22,918 Trac[ticketgantt] DEBUG: SELECT name, due, completed, description FROM milestone 2009-01-26 22:42:22,919 Trac[session] DEBUG: Retrieving session for ID 'xxxxxxxxxxxxxxxxxxx' 2009-01-26 22:42:22,919 Trac[ticketgantt] DEBUG: SELECT name FROM component 2009-01-26 22:42:23,160 Trac[chrome] DEBUG: Prepare chrome data for request 2009-01-26 22:42:23,162 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None 2009-01-26 22:42:23,164 Trac[perm] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None 2009-01-26 22:42:23,165 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None 2009-01-26 22:42:23,166 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None 2009-01-26 22:42:23,167 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None 2009-01-26 22:42:23,173 Trac[perm] DEBUG: No policy allowed anonymous performing EMAIL_VIEW on None 2009-01-26 22:42:23,332 Trac[main] DEBUG: 1315 unreachable objects found. 2009-01-26 22:42:23,462 Trac[main] DEBUG: Dispatching <Request "GET u'/chrome/site/your_project_logo.png'"> 2009-01-26 22:42:23,463 Trac[chrome] WARNING: File your_project_logo.png not found in any of ['/home/username/sample/htdocs'] 2009-01-26 22:42:23,463 Trac[main] WARNING: 404 Not Found (File your_project_logo.png not found) 2009-01-26 22:42:23,464 Trac[chrome] DEBUG: Prepare chrome data for request 2009-01-26 22:42:23,465 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None 2009-01-26 22:42:23,465 Trac[perm] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None 2009-01-26 22:42:23,466 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None 2009-01-26 22:42:23,466 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None 2009-01-26 22:42:23,466 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None 2009-01-26 22:42:23,468 Trac[perm] DEBUG: No policy allowed anonymous performing EMAIL_VIEW on None 2009-01-26 22:42:23,468 Trac[session] DEBUG: Retrieving session for ID 'xxxxxxxxxxxxxxxxxxxxxx' 2009-01-26 22:42:23,506 Trac[main] DEBUG: 428 unreachable objects found. |