软件工程

本类阅读TOP10

·PHP4 + MYSQL + APACHE 在 WIN 系统下的安装、配置
·Linux 入门常用命令(1)
·Linux 入门常用命令(2)
·使用 DCPROMO/FORCEREMOVAL 命令强制将 Active Directory 域控制器降级
·DirectShow学习(八): CBaseRender类及相应Pin类的源代码分析
·基于ICE方式SIP信令穿透Symmetric NAT技术研究
·Windows 2003网络负载均衡的实现
·一网打尽Win十四种系统故障解决方法
·数百种 Windows 软件的免费替代品列表
·收藏---行百里半九十

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Using Subversion and ViewCVS on Solaris 10

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

Using Subversion and ViewCVS on Solaris 10

Author: Badcoffee

Email: [email protected]
Date: Jan, 2005

Original Site: http://blog.csdn.net/yayong
CopyRight: Anyone refer to this article, must include author information and original site URL.

Summary

This article is a introduction that show you how to install and setup Subversion and ViewCVS's on Solaris 10.
It also give instructions about subversion usage for developer and gatekeeper (administrator). If you are a advanced
user, please refer to Subversion book for more details.

1. Subversion Setup

1.1 Install Subversion package

  • First, grab the pkg-get package file, from URL below:
            http://www.blastwave.org/pkg_get.pkg

            Install it with
            pkgadd -d pkg_get.pkg

            Then, make sure can find /usr/sfw/bin/wget command.
            At last, maybe modify /opt/csw/etc/pkg-get.conf file for proxy setting:
                ftp_proxy=http://proxy_server:port
                http_proxy=http://proxy_server:port
                export http_proxy ftp_proxy

           Set envirment in /etc/profile:

            PATH=/opt/csw/bin:$PATH;
            SVN_EDITOR=/usr/bin/vi
            export SVN_EDITOR
            export PATH

    • Install Subversion package
                pkg-get -i subversion
          
            For python and apache2 support:

              pkg-get -i pysvn
              pkg-get -i ap2_subversion

    1.2 Running a Subversion Server

    •  Create system account:
                  groupadd svn
                  useradd -c "SVN Owner" -d /export/home/svn -g svn svn
                 
                  mkdir /export/home/svn
                  chown svn:svn /export/home/svn
                  chmod g+w /export/home/svn
      • Creat repository for project
                  svnadmin create --fs-type fsfs  /export/home/svn/[project name]
                
              Import source code into repository:       
            
                  cd [/path/to/source/tree]
                  svn import file:///export/home/svn/[project name]
         
      • Setting access policy of repository:
              vi /export/home/svn/[project name]/conf/svnserve.conf
                  [general]
                  anon-access = read
                  auth-access = write
                  password-db = passwd.conf
                  realm = /[project name]

              Create passwd database:
                  /export/home/svn/[project name]/conf/passwd.conf
                      [users]
                      username1 = passwd1
                      .......

              Setting right access permission for subversion server: 
                  chown -R svn:svn /export/home/svn/[project name]
                  chmod -R g+w /export/home/svn/[project name]
                  chmod g+s /export/home/svn/[project name]/db

      •  Configure the subversion service:
              Create the start script when system boot:
                  vi /etc/rc2.d/S98svnserve
                      su - svn -c "/opt/csw/bin/svnserve -d -r /export/home/svn&"

                  chmod +x /etc/rc2.d/S98svnserve
             
              Start subversion service:
                  /etc/rc2.d/S98svnserve

      • Check out source code to verify subversion service works correctly
                svn checkout svn://[hostname]/[project name]

      2. ViewCVS Setup

      2.1 Install ViewCVS package

      • Install python package
              pkg-get -i python
      • Install viewcvs package 
             ./viewcvs-install

             Note: Before your installation,  you can  refer to INSTALL file in ViewCVS package.
                       Currently, only ViewCVS 1.0 can support subversion, but this version is under development.
                       You can get  ViewCVS 1.0 dev version from ViewCVS site.
      • install enscript package
              pkg-get -i enscript         
      • install gnudiff
              pkg-get -i diffutils
              cp /opt/csw/bin/gdiff* /usr/bin/

      2.2 Runing viewcvs with Apache server

      • Configure viewcvs with subversion
              vi /usr/local/viewcvs-1.0-dev/viewcvs.conf

                  #cvs_roots = cvs: /home/cvsroot
                  svn_roots = [project name]: /export/home/svn/[project name]
                  svn_parent_path = /export/home/svn
                  default_root = [project name]

                  use_enscript = 1
                  enscript_path = /opt/csw/bin/
      • import subverion python moudle into python
              # python
                  Python 2.3.4 (#3, Nov 10 2004, 12:43:17) [C] on sunos5
                  Type "help", "copyright", "credits" or "license" for more information.
              >>> import svn.repos

      • Start viewcvs web service
                  cp -f /usr/local/viewcvs-1.0-dev/www/cgi/*  /var/apache2/cgi-bin/

                  vi /var/apache2/htdocs/index.html
                      <SCRIPT LANGUAGE="JavaScript">
                          location="/cgi-bin/viewcvs.cgi"
                      </SCRIPT>

                  cp -f /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf

                  pkill -9 httpd
                  svcadm enable svc:/network/http:apache2

             You can access your project site from URL: http://[hostname]

      3. ViewCVS Setup

      3.1. For developer

        * Install a subverion client

            Please see section 1.1 above.

        * start work with subversion
         
          Get project URL of subversion server from gatekeeper
          
          Check out source code:

            svn checkout -r [version name] svn://[hostname]/[project name]

          After check out, a local work directory is created, you can do following things:

          Check recent change log anytime:

            svn log

          Update your local work copy to a specified version:

            svn update -r [version name]

          Check local work dir status, compare them with server side:
         
            svn status

          Diff a file current version with specified version

            svn diff -r [version name] [file name]

          Add a new dir

            svn mkdir [dir name]

          Add a new file

            svn add [file name]

          Of course, you can modify a existed file anytime.
                 
          When a change is occurred, don't forget commit your change:

            svn commit

        * Get Help for command:

            svn help

        * Get a certain release of project?
             
          Need know realse name first.

          Switch local work dir to a certain branch, tag and release:

            svn switch svn://[hostname]/[project name]/tags/[tag name or release name]

      3.2. For gatekeeper

        * Create repository for a new project and setting access policy of repository

          Create repository for a new project

            svnadmin create --fs-type fsfs  /export/home/svn/[project name]
               
          Import source code into repository:      
           
            cd [/path/to/source/tree]
            svn import file:///export/home/svn/[project name]

          Set access policy of repository:

            vi /export/home/svn/[project name]/conf/svnserve.conf

              [general]
              anon-access = read
              auth-access = write
              password-db = passwd.conf
              realm = /[project name]

          Create user password database:

            vi /export/home/svn/[project name]/conf/passwd.conf

              [users]
              username1 = passwd1
              .......

          Setting access permission for subversion server:

            chown -R svn:svn /export/home/svn/[project name]
            chmod -R g+w /export/home/svn/[project name]
            chmod g+s /export/home/svn/[project name]/db

        * Create new tag or branch for project

            svn mkdir -m "[comment]" svn://[hostname]/[project name]/tags
            svn copy -m "[comment]" [local work copy dir] svn://[hostname]/[project name]/tags/[tag name]

        * Create hook scripts for project

          Enter hook dir on subverion server:

            cd /export/home/svn/[project name]/hooks

          Change the *.tmpl file to a executable script, take post-commit.tmpl for example:

            cp post-commit.tmpl post-commit
            chown svn:svn post-commit
            chmod 754 post-commit
             
          Customize post-commit to invoke your own commands, please refer to sample script below:
         
      #!/bin/sh

      REPOS="$1"
      REV="$2"

      SVNLOOK=/opt/csw/bin/svnlook
      CONTENT=/tmp/mail_content.$$

      echo "Event: putback-to" >> $CONTENT
      echo "Repository: $REPOS" >> $CONTENT
      echo "Reversion: $REV" >> $CONTENT

      CHANGED=`$SVNLOOK changed -r $REV $REPOS`
      AUTHOR=`$SVNLOOK author -r $REV $REPOS`
      DATE=`$SVNLOOK date -r $REV $REPOS`
      LOG=`$SVNLOOK log -r $REV $REPOS`

      echo "User: $AUTHOR" >> $CONTENT
      echo "Date: $DATE\n\n" >> $CONTENT
      echo "Files:\n$CHANGED\n" >> $CONTENT
      echo "Comments:\n$LOG\n" >> $CONTENT

      mailx -s "Code change notification mail" -r $AUTHOR@[domain.com][mail list address]< $CONTENT

      4. Related resource



      相关文章

      相关软件