Using Subversion and Viewcvs on Solaris 10

Source: Internet
Author: User
Tags auth chmod diff svn svn update tag name
Using Subversion and Viewcvs on Solaris 10

Author:badcoffee
Email:blog.oliver@gmail.com
Date:jan, 2005

Original Site:http://blog.csdn.net/yayong
Copyright:anyone refer to this article, must include author information and original site URL. SummaryThis article is a introduction which show you 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 the Subversion book for more details.

1. Subversion Setup 1.1 Install Subversion PackageGrab 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 the last, maybe modify/opt/csw/etc/pkg-get.conf the 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 ServerCreate 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, can refer to INSTALL file in Viewcvs.
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 serverConfigure 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, 12:43:17) [C] on sunos5
Type ' help ', ' copyright ', ' credits ' or ' license ' for the 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

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

3. Viewcvs Setup 3.1. For developer
* Install a Subverion client

Please 1.1 above.

* Start work with subversion

Get project URL to 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, and 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 command:

SVN help

* Get a certain release of project?

Need know Realse name A.

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


* ADD new project into Viewcvs:

Vi/usr/local/viewcvs-1.0-dev/viewcvs.conf

Svn_roots = [Project name1]:/export/home/svn/[project name1],
[Project Name2]:/export/home/svn/[project name2],
[Project Name3]:/export/home/svn/[project Name3]


* 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]

* Backup and Restore repository

Make a full backup for a subversion project:

Svnadmin dump/export/home/svn/[project name] > [Name of Path]/[project Name].full_dumpfile

If Workspace is damaged, restore a project workspace to full backup file:

Svnadmin Load/export/home/svn/[project Name] < [name of Path]/[project Name].full_dumpfile

* 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= "$"
rev= "$"

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
Subversion Book
VIEWCVS site
Installation and setup of development environments on Solaris

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.