apache+svn+trac+viewvc on windows 備忘録

手間取ったのでメモ..._〆(゚▽゚*)

構成

OS Windows Vista SP2 x64
Python C:\Python25
DocumentRoot D:\File\www
SVN リポジトリ D:\File\SVN\hoge
Trac D:\File\Trac
ViewVC D:\File\ViewVC

複数リポジトリ構成可, Digest 認証

SVN 設定

set PATH=C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin;%PATH%
set PATH=C:\Program Files (x86)\Subversion\bin;%PATH%
rem リポジトリ作成
svnadmin create D:\File\SVN\hoge
rem ユーザは複数リポジトリで使い回す
move D:\File\SVN\hoge\conf D:\File\SVN\
htdigest D:\File\SVN\conf\passwd_digest subversion-repository xworks
mklink /J D:\File\SVN\hoge\conf D:\File\SVN\conf
D:\File\SVN\conf\authz
[groups]
member = xworks

[/]
* = r
@member = rw

DocumentRoot に svnindex.xsl, svnindex.css, menucheckout.ico を置いておく。

svnserve をサービスとして建てる場合は

sc create svnserve binpath= "\"C:\Program Files (x86)\Subversion\bin\svnserve.exe\" --service --root D:\File\SVN" displayname= "Subversion" depend= tcpip start= auto
sc description svnserve "Subversion Server (svnserve)"
D:\File\SVN\hoge\conf\svnserve.conf
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
D:\File\SVN\hoge\conf\passwd
[users]
xworks = hogehoge

Apache 設定

conf/httpd.conf
#適宜にモジュールをロード
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule python_module modules/mod_python.so
LoadModule ssl_module modules/mod_ssl.so
#ドキュメントルート設定
DocumentRoot "D:/File/www"
#設定を分離しておく
Include conf/sites/svn.conf
conf/sites/svn.conf
<Location /svn>
  DAV svn
  SVNParentPath D:/File/SVN/
  SVNIndexXSLT "/svnindex.xsl"
  AuthzSVNAccessFile D:/File/SVN/conf/authz

  AuthType Digest
  AuthDigestProvider file
  AuthName subversion-repository
  AuthUserFile D:/File/SVN/conf/passwd_digest
  Require valid-user

  Satisfy Any
  Order Deny,Allow
  Deny from All
  Allow from 127.0.0.1
  Allow from 192.168.0.0/16
</Location>

##
## for Trac with mod_python
##
<Location /trac>
  SetHandler mod_python
  PythonHandler trac.web.modpython_frontend
  PythonOption TracUriRoot /trac
  PythonOption TracEnvParentDir D:/File/Trac
  PythonOption PYTHON_EGG_CACHE D:/File/Trac/.egg-cache
</Location>

<LocationMatch "/trac/[^/]+/login">
  AuthType Digest
  AuthDigestProvider file
  AuthName subversion-repository
  AuthUserFile D:/File/SVN/conf/passwd_digest
  Require valid-user
</LocationMatch>


##
## for ViewVC with mod_python
##
ScriptAlias /viewvc "D:/File/ViewVC/bin/mod_python/viewvc.py"
<Location /viewvc>
  AddHandler mod_python .py
  PythonPath "[r'D:\\File\\ViewVC\\bin\\mod_python']+sys.path"
  PythonHandler handler
  AddDefaultCharset UTF-8
  Options +Includes

  AuthType Digest
  AuthDigestProvider file
  AuthName subversion-repository
  AuthUserFile D:/File/SVN/conf/passwd_digest
  Require valid-user

  Satisfy Any
  Order Deny,Allow
  Deny from All
  Allow from 127.0.0.1
  Allow from 192.168.0.0/16
</Location>

Trac

easy_setup.py, Trac-0.11.5.ja1.zip(展開済み) の DIR で

set PATH=C:\Python25;C:\Python25\Scripts;%PATH%
python easy_setup.py
easy_install Pygments
easy_install Genshi
cd Trac-0.11.5.ja1
python setup.py bdist_egg
easy_install dist\Trac-0.11.5.ja1-py2.5.egg
trac-admin D:\File\Trac\hoge initenv
trac-admin D:\File\Trac\hoge permission add xworks TRAC_ADMIN
Project Name [My Project]> etc
Database connection string [sqlite:db/trac.db]> 
Repository type [svn]> 
Path to repository [/path/to/repos]> D:/File/SVN/etc

ViewVC

#なんとなくリポジトリから持ってきた (アカウント:guest, pass:空)

set PATH=C:\Program Files (x86)\Subversion\bin;%PATH%
set PATH=C:\Python25;%PATH%
svn co http://viewvc.tigris.org/svn/viewvc/tags/1.1.2 viewvc
cd viewvc
python viewvc-install
D:\File\ViewVC\viewvc.conf
root_parents = D:\File\SVN : svn

ImportError: No module named _wc に引っかかった時には
C:\Python25\Lib\site-packages\libsvn\_wc.dll を C:\Python25\Lib\site-packages\libsvn\_wc.pyd にリネームする。