Using Subversion and ViewCVS on Solaris 10
2008-09-12 10:37
549 查看
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 packagepkg-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 subversionvi /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 clientPlease 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 repositoryCreate 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
a58a
/[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 from a 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: $DATEnn" >> $CONTENT echo "Files:n$CHANGEDn" >> $CONTENT echo "Comments:n$LOGn" >> $CONTENT mailx -s "Code change notification mail" -r $AUTHOR@[domain.com][mail list address]< $CONTENT
相关文章推荐
- Using Subversion and ViewCVS on Solaris 10
- How to Configure and Run PostgreSQL on Solaris 10
- Migrating files between NTFS on Windows XP and Solaris 10
- [原创]Branded Zones on Solaris 10 (Sparc and X86)
- Install And Configure Sybase ASE On Solaris 10 X64
- Step by Step Installation of the Subversion 1.x Server for Linux and Solaris 8/9/10 (English)
- Using Subversion With ViewCVS For Windows
- Issue 71 - pymssql - Undefined symbols on Mac, CentOS, Redhat with pre-compiled build - A fast MS SQL Server client library for Python directly using C API instead of ODBC. It is Python DB-API 2.0 compliant. Works on Linux, *BSD, Solaris, Mac OS X and Win
- MonkeyRunner_Click on a View contains specified text using monkeyrunner and Android ViewClient
- Install driver for rtl8111d of mother board GA-880GM-D2H on solaris10
- build sl4a in eclipse and using on device.
- How to Perform System Boot and Shutdown Procedures for Solaris 10, Part D
- RemoteBox : Screenshots Screenshots Various screenshots of RemoteBox under different operating systems including Linux, MacOS X, Solaris, NetBSD, FreeBSD and OpenBSD. Do you have a screenshot of RemoteBox running on a distro or operating system
- Tips: 使用autotools生成动态.so库文件 / Generate .so library files using autotools in Solaris and Linux
- WSGI using uWSGI and nginx on Ubuntu 12.04 (Precise Pangolin)
- Installing and using VirtualBox on CentOS
- explanation on new cvspilltree in opencv subversion
- Installing ImageMagick on Windows and Using with PHP
- Setting Up NAT on Solaris Using IP Filter
- A robot with a view—how drones and machines can navigate on their own [video]