cvsweb とは、 Web ブラウザによって CVS リポジトリの内容を閲覧するためのツールだ (画面イメージ)。 そして CvsGraph は、 cvsweb と連携しつつ、各ファイルの変更履歴をツリー状に図示してくれるツールである (画面イメージ)。
CVS のオリジナルパッケージにはリポジトリの内容を一覧するためのツールが含まれていない。 リポジトリの置かれているファイルシステムに直接アクセスできるならば、 ls などでリポジトリディレクトリの中味を表示させてやることもできるが、 リモートクライアントから CVS サーバにアクセスしている場合はそうもいかない。 というわけで、cvsweb のようなツールが必要とされるわけである。
cvsweb は perl で書かれた CGI スクリプトである。 cvsweb が動作するためには以下の条件を満たす必要がある。
パッケージは、ここからダウンロードできる:
cvsweb.tar.gz (Rev. 1.112) (36k)
(アクセスできなかった場合は、
cvsweb
からダウンロードすること)
適当なディレクトリで上記 tarball を展開する。 cvsweb には気の利いたインストーラなどは添付されていないので、 各自、自分の環境に合わせて手動でインストールする必要がある。 まず、以下の項目を決定しておく。
決定した項目の内容に従って、cvsweb.cgi と cvsweb.conf を修正する。 ここでは /home/httpd に apache を介してアクセスできるデータがあるとして、 /home/httpd/cgi-bin/cvsweb というディレクトリを作成し、 そこに cvsweb.conf および cvsweb.cgi をコピーすることにする。 上記項目の設定は以下のようになる。
CGI ファイルのパス /home/httpd/cgi-bin/cvsweb/cvsweb.cgi 構成ファイルのパス /home/httpd/cgi-bin/cvsweb/cvsweb.conf アイコンファイルのパス /home/httpd/icons/back.gif など CVS リポジトリのパスおよび名前 /proj/cvsroot および "Project"
修正内容は次のとおりである。 (ここに以下の全パッチと簡単なコマンド操作履歴を書いたテキストファイルを置いておく)
http://cvsserver.somedomain.com/cgi-bin/cvsweb/cvsweb.cgi
CVSWEB_CONFIG を設定する)。
@@ -123,7 +123,7 @@ sub OSCODE();
##### Start of Configuration Area ########
# == EDIT this ==
# User configuration is stored in
-$config = $ENV{'CVSWEB_CONFIG'} || '/usr/local/web/apache/conf/cvsweb.conf';
+$config = $ENV{'CVSWEB_CONFIG'} || '/home/httpd/cgi-bin/cvsweb/cvsweb.conf';
# == Configuration defaults ==
# Defaults for configuration variables that shouldn't need
@@ -23,6 +23,7 @@ # 'symbolic_name' 'path_to_the_actual_repository' %CVSROOT = ( + 'Project' => '/proj/cvsroot', 'Development' => '/usr/local/src/cvsrep', 'Configuration' => '/tmp/cvsroot/conf', 'HTML-files' => '/tmp/upload'
@@ -160,7 +162,7 @@ EOT
# format: TEXT ICON-URL width height
%ICONS = (
back => [ ("[BACK]", "/icons/back.gif", 20, 22) ],
- dir => [ ("[DIR]", "/icons/dir.gif", 20, 22) ],
+ dir => [ ("[DIR]", "/icons/folder.gif", 20, 22) ],
file => [ ("[TXT]", "/icons/text.gif", 20, 22) ],
);
もし /home/httpd/icons が存在しなければ、cvsweb パッケージに添付されている
アイコンファイル (icons ディレクトリに格納されている) を適当なディレクトリにコピーして、
それへのパスで置き換えるとよい。
locate などで mime.types というファイルのありかを探して正しいパスを設定する。@@ -278,7 +280,7 @@ $inputTextSize = 12; # cvsweb to guess the correct mime-type on # checkout; you can use the mime.types from # apache here: -$mime_types = '/usr/local/web/apache/conf/mime.types'; +$mime_types = '/usr/share/webmin/mime.types'; # quick mime-type lookup; maps file-suffices to # mime-types for displaying checkouts in the browser.
上記の修正が終わったら、後は次のようにしてファイルをコピーすればよい。
$ su # mkdir /home/httpd/cgi-bin/cvsweb # cp cvsweb.cgi /home/httpd/cgi-bin/cvsweb/ # cp cvsweb.conf /home/httpd/cgi-bin/cvsweb/
CvsGraph は php3 と Cで書かれたプログラムから構成されている。 したがって、apache などで php3 モジュールが動作可能になっている必要がある。
CvsGraph パッケージは、ここからダウンロードできる:
cvsgraph-1.3.0.tar.gz
(アクセスできなかった場合は、
CvsGraph
からダウンロードすること)
適当なディレクトリで上記 tarball を展開したら、configure & make を行う。
$ tar xzf cvsgraph-1.3.0.tar.gz $ cd cvsgraph-1.3.0 $ ./configure $ make
configure & make あるいはプログラムの実行時に、 「GD ライブラリが無い」というようなエラーが出るかもしれない。 その場合は、http://www.boutell.com から GD ライブラリをダウンロードしてきてビルドすること。 私の環境ではすでに GD ライブラリがインストールされていた (doxygen 絡みで graphvis をインストールした時に勝手に入ったのかも?)。 詳しくは、添付の README を読むこと。
CvsGraph を cvsweb と連携させるために、cvsweb.cgi に次のようなパッチを当てる必要がある。
@@ -378,8 +378,9 @@ if (!-d $cvsroot) {
#
# See if the module is in our forbidden list.
#
-$where =~ m:([^/]*):;
+$where =~ m:([^/]*)/(.*):;
$module = $1;
+my $pathinrepository = $2;
if ($module && &forbidden_module($module)) {
&fatal("403 Forbidden", "Access to $where forbidden.");
}
@@ -641,7 +642,7 @@ elsif (-d $fullname) {
next if (!defined($fileinfo{$_}));
($rev,$date,$log,$author) = @{$fileinfo{$_}};
$filesfound++;
- print "<tr bgcolor=\"" . @tabcolors[$dirrow%2] . "\"><td>" if ($dirtable);
+ print "<tr bgcolor=\"" . @tabcolors[$dirrow%2] . "\"><td nowrap>" if ($dirtable);
print "<A NAME=\"$_\"></A>";
if ($nofilelinks) {
print $fileicon;
@@ -650,6 +651,14 @@ elsif (-d $fullname) {
print &link($fileicon,$url);
}
print " ", &link($_, $url), $attic;
+#*** BS Entered graphing option
+ print "<a href=\"/cvsgraph/cvsgraphwrapper.php3" .
+ (length($query) != 0 ? "$query\&" : "?") .
+ "r=" . urlencode($cvsroot) .
+ "\&m=" . urlencode($module) .
+ "\&f=" . urlencode($pathinrepository . ($attic ? "Attic/" : "") . $_) .
+ "\"><img src=\"/icons/image3.gif\" border=\"0\" width=\"20\" height=\"22\"></a>";
+#***
print "</td><td> " if ($dirtable);
download_link($fileurl,
$rev, $rev,
実は上のパッチはオリジナル
とはちょっと変えてある。オリジナルではファイル名の隣に "Graph" という表示が出るのだが、
上のパッチではアイコン
が出るようになっている
(画面イメージ)。
また、表示が2行にならないように (非推奨とは知りつつも) td タグに nowrap を追加している。
次は、CvsGraph 一式を /home/httpd/html/cvsgraph ディレクトリに格納することを前提に、 以下のようなパッチを当てる。格納場所を変えるなら、それに合わせて以下のパッチも修正すること。
@@ -239,10 +239,10 @@ image_quality = 75; # These are the href= and alt= attributes in the <area> # tags of html. The strings are expanded (see above). map_name = "MyMapName"; -map_branch_href = "href=\"%9cvsweb_graph.cgi/%m%p?only_with_tag=%t%8\""; +map_branch_href = "href=\"/cgi-bin/cvsweb/cvsweb.cgi/%m%p?only_with_tag=%t%8\""; map_branch_alt = "alt=\"%0 %t (%B)\""; -map_rev_href = "href=\"%9cvsweb_graph.cgi/%m%p%F?rev=%R&content-type=text/x-cvsweb-markup%8\""; +map_rev_href = "href=\"/cgi-bin/cvsweb/cvsweb.cgi/%m%p%F?rev=%R&content-type=text/x-cvsweb-markup%8\""; map_rev_alt = "alt=\"%1 %t (%R)\""; -map_diff_href = "href=\"%9cvsweb_graph.cgi/%m%p%F.diff?r1=%P&r2=%R%8\""; +map_diff_href = "href=\"/cgi-bin/cvsweb/cvsweb.cgi/%m%p%F.diff?r1=%P&r2=%R%8\""; map_diff_alt = "alt=\"%2 %P <-> %R\"";
@@ -37,15 +37,15 @@
/* I expose the paths here (accessible via the server). */
/* Set this to a private place to make it secure. */
- $cvsgraph = "/home/bertho/public_html/cvsgraph/cvsgraph";
- $cvsgraph_conf = "/home/bertho/public_html/cvsgraph/conf/cvsgraph.conf";
+ $cvsgraph = "/home/httpd/html/cvsgraph/cvsgraph";
+ $cvsgraph_conf = "/home/httpd/html/cvsgraph/cvsgraph.conf";
/* Print a head line */
echo "<h1>CvsGraph of '$f'</h1>\n";
/* Generate an imagemap */
$mapname = "CvsGraphMap";
- $arg9 = "-9 '/~bertho/cvsgraph/'";
+ $arg9 = "-9 '/cvsgraph/'";
$arg8 = "-8 '$ucr'";
$arg0 = "-0 'Branch:'";
$arg1 = "-1 'Revision:'";
@@ -54,7 +54,7 @@
passthru("$cvsgraph $arg0 $arg1 $arg2 $arg8 $arg9 $argM -i -c $cvsgraph_conf -r $sr -m $sm $sf");
/* Link a CvsGraph image */
- echo "<img border=\"0\" usemap=\"#$mapname\" src=\"/~bertho/cvsgraph/mkimage.php3?r=$ur&m=$um&f=$uf\" alt=\"CvsGraph of '$f'\">\n";
+ echo "<img border=\"0\" usemap=\"#$mapname\" src=\"/cvsgraph/mkimage.php3?r=$ur&m=$um&f=$uf\" alt=\"CvsGraph of '$f'\">\n";
echo "<p>\nClick on the revisions/branches to display them\n";
echo "<br>\nClick between the revisions to display the diffs\n";
?>
@@ -18,8 +18,8 @@
/* I expose the paths here (accessible via the server). */
/* Set this to a private place to make it secure. */
- $cvsgraph = "/home/bertho/public_html/cvsgraph/cvsgraph";
- $cvsgraph_conf = "/home/bertho/public_html/cvsgraph/conf/cvsgraph.conf";
+ $cvsgraph = "/home/httpd/html/cvsgraph/cvsgraph";
+ $cvsgraph_conf = "/home/httpd/html/cvsgraph/cvsgraph.conf";
/* Default I generate PNG */
Header("Content-Type: image/png");
上記の修正が終わったら、後は次のようにしてファイルをコピーすればよい。
$ su # mkdir /home/http/html/cvsgraph # cp cvsgraph cvsgraph.conf cvsgraphwrapper.php3 mkimage.php3 /home/http/html/cvsgraph/
初出: 2002年10月30日