您的位置:首页 > 其它

Ubuntu 学习笔记之使用scmbug整合subversion & bugzilla

2010-12-08 22:56 681 查看
首先,安装好bugzilla和subversion。

bugzilla的安装本人已经写过一个笔记,请见http://blog.csdn.net/sunshineboyleng/archive/2010/11/23/6028557.aspx

subversion的安装请见http://wiki.ubuntu.org.cn/SubVersion

上面的那个网页讲得很清楚。

$ sudo apt-get install subversion

$ sudo apt-get install libapache2-svn

只要在终端输入上面两行命令,subversion就安装好了。

subversion主要是用来做软件版本管理的,而bugzilla是一个bugs的跟踪管理系统。

我们希望两者共享同一个用户、组及权限数据库。

这里我们需要安装mod_auth_mysql,它是一个apache的模块。

此模块可以使用保存在mysql数据库里的用户和密码以及组设置来校验用户的权限。

$ sudo apt-get install libapache2-mod-auth-mysql

只要在终端输入上面命令,mod_auth_mysql模块就安装好了。

该模块的使用说明文档放在下面这个目录:/usr/share/doc/libapache2-mod-auth-mysql。

该模块的的提供的指令放在文件DIRECTIVES.gz中,大伙有兴趣可以仔细查看。

接下来我们开始配置subversion,让其使用bugzilla的用户数据来访问其版本仓库。

在这个网页http://wiki.ubuntu.org.cn/SubVersion中已经详细介绍了通过WebDAV协议访问subversion的方法。

我们只需对其对应的配置文件/etc/apache2/mods-available/dav_svn.conf稍作修改即行。

修改后的配置文件如下:

<Location /svn/myproject>

DAV svn #使用subversion版本仓库

SVNPath /home/svn/myproject    #版本仓库路径

AuthType Basic  #使用基本论证类型

AuthName "myproject subversion repository"  #论证时提示信息,基本没有什么用

#AuthUserFile /etc/subversion/passwd     #注释掉该行,因为我们使用mysql数据库

#<LimitExcept GET PROPFIND OPTIONS REPORT>

Require valid-user   #需要用户权限论证

#</LimitExcept>

Auth_MySQL  on   #使用mysql数据库来认证用户

AuthUserFile /dev/null

AuthBasicAuthoritative off #关闭基本论证选项

########下面数据库配置和bugzilla安装时localconfig中对应的配置一样#######

Auth_MySQL_Host   localhost  #mysql数据库服务器

Auth_MySQL_User   bugs       #mysql数据库用户名

Auth_MySQL_Password  bugzilla   #对就用户的mysql的密码

Auth_MySQL_DB        bugs     #subversion共享的bugzilla用户信息数据库名

########用户信息表名及帐号名称和密码字段设置,下面的配置是bugzilla的数据库决定的,基本是固定的############

Auth_MySQL_Password_Table    profiles   #帐号密码所在表名

Auth_MySQL_Username_Field    login_name  #存储帐号名称的字段名

Auth_MySQL_Password_Field    cryptpassword  #存储密码的字段名

Auth_MySQL_Encryption_Types  Crypt   #密码的加密类型

</Location>

保存文件后退出,然后重启apache2(sudo /etc/init.d/apache2 -restart)。

这里有个注意事项,那个这些MySQL的指令,你安装的mod_auth_mysql不一定支持,具体请查看

/usr/share/doc/libapache2-mod-auth-mysql/DIRECTIVES.gz改成对应的项。

这里还有个问题,那就是bugzilla在3.6之后的版本中对密码的加密方式为SAH-256的,

而mod_auth_mysql默认的密码加密方式并不支持SAH-256,所以我将bugzilla换成3.0.4的版本了。

下载地址 http://ftp.mozilla.org/pub/mozilla.org/webtools/archived/ 选择3.0.4版本,安装与3.6.3大同小异,这里就不再多说了。

当然你可为mod_auth_mysql加个patch,使其支持SAH-256的加密方式,而网上已经有人写了个SAH-512的补丁了。

重启apache2之后,subversion就可以和bugzilla共享用户信息了。

打开浏览器,输入subversion的Web网址,我这是http://localhost/svn/myproject/。

这时它会要求认证帐号及密码,输入bugzilla数据库中的帐号与密码即可登录了。

接下来我们要安装scmbug软件,利用它来整合subversion版本仓库和bugzilla中的bugs。

其实主要在subversion上checkin&checkout时和对应的bugzilla中提交的bugs关联起来,

并将文件变化的相关记录反映到对应的bugzilla数据库的bug记录中。

scmbug项目的主页为http://www.mkgnu.net/scmbug,其最新的版本为0-26-21。

下载网页http://files.mkgnu.net/files/scmbug/SCMBUG_RELEASE_0-26-21/debs

下载下面四个deb包:scmbug-common、scmbug-doc、scmbug-server及scmbug-tools并安装,scumbug就算安装好了。

然后开始配置scmbug。

scmbug安装好之后,其配置文件一般在/etc/scmbug,进入该目录:

修改daemon.conf文件,下面只列出修改的主要段落:

$ sudo vi daemon.conf

...

...

# Configuration information of the bug tracking

# system

bugtracker => {

# The possible options are:

# - 'Bugzilla'

# - 'Mantis'

# - 'RequestTracker'

# - 'TestDirector'

type => 'Bugzilla',

# This MUST be in the format x.y.z, where x,y,z

# are integers.

version => '3.0.4', #这个必须和安装的bugzilla的版本一致

database_location => '127.0.0.1', #下面有关数据库的配置都和bugzilla安装时数据库的配置一样

database_port => '3306',

# Valid values are the ones accepted by the Perl DBI.

#

# For Bugzilla and RequestTracker, this value is ignored

#

# For Mantis, *some* valid values (there are others) are:

# - 'mysql'

# - 'Pg'

database_vendor => 'mysql',

# For RequestTracker these values are ignored

database_name => 'bugs',

database_username => 'bugs',

database_password => 'bugzilla',

# Used only for Bugzilla.

#

# Flags whether the live bugtracker instance is installed

# locally on the same machine the daemon is running

installed_locally => 1, #bugzilla本地安装的话这里必须设置成1

# Used for Bugzilla and RequestTracker.

#

# Path to the directory of the bugtracker sources providing an

# API that the daemon can use

installation_directory => '/var/www/bugzilla', #将这里修改为你的bugzilla安装目录

...

...

当然还有其他的配置项,大伙可以研究清楚后自己试着配置哈。

修改完毕,保存退出。

首先开启scmbug的server,输入下面的命令:

$ sudo /etc/init.d/scmbug-server start



查看进程,确认scmbug-server有正确跑起来,输入下面的命令:

ps ax | grep scmbug

如果有看到如下信息,那么说明scmbug-server有正确启动了。

183 ? Ss 0:00 /usr/bin/perl /usr/sbin/scmbug_daemon.pl /etc/scmbug/daemon.conf

12190 pts/0 R+ 0:00 grep --color=auto scmbug

否则请查看scmbug的log,检查错误,修改直到其正确启动。

其log文件为/var/log/scmbug/activity.log

我这第一次也没跑起来,查看log文件,发现其跑下面的错误:

2010/12/09 19:33:12 Scmbug WARN> Daemon.pm:81:Scmbug::Daemon::Daemon::read_configuration - Read configuration file '/etc/scmbug/daemon.conf'

2010/12/09 19:33:12 Scmbug ERROR> Daemon.pm:329:Scmbug::Daemon::Daemon::check_configuration -

*******************************************

**

**

** Scmbug error 77: The userlist mappings are enabled, but no mappings are configured.

**

**

*******************************************

回去修改daemon.conf文件,将userlist mappings关掉。

# Apply a case sensitive username verification

case_sensitive_username_verification => 1,

mappings => {

# Enable SCM username translation. This flag must be

# turned on for any of the mappings that follow to apply.

enabled => 0, #默认这里值为1,即usr mapping是开着的,我这把它关掉了

然后再重新启动scmbug-server,这回应该好了。

利用scmbug的命令scm_install_glue下载安装glue

首先确定scmbug的server开启,输入命令

#/etc/init.d/scmbug-server start

然后输入如下命令安装glue:

$ sudo perl /usr/bin/scmbug_install_glue.pl --scm=Subversion /

--repository=file:///home/svn/myproject /

--product=TestProduct --bug=770 --bin=/bin,/usr/bin,/usr/sbin --daemon=127.0.0.1

##################选项的意思###################################

其中的--scm选项意思为使用什么软件做为版本配置,我这里是Subversion。

--product选项的意思为bugzilla中bugs所属的产品名称,我这里是TestProduct。

--repository选项的意思为subversion创建的版本仓库路径,我这里是/home/svn/myproject,前面的file://一定别忘了。

--bug选项的意思为glue运行时对bug的读写权限,mod值为770。

--binary-paths选项的意思为subversion的相关tools的目录,把可能的路径加进来,用,分隔两个目录。

--daemon选项的意思为glue运行的服务器地址,这里一般写127.0.0.1,一般都是本地使用。

###################################################################

注意:输入产品名称中间最好没有空格,否则报无效产品

出现以下信息:

his is the installation script of the Scmbug glue.

The glue will be installed in repository: file:///home/svn/myproject.

This is a repository for the Subversion SCM tool.

The product name in the bug tracking system is TestProduct.

The integration glue will be committed against bug 770.

The IP address of the Scmbug integration daemon to contact is 127.0.0.1.

The binary paths used are: /bin,/usr/bin,/usr/sbin.

-------------

Press Enter to continue or Ctrl-C to cancel

两次回车后安装完毕.

Glue processing has been prepared in /tmp/Scmbug.12267

Installing part 1

Check everything there before I commit. Hit Ctrl-C to exit or press Enter to continue.

Will chown 0 0 /home/svn/myproject/hooks/pre-commit

Will chown 0 0 /home/svn/myproject/hooks/post-commit

Glue processing has been prepared in /tmp/Scmbug.12267

Installing part 2

Check everything there before I commit. Hit Ctrl-C to exit or press Enter to continue.

看到上面的信息,基本上glue已经安装好了。

这样subversion和bugzilla就通过scmbug的glue daemon连起来了,其对应的配置文件为/home/svn/myproject/hooks/etc/scmbug/glue.conf

在提交subversion文件时,关联bugzilla中提交的bugs的相关配置都在glue.conf文件中,这个配置文件怎么使用得别写一章来讨论了。

总之,scmbug subversion bugzilla已经联系起来了,剩下的该怎么使用subversion和bugzilla,大伙慢慢看相关文档哈,

这两者的帮助文档都说得很清楚。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: