mod_dav_svn
Apache と SVN 連携の為に
http://d.hatena.ne.jp/seiunsky/20080212/1202832078の続き
mod_dav_svn モジュールをインストールしたい。
Mac の場合、 port でインストールするのが王道のようだ。
Macintosh% sudo port install subversion +mod_dav_svn Password: ---> Building sqlite3 with target all Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.5.6" && gnumake all " returned error 1 Command output: sh: line 0: cd: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.5.6: No such file or directory Error: The following dependencies failed to build: apache2 apr-util sqlite3 pcre neon Error: Status 1 encountered during processing.
エラーがでる。というか、そもそも subversion は port 経由でインストールしているわけでは無かった模様。
確認したところ、subversion は無い。
Macintosh% sudo port installed The following ports are currently installed: apr @1.2.12_0+darwin_9 (active) clearsilver @0.10.5_0 (active) db44 @4.4.20_1 (active) expat @2.0.1_0 (active) gauche @0.8.12_0 (active) gawk @3.1.6_0 (active) gdbm @1.8.3_1 (active) gettext @0.17_3 (active) libiconv @1.12_0 (active) ncurses @5.6_0 (active) ncursesw @5.6_1 (active) openssl @0.9.8g_0 (active) perl5.8 @5.8.8_1 (active) py25-hashlib @2.5.1_0 (active) python25 @2.5.1_4+darwin_9 (active) readline @5.2.007_0+darwin_9 (active) slib @3a3_0 (active) wget @1.10.2_0 (active) zlib @1.2.3_1 (active)
ネットで調べるとみんな当然のように port から入れているけど、これはどうすりゃいいんだ。
今インストールされている subversion と重複するけど、とりあえずインストールを試みる。
Macintosh% sudo port clean subversion ---> Cleaning subversion Macintosh% sudo port install subversion ---> Building sqlite3 with target all Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.5.6" && gnumake all " returned error 1 Command output: sh: line 0: cd: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.5.6: No such file or directory Error: The following dependencies failed to build: apr-util sqlite3 neon Error: Status 1 encountered during processing.
だめぽ。色々足りないと言っているぞ。特に sqlite3 でこけている?
sqlite3 をインストールしてみる。
Macintosh% sudo port install sqlite3 ---> Building sqlite3 with target all Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.5.6" && gnumake all " returned error 1 Command output: sh: line 0: cd: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_sqlite3/work/sqlite-3.5.6: No such file or directory Error: Status 1 encountered during processing.
sqlite3 が存在しないと言っている? お前、自分でファイルとりにいってるんじゃねーのかよ・・・。
試しに、クリーンしてからトライしてみよう。
Macintosh% sudo port clean sqlite3 ---> Cleaning sqlite3
クリーンしたので再度実行。
Macintosh% sudo port install sqlite3 ---> Fetching sqlite3 ---> Attempting to fetch sqlite-3.5.6.tar.gz from http://www.sqlite.org/ ---> Verifying checksum(s) for sqlite3 ---> Extracting sqlite3 ---> Applying patches to sqlite3 ---> Configuring sqlite3 ---> Building sqlite3 with target all ---> Staging sqlite3 into destroot ---> Installing sqlite3 3.5.6_0 ---> Activating sqlite3 3.5.6_0 ---> Cleaning sqlite3
お、インストールできたっぽい。確認してみる。
Macintosh% sudo port installed The following ports are currently installed: apr @1.2.12_0+darwin_9 (active) clearsilver @0.10.5_0 (active) db44 @4.4.20_1 (active) expat @2.0.1_0 (active) gauche @0.8.12_0 (active) gawk @3.1.6_0 (active) gdbm @1.8.3_1 (active) gettext @0.17_3 (active) libiconv @1.12_0 (active) ncurses @5.6_0 (active) ncursesw @5.6_1 (active) openssl @0.9.8g_0 (active) perl5.8 @5.8.8_1 (active) py25-hashlib @2.5.1_0 (active) python25 @2.5.1_4+darwin_9 (active) readline @5.2.007_0+darwin_9 (active) slib @3a3_0 (active) sqlite3 @3.5.6_0 (active) wget @1.10.2_0 (active) zlib @1.2.3_1 (active)
どうやらインストールできたようだ。もう一度 subversion を試してみる。
既存の svn との絡みが気になるが、そこは置いておいて、本題の mod_dav_svn のインストール。
実は、この時に subversion をインストールし、その後 subversion +mod_dav_svn をインストールするという手順を行ったのだが、それだと subversion が2重にインストールされる事態になるらしい。なので、一度 subversion を port -u uninstall subversion @1.4.6_0(バージョンを指定する必要があるらしい)として、 subversion を消した状態で再度試した。
Macintosh% sudo port install subversion +mod_dav_svn ---> Installing subversion 1.4.6_0+mod_dav_svn ---> Activating subversion 1.4.6_0+mod_dav_svn ---> Cleaning subversion
また、上記で一度 mod_dav_svn をインストールして失敗したと書いたが、そのときに apache2 やら関連するツールのインストールも行われた。
Macintosh% sudo port installed The following ports are currently installed: apache2 @2.2.8_0+darwin_9 (active) apr @1.2.12_0+darwin_9 (active) apr-util @1.2.12_0 (active) clearsilver @0.10.5_0 (active) db44 @4.4.20_1 (active) expat @2.0.1_0 (active) gauche @0.8.12_0 (active) gawk @3.1.6_0 (active) gdbm @1.8.3_1 (active) gettext @0.17_3 (active) libiconv @1.12_0 (active) ncurses @5.6_0 (active) ncursesw @5.6_1 (active) neon @0.26.4_0 (active) openssl @0.9.8g_0 (active) pcre @7.6_0 (active) perl5.8 @5.8.8_1 (active) py25-hashlib @2.5.1_0 (active) python25 @2.5.1_4+darwin_9 (active) readline @5.2.007_0+darwin_9 (active) slib @3a3_0 (active) sqlite3 @3.5.6_0 (active) subversion @1.4.6_0+mod_dav_svn (active) wget @1.10.2_0 (active) zlib @1.2.3_1 (active)
で、問題なのは svn や apache2 を現在使っているものから新しい方へ切り替えないと行けないということだろう。
うーん、Mac のここら辺の流儀ってどうなんだ?
個人的には元々入っていたものは正規の手段で削除して、 MacPorts で入れたものだけがインストールされている状況にしたいのだけれど。
ひとまず、インストールされた subversion にパスが通っていない事とバージョンを確認してみる。
Macintosh% svn --version --quiet 1.4.4 Macintosh% /opt/local/bin/svn --version --quiet 1.4.6
やはりパスの通っている方は元々インストールされていた方だ。
一応、MacPorts でインストールされたツールは /opt/local/ 配下にあって、パスはそちらを優先するように設定しているはずなので、多分大丈夫だと思うんだが・・・。
環境の移植
apache は /opt/local/apache2 配下に実行ファイルや conf ファイルも固まっているので、以前作成した conf をこちらへコピーする。
しかし、install したばかりの apache2 には mod_fastcgi が入っていなかったので、それをインストールする(mod_python を入れてしまう手もあるんだけど、なんか使うバージョンが 2.4 系だったので変にハマったら嫌なので辞めておいた)。
sudo port install mod_fastcgi
インストールされると、 modules 配下に勝手にインストールされるので、他のモジュールと同じようなパスで追記してあげればOK。
あとは dav_svn の設定をすれば良いと思うのだけど、時間が厳しくなってきたのでまたあした。
※一応設定はしたものの、 http 経由でアクセスすると Could not open the requested SVN filesystemと思ったができたので書いておく。
というエラーが出ている。リポジトリ自体を svn 1.4.6 用にアップグレードする必要があるかもしれない*1。
リポジトリのパスは以下のようになっていることを想定して svn 用の apache の conf を記載する。
/var/svn/project
この project 配下に svn 用のファイルが入っているとしてください。
httpd-trac.conf に以下を追記する。
### svn ### <Location /svn> DAV svn SVNParentPath /var/svn # SVNPath /var/svn/project AuthType Basic AuthName "svn authoriztion" AuthUserFile /www/trac/conf/.htpasswd Require valid-user </Location>
SVNParentPath /var/svn とすることで複数プロジェクト向け(リポジトリ複数向け)の設定にできる。
URLは以下のようになる。
http://localhost/svn/project/
SVNPath で指定すると、 http://localhost/svn/ の下はいきなり trunk 等、 svn 上のディレクトリ構成になる。
これですべて環境が整ったはず。
長かったが、きちんと環境を構築できてとても清々しい。
一年前に Linux に構築しようとしていたのを思い出すと、何も成長していないようで絶望しますね/(^o^)\
*1:file:///でアクセスする分には大丈夫なんだが・・・