ubuntu-12.0.4 svn ,bugzilla 整合

系统已安装svn,bugzilla(下载bugzilla版本:3.0.4(试过3.4.6,3.6.1,4.2.4都不能集成)

1.下载scmbug

http://ftp.mozilla.org/pub/mozilla.org/webtools/archived/
http://files.mkgnu.net/files/scmbug/SCMBUG_RELEASE_0-26-22/debs/
下载四个包:scmbug-common、scmbug-doc、scmbug-server及scmbug-tools并安装,scumbug就算安装好了。

2.配置/etc/scmbug/daemon.conf

修改:
#
# This is a template configuration file for the scmbug-server daemon
#
$daemon_configuration = {

    # Describes how logging will be reported, using Log::Log4perl
    logging => '
log4perl.category.Daemon           = WARN, Logfile

# Log all daemon activity to a file
log4perl.appender.Logfile          = Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = /var/log/scmbug/activity.log
log4perl.appender.Logfile.layout   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logfile.layout.ConversionPattern = %d Scmbug %p> %F{1}:%L:%M - %m
',

    # Port the daemon will start on
    daemon_port => 3872,

    # Pid file the daemon will use
    daemon_pidfile => "/var/run/scmbug_daemon.pid",

    #
    # Execution mode of the daemon. There are 3 options:
    #
    # - 'threaded'. Multiple threads are created to handle incoming
    # connections. This was observed to work well under Windows but
    # cause a 3-fold slowdown under UNIX.
    #
    # - 'forked'. Multiple processes are created to handle incoming
    # connections. This was observed to work well under UNIX
    # and most Windows systems.
    #
    # - 'auto'. Automatically chooses between a 'threaded' or 'forked'
    # mode.
    daemon_mode => "auto",

    # 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',
     database_location => '127.0.0.1',
    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 => 'your password',
    
    # Used only for Bugzilla.
    #
    # Flags whether the live bugtracker instance is installed
    # locally on the same machine the daemon is running
    installed_locally => 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',

    # Prefix used to display a bug
    bug_url_prefix => 'http://127.0.0.1/show_bug.cgi?id=' },


    # Translation list of SCM usernames to bug-tracking
    # usernames. Mappings based on mapping_ldap are applied
    # first. Mappings based on mapping_regexes are applied second and
    # can override a mapping based on mapping_ldap. Mappings based on
    # mapping_values are applied last and can override all other
    # mappings.
    userlist => {

    # 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.

        #如果使用名字匹配则设为1(如果下面没有使用则设置为0)

        enabled => 1,

        # This is a mapping based on
        # LDAP. ldap_scm_username_attribute defines the LDAP
        # attribute that will be used to match the SCM
        # username. The SCM username will be mapped into the
        # bug-tracking username defined by
        # ldap_bugtracking_username_attribute.
        mapping_ldap => {
        enabled => 0,
        ldap_server => '127.0.0.1',
        ldap_port => '389',
        # A binddn (e.g. cn=default) that has access to read
        # all attributes
        ldap_binddn => 'replace_with_binddn',
        # The password of the binddn that has access to read
        # all attributes
        ldap_binddn_password => 'replace_with_binddn_password',
        # The BaseDN in which to search for the
        # ldap_scm_username_attribute
        # (e.g. "ou=People,o=Company")
        ldap_basedn => 'replace_with_basedn',
        # The name of the attribute containing the user's SCM
        # username
        ldap_scm_username_attribute => 'uid',
        # The name of the attribute containing the user's
        # bug-tracking username
        ldap_bugtracking_username_attribute => 'mail',
        # LDAP filter to AND with the
        # ldap_scm_username_attribute for filtering the list
        # of valid SCM users.
        ldap_filter => ''
        },

        # This is a mapping based on regular expressions. The
        # first expression defines how the SCM username will be
        # matched. The second defines how it will be transformed,
        # and uses the unnamed variable $1 that was described by
        # the first expression. The mapping is checked for a match
        # as:
        # m/$first_regex/
        # and is applied as: s/$first_regex/$second_regex/

        mapping_regexes => {

       #我使用正则表达式匹配(设为1),默认是0

         enabled => 1,
        values => {
            # This is an example of mapping a Windows Domain
            # user from 'DOMAIN\user' to
            # 'user@EMAIL_DOMAIN.com'
            #'^DOMAIN\\\\(\w+)$' => '$1\@EMAIL_DOMAIN.com',
            # This is an example of mapping a UNIX user from
            # 'example_user' to
            # 'example_user@exampledomain.com'
            '^(\w+)$' => '$1\@exampledomain.com',
            '^(\w+)$' => '$1\@zappsys.com.cn'
            }
        },

        # This is a one-to-one mapping of SCM usernames to
        # bugtracking usernames. Mappings in this list override
        # mappings from mapping_regexes.
        mapping_values => {
         enabled => 1,
        values => {
            'DOMAIN\\example_user' => 'example_user@DOMAIN.com',
            'example_user2' => 'example_user2@exampledomain.com'

            #使用一对一匹配

            ,'elvis' => 'ehuang@example.com'

            }
        }
    }
    
    }

};



3.启动scmbug

$ 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
没有则看log文件:
/var/log/scmbug/activity.log
发现有错误提示
enabled => 0,      #默认这里值为1,即usr mapping是开着的,如果不使用关联,则置为0


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

安装命令:
sudo perl /usr/bin/scmbug_install_glue.pl
--scm=Subversion
--repository=file:///home/svnuser/test  
--product=TestProduct --bug=770
--bin=/bin,/usr/bin,/usr/sbin
--daemon=127.0.0.1

--scm使用什么软件做为版本配置,我这里是Subversion。
--product为bugzilla中bugs所属的产品名称,我这里是TestProduct。
--repository选项的意思为subversion创建的版本仓库路径,我这里是/home/svnuser/test,前面的file://一定别忘了。
--bug选项的意思为glue运行时对bug的读写权限,mod值为770。
--binary-paths选项的意思为subversion的相关tools的目录,把可能的路径加进来,用,分隔两个目录。
--daemon选项的意思为glue运行的服务器地址,这里一般写127.0.0.1,一般都是本地使用。

两次回车后安装完毕。
目前位置svn,bugzilla已集成完毕。

5.配置/home/svnuser/test/hooks/etc/scmbug/glue.conf

#
# This is a template configuration file for the Scmbug glue.
#
$glue_configuration = {

    #
    # Flags whether the glue is active
    #
    enabled => 1,

    # Describes how logging will be reported, using Log::Log4perl
    logging => '
# If you want to additionally store all logging in a file, change
# the line below to:
#log4perl.category.Glue             = DEBUG, AppWarn, AppRest, Logfile
log4perl.category.Glue             = WARN, AppWarn, AppRest

# Filter to match level WARN
log4perl.filter.MatchWarn  = Log::Log4perl::Filter::LevelMatch
log4perl.filter.MatchWarn.LevelToMatch  = WARN
log4perl.filter.MatchWarn.AcceptOnMatch = true

# Filter to match everything but WARN
log4perl.filter.MatchRest  = Log::Log4perl::Filter::LevelMatch
log4perl.filter.MatchRest.LevelToMatch  = WARN
log4perl.filter.MatchRest.AcceptOnMatch = false

# Simple layout for WARN messages
log4perl.appender.AppWarn = Log::Log4perl::Appender::Screen
log4perl.appender.AppWarn.layout   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.AppWarn.layout.ConversionPattern = Scmbug notice: %m
log4perl.appender.AppWarn.Filter   = MatchWarn

# Elaborate layout for the rest
log4perl.appender.AppRest = Log::Log4perl::Appender::Screen
log4perl.appender.AppRest.layout   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.AppRest.layout.ConversionPattern = Scmbug %p> %F{1}:%L:%M - %m
log4perl.appender.AppRest.Filter   = MatchRest

# Log all glue activity to a file
log4perl.appender.Logfile          = Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = /tmp/scmbug_glue.log
log4perl.appender.Logfile.layout   = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logfile.layout.ConversionPattern = %d Scmbug %p> %F{1}:%L:%M - %m
',

    #
    # Describes the SCM system integrated with bug-tracking
    #
    scm => {
    name => 'Subversion',

    # Comma(,)-separated list of paths to any binaries the SCM
    # tool may need to use
    binary_paths => '/bin,/usr/bin,/usr/sbin',

    # This applies only to Subversion. It is recommended that tags
    # are stored in the 'tags' directory, and branches in the
    # 'branches' directory.
    label_directories => [
                  'tags',
                  'branches'
                  ],

    # This applies only to Subversion. It is recommended that the
    # main trunk work is stored in the 'trunk' directory.
    main_trunk_directories => [
                   'trunk'
                   ],

    # This applies only to CVS. When a commit affects more than
    # one directory, multiple duplicate log comments are inserted,
    # one-per-directory. Enabling this option would consolidate
    # the commits to all use the first log message.
    consolidate_cvs_messages => 0
    },

    #
    # Describes the daemon that will process the integration requests
    #
    daemon => {
    location => '127.0.0.1',
    port => 3872,
    },

    
    #
    # List of policies the glue can enforce
    #
    policies => {

    # Log template.
    #
    # Regular expressions that describe how the bug id and log
    # comment will be identified must be defined.
    #
    # This policy is ALWAYS enabled
    log_template => {
        # The log_bugid_regex is a regular expression that must
        # set the unnamed variable $1 to the bug number, or list
        # of bug numbers. It is checked for a match as: m/$regex/s
        log_bugid_regex => '^\s*bug\s*([\d|\s|,|#]*?):',
            # The log_bugid_split_regex is a regular expression
            # describing how a list of bug ids will be split in
            # individual bug numbers. It is split as: /$regex/
            log_bugid_split_regex => ',\s?#|\s?#|,|\s+',
        # The log_body_regex is a regular expression that must set
        # the unnamed variable $1 to the log comment. It is
        # checked for a match as: m/$regex/s
        log_body_regex => '^\s*bug.*?:\s*(.*)'
        },

    # Resolution template.
    #
    # Regular expressions that describe how a resolution status
    # for a list of bug ids can be identified
    resolution_template => {
        enabled => 1,
        # The resolution_bugid_regex is a regular expression that
        # must set the unnamed variable $1 to the bug number, or
        # list of bug numbers. It is checked for a match as:
        # m/$regex/s
        resolution_bugid_regex => '^\s*status\s*([\d|\s|,|#]*?):',
            # The resolution_bugid_split_regex is a regular expression
            # describing how a list of bug ids will be split in
            # individual bug numbers. It is split as: /$regex/
        resolution_bugid_split_regex => ',\s?#|\s?#|,|\s+',
        # The resolution_status_regex is a regular expression that
        # must set the unnamed variable $1 to the requested
        # status. It is checked for a match as: m/$regex/s
        #
        # For example, if one issued in the log message the
        # resolution command:
        #
        # status 547: reopened
        #
        # Then the resolution_status_regex is expected to match
        # "reopened"
        resolution_status_regex => '^\s*status.*?:\s*(\S+)\s*.*',
        # The resolution_status_resolution_regex is a regular
        # expression that must set the unnamed variable $1 to the
        # requested resolution. It is checked for a match as:
        # m/$regex/s
        #
        # For example, if one issued in the log message the
        # resolution command:
        #
        # status 547: resolved fixed
        #
        # Then the resolution_status_resolution_regex is expected
        # to match "fixed"
        resolution_status_resolution_regex => '^\s*status.*?:\s*\S+\s+(\S+)',
        # The resolution_status_resolution_data_regex is a regular
        # expression that must set the unnamed variable $1 to the
        # additional data supplied by the resolution status. It is
        # checked for a match as:
        # m/$regex/s
        #
        # For example, if one issued in the log message the
        # resolution command:
        #
        # status 548: resolved duplicate 547
        #
        # Then the resolution_status_resolution_data_regex is
        # expected to match "547"
        resolution_status_resolution_data_regex => '^\s*status.*?:\s*\S+\s+\S+\s+(\S+)',
            # Apply a case sensitive resolution and resolution status verification
            resolution_status_case_sensitive_verification => 0,
        # The resolution_status_* information can have all of the
        # following characters converted according to a regular
        # expression. This is useful in addressing the limitation
        # of some bug-trackers that report a resolution-related
        # information with a token that contains spaces. For
        # example:
        #
        # "unable to reproduce" in Mantis.
        resolution_status_convert => {
        enabled => 1,
        # Regular expressions that will be applied to convert
        # the characters of all resolution_status_*
        # information. It is applied for substitution as:
        #
        # s/$convert_from/$convert_to/g
        resolution_status_convert_from => '_',
        resolution_status_convert_to => ' '
        },
        # The bugs whose resolution status will be changed must be
        # filed against a valid product name.
        resolution_valid_product_name => 1,
        # The SCM user must be the user to which the bugs whose
        # resolution status will be changed are assigned
        resolution_valid_bug_owner => 1,
        },

    #
    # Presence of bug ids. There are 3 options:
    #
    # - 'required'. A bug id must be specified during each
    #   activity. Activities without a bug id will not be permitted.
    #
    # - 'optional'. If a bug id is supplied, the activity will be
    #   integrated. If not the activity will be permitted to go
    #   through in the SCM system, but without bug-tracking
    #   integration.
    #
    # - 'none'. Never integrate activities regardless. This is
    #   different than flagging the glue inactive. The remaining
    #   policies are still enforced were applicable.
    #   (e.g. policy minimum_log_message_size).
    #
    # This policy is ALWAYS enabled
     presence_of_bug_ids =>  {
        value => 'required'
        }
,

    # The SCM user issuing an activity must be the user to which
    # the bug is assigned
     valid_bug_owner => {
        enabled => 0
        }
,

    # All integration activity must originate from a specific SCM
    # user. If the SCM system does not provide the SCM user
    # information (e.g Subversion running an svnserve daemon with
    # anonymous access), assume the activity originated from a
    # specific SCM user
    anonymous_scm_username => {
        enabled => 0,
        value => 'anonymous_scm_user'
        },

    # The bug against which an activity is issued must be in an

    # open state

    #不设置则新状态bug不能提交

     open_bug_state => {
        enabled => 0
        }
,

    # Minimum number of characters log message.
    minimum_log_message_size => {
        enabled => 1,
        size => 50
        },

    # Format of label names (tag or branch names) defined as
    # regular expressions.
    label_name => {
        enabled => 1,
        names => [
              # Convention for official releases.
              # For example:
              # SCMBUG_RELEASE_0-2-7
              '^.+?_RELEASE_[0-9]+-[0-9]+-[0-9]+$',

              # Convention for development builds.
              # For example:
              # SCMBUG_BUILD_28_added_a_policies_mechanism
              '^.+?_BUILD_[0-9]+_.+$',

              # Convention for branches.
              # For example:
              # b_experimenting_with_policies_on_glue_side
              '^b_.+$',

              # Convention for private developer tags. Uses
              # the developer's initials (either 2 or 3).
              # For example:
              # p_kpm_prior_to_bug353_stabilization_fixes
              '^p_[a-zA-Z][a-zA-Z]?[a-zA-Z]_.+$'
              ]
          },

    # The bug against which an activity is issued must be filed
    # against a valid product name.
    valid_product_name => {
        enabled => 1
        },

    # Product name definition.
    #
    # The product name is autodefined based on regular
    # expressions. The first expression defines how each commited
    # filename will be matched. The second defines how it will be
    # transformed, and uses the unnamed variables (e.g. $1 $2)
    # that were described by the first expression. The mapping is
    # checked for a match as:
        # m/$match_regex/
        # and is applied as: s/$match_regex/$replace_regex/
        #
        # NOTE: The regular expression '(.*)' is special and means
        #       replace with exactly this value. It is meant to be used
        #       with SCM systems that do not provide the list of
        #       affected files during verification (e.g. CVS 1.11.x)
        #
    # This policy is ALWAYS enabled
    product_name_definition => {
        values => { '(.*)' => 'TestProduct' }
        },

    #
    # Send email notifications after integration activity
    #
    mail_notification => {
            # Send an email after a successful activity (both
            # verifying and labeling)
        mail_on_success => 1,
        # Send an email after a failed commit activity that the
        # SCM system may overshadow and not report
        # (e.g. Subversion does not report error messages of its
        # post-commit hook.) .
        mail_on_failure => 0,
        mail_settings => {
        # Must be a valid email address. Can remain empty if
        # other users should be notified.
        To => 'replace_with_commit_mailing_list_email@exampledomain.com',
        # Must be a valid email address. Can remain empty if
        # mail_also_appears_from_scm_user is enabled.
        From => 'replace_with_commit_mailing_list_email@exampledomain.com',
        # Defaults to localhost if left empty
        Smtp => 'replace_with_mail_server.exampledomain.com'
        },
        # Sending email when a tag is moved or deleted in CVS can
        # be annoying, since multiple emails are sent per
        # directory (but not when a tag is added). mail_on_label
        # can disable that behavior.
        mail_on_label => 1,
        mail_recipients => {
        # Make the email also appear to have been sent by the
        # SCM user.
        mail_also_appears_from_scm_user => 1,
        # List of users that will be notified
        mail_scm_user => 1,
        mail_bug_owner => 1,
        mail_bug_reporter => 1,
        mail_bug_monitors => 1,
        mail_product_owners => 1
        }
    }
    }
};


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值