viewvc 安装配置指南

本文详细介绍了在Windows环境下安装配置viewvc的过程,包括获取viewvc及其依赖的软件包,如Python、Subversion Python绑定、ActivePython、CvsGraph和Highlight,以及安装配置这些软件包和viewvc自身。内容涵盖了从下载、安装到配置各个环节,特别强调了代码仓库位置、代码语法加亮和CVS代码修订历史图形显示等关键参数的设置。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

1. 概述

viewvc是一个基于webCVSSVN代码仓库浏览工具。它最早是从cvsweb发展而来的,cvsweb是用Perl编写的,viewvc原作者Greg Stein发现很难在此基础上扩展新的功能,于是用Python重新实现,并命名为viewcvs。后来又加入了对SVN代码仓库的支持,为反映这一变化viewcvs重命名为viewvcviewvc可以以独立的程序运行(standalone.py),也可以以cgi方式运行于支持CGIweb服务器,还可以以ASP模式运行于IIS,以mod_python模式运行于Apacheviewvc通过本地文件系统访问代码仓库,所以它必须安装在运行CVSSVN代码仓库的同一服务器上。运行viewvc需要很多第三方软件,具体需要的依赖软件取决于启用功能和运行平台两大因素。viewvc除了支持CVS代码仓库浏览功能,还支持

1)SVN代码仓库浏览功能

2)代码语法加亮、颜色标注

3)CVS代码修订历史图形显示

4)CVS代码代码提交动作的记录、查询

本文以Windows系统下实现上述1,2,3三个功能为例说明viewvc + Apache CGI的安装配置过程。具体环境是Windows XP SP2CVSNT 2.5.03 Subversion 1.3.0viewvc-1.0-dev(r1278)。根据这些功能要求需要以下依赖软件:

1)Python 运行时

2)SubversionSubversion Python绑定

3)Enscript(http://www.codento.com/people/mtr/genscript/)或者Highlight, code colorizer, 2.4.2 及以上版本(http://www.andre-simon.de/)

4)CvsGraph 1.5.0 或更高(http://www.akhphd.au.dk/~bertho/cvsgraph/)

Windows平台上,由于viewvc使用了PythonWin32扩展模块,所以第一项依赖软件包除了安装官方发布的Python外,还需要Python Win32扩展模块(可从从http://starship.python.net/crew/mhammond/win32/下载)。为了省去另行安装的麻烦,可以使用ActiveState提供的Windows版的ActivePython,它包含了Python Win32扩展模块,使得安装更为便捷。第二项依赖软件包可以从Subversion的官方网站获取。Enscripthighlight都可以对代码进行语法加亮、颜色标注,但由于Enscript相对比较旧,支持的语言相对较少,而且本身又有依赖,所以第三项依赖软件包采用功能更丰富、开发相对比较活跃的highlight

整个安装配置的过程大致是:

1)获取viewvc及其依赖的软件包

2)安装配置viewvc依赖的软件包

3)安装viewvc

4)配置viewvc

5)测试

6)集成到Apache

2. 获取viewvc及其依赖的软件包

2.1. 获取viewvc

获取viewvc可以从http://www.viewvc.org/download.html下载。目前,viewvc的稳定版本是0.94,但该版本对Windows系统的支持有问题,使用它默认的安装方式往往无法成功。而且,功能不及现在1.0-dev版本全面,事实上,很多开源组织(sourceforge.net参见http://svn.sourceforge.net/viewcvs.cgi/vienna-rss/trunk/ 2.0.0 /apache参见http://svn.apache.org/viewcvs.cgi/)都使用了该版本,所以推荐使用1.0-dev版本。

获得viewvc 1.0-dev版本需要用svnviewvc的开发网站http://viewvc.tigris.org checkout代码具体命令:

svn co http://viewvc.tigris.org/svn/viewvc/trunk/ viewvc-1.0-dev

E:/>svn co http://viewvc.tigris.org/svn/viewvc/trunk/ viewvc-1.0-de

A viewvc-1.0-dev/www

A viewvc-1.0-dev/www/project_tools.html

A viewvc-1.0-dev/www/index.html

A viewvc-1.0-dev/tparse/tparsemodule.cpp

A viewvc-1.0-dev/tparse/INSTALL

A viewvc-1.0-dev/tparse/Setup.py

A viewvc-1.0-dev/tparse/CHANGES

A viewvc-1.0-dev/tparse/tparsemodule.h

A viewvc-1.0-dev/tparse/.cvsignore

A viewvc-1.0-dev/tparse/README

A viewvc-1.0-dev/templates

A viewvc-1.0-dev/templates/diff.ezt

A viewvc-1.0-dev/templates/docroot

......

A viewvc-1.0-dev/elemx/elx_page.sh

A viewvc-1.0-dev/elemx/elx.h

A viewvc-1.0-dev/viewcvs.conf.dist

取出修订版 1278

帐号可以用guest,密码可以用guest

2.2. 获取Subversion Python绑定

Subversion Python绑定是一些访问Subversion功能的Python模块,在Subversion的每个主要版本发布时都会发布相应的Python绑定。二进制文件可以从以下链接处获得http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91。目前,官方发布的Subversion 1.3.0 Python绑定是针对Python 2.3的,无法在不同版本Python上使用,比如无法在Python 2.4使用。所以,安装Python时可以使用2.3.x的版本,或则是自己编译Python 2.4Subversion绑定,具体方法在http://svn.collab.net/repos/svn/trunk/subversion/bindings/swig/INSTALL处说明。当然也可以在网上搜索现成的Python 2.4 Subversion绑定。

2.3. 获取ActivePython

http://www.activestate.com/Products/ActivePython/处下一个和Subversion Python绑定兼容的版本。

2.4. 获取CvsGraph

为支持CVS代码修订历史图形显示功能,viewvc需要CvsGraph 1.5.0 或以上的版本,可以从http://www.akhphd.au.dk/~bertho/cvsgraph/ 处下载Windows版的cvsgraph-1.5.2-bin.zip,解压缩至某个目录,假定是D:/OSS/cvsgraph-1.5.2

2.5. 获取Highlight

为支持代码语法加亮功能,viewvc需要Highlight, code colorizer, 2.4.2 及以上版本,可以从http://www.andre-simon.de/ 处下载Windows版的highlight-2.4.4.zip。解压缩至某个目录,假定是D:/OSS/highlight-2.4.4

3. 安装配置viewvc依赖的软件包

3.1. 安装Python

首先,安装Python,假定是ActivePython 2.3.5 ,运行安装程序,将Python安装到C:/Python23

3.2. 安装Subversion Python绑定

然后,解开Subversion Perl绑定压缩包svn-win32- 1.3.0 _py.zip,将其中的两个子目录svnlibsvn拷贝到C:/Python23/Lib目录下。

3.3. 安装CvsGraph

将下载的cvsgraph- 1.5.2 -bin.zip发行包解压缩至某个目录,假定是D:/OSS/cvsgraph- 1.5.2

3.4. 安装Highlight

将下载的highlight发行包解压缩至某个目录,假定是D:/OSS/highlight- 2.4.4

4. 安装配置viewvc

viewvc的发行版目录下(本例为E:/viewvc-1.0-dev),运行python viewcvs-install

E:/viewvc-1.0-dev>python viewcvs-install

This is the ViewVC 1.0-dev installer.

It will allow you to choose the install path for ViewVC. You will

now be asked some installation questions.

Defaults are given in square brackets. Just hit [Enter] if a default

is okay.

Installation path [C:/Program Files/viewvc-1.0-dev]: e:/viewvc2

DESTDIR path (generally, only package maintainers will need to change

this) []:

Installing ViewVC to: e:/viewvc2

bin/cgi/viewcvs.cgi

bin/cgi/query.cgi

bin/mod_python/viewcvs.py

bin/mod_python/query.py

bin/mod_python/handler.py

bin/mod_python/.htaccess

bin/standalone.py

......

templates/revision.ezt

templates/roots.ezt

templates/rss.ezt

ViewVC File Installation Complete

Consult INSTALL for detailed information to finish the installation

and configure ViewVC for your system.

Overview of remaining steps:

1) Edit the e:/viewvc2/viewcvs.conf file.

2) Configure an existing web server to run (or copy to cgi-bin)

e:/viewvc2/bin/cgi/viewcvs.cgi.

OR

Run the web server that comes with ViewVC at

e:/viewvc2/standalone.py.

5. 配置viewvc

接下来需要配置viewvc,主要的配置信息有cvssvn的代码仓库的位置,cvsntrcs命令的的位置。这些信息在viewvc安装根目录下的的viewcvs.conf文件中,该文件采用Windows常见的.ini格式,其中的每一个参数都有详尽的解释。在该文件开头的注释部分说明了使viewvc运行起来需要设定的基本参数,以及源代码语法加亮,显示界面客户化等功能需要设定的参数。

5.1. 基本参数

5.1.1. 代码仓库位置参数

使viewvc运行起来需要告诉它cvssvn的代码仓库的位置,相关参数是cvs_rootssvn_roots,这两个参数使用相同的语法:每指定一个代码仓库需要给其命名,然后指定代码仓库的绝对路径,两者用冒号分隔。如果指定多个代码库用用逗号分隔每个名称:路径字符串。示例如下:

cvs_roots = new technology: C:/cvs_repos/new_tech,

leyacy_code: C:/cvs_repos/leyacy_code,

projectA: C:/cvs_repos/projectA,

projectB: C:/cvs_repos/projectB

svn_roots = new technology: C:/svn_repos/new_tech,

leyacy_code: C:/svn_repos/leyacy_code,

productA: C:/svn_repos/productA,

productB: C:/svn_repos/productB

如果有多个代码仓库需要让viewvc通过web展示,并且这些代码仓库都在同一个目录下,可以使用参数root_parents。所以上述配置可以简写为:

root_parents = C:/svn_repos : svn,

C:/cvs_repos : cvs

5.1.2. cvs,svn可以执行文件位置

viewvc需要使用cvssvn的可执行程序访问代码仓库,某些情况下需要显示指定这些可执行程序的位置。CVS的情况稍微复杂一些,如果代码库是CVSNT的,则应当使用cvsntcvs客户端可执行程序,以增强对CVSNT扩展特性的支持。对于标准安装的Subversion使用默认的设置即可。相关参数有cvsnt_exe_path,svn_path

cvsnt_exe_path = C:/Program Files/CVSNT/cvs.exe

use_cvsgraph = 1

cvsgraph_path =D:/OSS/cvsgraph

# should we use 'highlight' for syntax coloring?

# NOTE: use_enscript has to be 0 or enscript will be used instead

use_highlight = 1

#

# if the highlight program is not on the path, set this value

#

highlight_path = D:/OSS/highlight- 2.4.4 /

# what coloring style should highlight use?

highlight_style = emacs

# should we add line numbers?

highlight_line_numbers = 1

# convert tabs to ## spaces (use 0 for no conversion)

highlight_convert_tabs = 2

5.2. CVS代码修订历史图形显示参数

启用CVS代码修订历史图形显示功能需要将参数use_cvsgraph设为1,如果cvsgraph.exe可执行文件不在环境变量Path中,需要cvsgraph_path参数告诉viewvc cvsgraph.exe的绝对路径。此外,还可以指定cvsgraph的配置文件。以下是和highlight相关的配置示例:

#

# Use CvsGraph. See http://www.akhphd.au.dk/~bertho/cvsgraph/ for

# documentation and download.

#

use_cvsgraph = 1

#

# if the cvsgraph program is not on the path, set this value

#

cvsgraph_path =D:/OSS/cvsgraph

# cvsgraph_path = /usr/local/bin/

#

# Location of the customized cvsgraph configuration file.

# You will need an absolute pathname here:

#

cvsgraph_conf = cvsgraph.conf

5.3. 代码语法加亮参数

启用CVS代码修订历史图形显示功能需要将参数use_highlight设为1,如果highlight.exe可执行文件不在环境变量Path中,需要highlight_path参数告诉viewvc highlight.exe的绝对路径。此外,可以设定代码风格(highlight_style)tab键转换成空格(highlight_convert_tabs)等参数。可选的代码风格可以到highlight安装目录下的themes子目录下查找相应style文件名。

D:/OSS/highlight- 2.4.4 /themes>dir

驱动器 D 中的卷是 work

卷的序列号是 D 8A 6 -4C 1A

D:/OSS/highlight- 2.4.4 /themes 的目录

2006-03-10 00:44

.

2006-03-10 00:44

..

2005-10-19 20:38 573 acid.style

2005-10-19 20:38 665 berries-dark.style

2005-10-19 20:38 671 berries-light.style

2005-10-19 20:38 664 bipolar.style

2005-10-19 20:38 629 blacknblue.style

2005-10-19 20:38 611 bright.style

2005-10-19 20:38 657 contrast.style

2005-10-19 20:38 521 darkblue.style

2005-10-19 20:38 625 darkness.style

2005-10-19 20:38 626 desert.style

2005-10-19 20:38 643 dull.style

2005-10-19 20:38 626 easter.style

2005-10-19 20:38 495 emacs.style

2005-10-19 20:38 626 golden.style

2005-10-19 20:38 620 greenlcd.style

2005-10-19 20:38 602 ide-anjuta.style

2005-10-19 20:38 454 ide-codewarrior.style

2005-10-19 20:38 609 ide-devcpp.style

2005-10-19 20:38 498 ide-eclipse.style

2005-10-19 20:38 605 ide-kdev.style

2005-10-19 20:38 609 ide-msvcpp.style

2005-10-19 20:38 469 kwrite.style

……

从上面的输出可知可选的风格有acid, berries-dark, berries-light, bipolar,ide-anjuta, ide-codewarrior, ide-devcpp, ide-eclipse, ide-kdev, ide-msvcpp等等。以下是和highlight相关的配置示例:

# should we use 'highlight' for syntax coloring?

# NOTE: use_enscript has to be 0 or enscript will be used instead

use_highlight = 1

#

# if the highlight program is not on the path, set this value

#

highlight_path = D:/OSS/highlight- 2.4.4 /

# what coloring style should highlight use?

highlight_style = emacs

# should we add line numbers?

highlight_line_numbers = 1

# convert tabs to ## spaces (use 0 for no conversion)

highlight_convert_tabs = 2

5.4. 其它参数

通常address参数需要修改,它是一个给管理员发邮件的链接。

address = Tell SCM master if you have troubles in use viewvc

6. 测试配置

配置完成后可以通过运行standalone.py来测试安装配置是否正确。运行e:/viewvc2/bin/standalone.py

E:/viewvc2/bin>standalone.py

server ready at http://localhost:7467/viewvc

打开浏览器输入http://localhost:7467/viewvc查看viewvc是否正常运行。

7. viewvcApache集成

standalone.py启动的viewvc服务不够稳定,在生产环境通产需要和web服务器集成。viewvcCGI方式集成到Apache中相当简单。只需要用ScriptAlias指令将viewvc安装目录下的bin/cgi子目录映射到一个URL上去。示例:

ScriptAlias /codeview/ "E:/viewvc/bin/cgi/"

重启Apache,即可通过URLhttp://localhost/codeview/viewcvs.cgi访问所配置的代码仓库。

8. 总结

安装配置viewvc涉及到众多依赖软件和参数,如果以Apache CGI方式运行viewvc同时Apache作为Windows Service运行修改配置后可能需要重启Windows才能生效。另外,如果viewvc运行不正常,常见的错误是CVS,SVN的代码仓库位置不正确,或者使用到了highlightcvsgraph没有制定正确的路径。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值