You are not logged in.

#1 2005-05-23 12:38:41

leeghoofd
Member
From: the Netherlands
Registered: 2005-04-28
Posts: 61

Easy subversion tutorial

Hello, I was looking for easy subversion tutorials but couldn't find them so I have created this one:

Subversion is a program to make it easy to work togethor on a project. On the server there is a group for every project and a user for every developper. For every project there is a different repo. So the setup of a new project will look like this:
* Create a reposatority with the svnadmin program as root
* Create a group (usually with the same name as the repo)
* Chown the group of the repo to the group we just added (chown -R root:newgroup /path/to/repo)
* Create users for the developpers of this project (with useradd)
* Add the users to the group (by editing the /etc/group file)

But before we can add project we have to install subverison and ssh:

pacman -S subversion openssh

Edit /etc/rc.conf and add sshd and svnserve to the DAEMONS array and start the daemons (because we don't want to reboot)

/etc/rc.d/svnserve start
/etc/rc.d/sshd start

Don't forget to edit /etc/hosts.deny and commend the line ALL: ALL: DENY because else it isn't possible to login remotly over ssh

Now lets create our test repo (remember, for every project we create a new repo, this is what confused me a long time..)

First we create directory where we are going to put all the repos in, the location doesn't matter at all!, If you like you can also put it on /svn or /home/user/myrepos or whatever

mkdir /usr/local/repos

Now create the test repo (as root)

svnadmin create --fs-type fsfs /usr/local/repos/test

Also we create a group called test (only the users in this group will be able to edit the test project)

groupadd test

And we have to make the repo only editable by people in the test group

chown -R root:test /usr/local/repos/test
chmod -R 775 /usr/local/repos/test

Now we create the users for de developpers of this project (and set the passwords)

useradd developper1
passwd developper1
uderadd developper2
passwd developper2

And of course add the users to the test group

usermod -G test developper1
usermod -G test developper2

Now the server is ready! Lets move to the computer of one of the devs (can be the same computer of course) and add some stuff to our test project

On the client computer we also need subversion and ssh so also type

pacman -S subversion openssh

But here we dont need to run the DAEMONS so skip that

Go to the directory where you do devepment

cd /home/developper1/projects

Only one time we need to type a complicatet command, this will checkout the test repo from the server:

svn checkout svn+ssh://developper1@ip_adres_of_the_server/usr/local/repos/test

Cd into the new test dir and create a file called testfile and put some text in it

cd test
vim testfile

We need to tell svn that this file is part of the project so type

svn add testfile

But this hasn't uploaded the file yet, we only told our local svn program that is has to upload it when we commit, to commit our project type

svn commit -m 'Added the test file'

The -m flag is for the logbook
Now if you want to check if someone else did change something type

svn checkout 

and svn will download the new files (if there are any)

Ok, so we now have created a testfile and uploaded it to the server, if we now move to the computer of the second developper or if the first developper wants to program on antoher computer just type

svn checkout svn+ssh://developper2@ip_adres_of_the_server/usr/local/repos/test

And you can change something and upload again with svn commit

There are a lot of usefull svn commands (to see the log and see diffs or merge different versions) but please see the svn book for that: http://svnbook.red-bean.com/en/1.0/index.html

I hope everything is clear now but just to be sure I will show the commands you have to type when you want another project and only want developper2 and developper 3 to be able to edit things

On the server type

svnadmin create --fs-type fsfs /usr/local/repos/realproject
groupadd realproject
chown -R root:realproject /usr/local/repos/realproject
chmod -R 775 /usr/local/repos/realproject

We only craete one new developper because the user for developper2 already exists

useradd developper3
passwd developper3

Add developper 3 to the realproject group

usermod -G realproject developper3

But developper2 was already in the test project (and I want him to stay there) so we have to add him to two groups

usermod -G test,realproject developper2

And thats it!

Offline

#2 2005-05-23 15:57:10

i3839
Member
Registered: 2004-02-04
Posts: 1,185

Re: Easy subversion tutorial

Add it to the wiki, then other people can improve it and keep it up to date. Also here it just gets lost, and on the wiki it's easier to find.

Offline

#3 2005-05-23 17:47:37

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Easy subversion tutorial

you should do

mkdir trunk branches tags
svn import svn+ssh://developper1@ip_adres_of_the_server/usr/local/repos/test .

To present the proper structure for your repository, after creating it and assigning permissions for it.

I generally prefer to use apache+svn so that I do not have to create user accounts on the box, and can setup more fine grained permissions for my repositories.

Nice howto though.  tongue


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#4 2005-05-24 13:18:39

leeghoofd
Member
From: the Netherlands
Registered: 2005-04-28
Posts: 61

Re: Easy subversion tutorial

Thanks for you replys

In the wiki there is already a tutorial about svn+apache, how should I add this tutorial? Name it easy ssh subverison tutorial or something?

cactus, I just started with subversion so I don't know yet where branches and tags are for but I will learn more about it and change the tutorial as soon as I have some free time.

Cheers,
David

Offline

#5 2005-05-24 17:22:46

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Easy subversion tutorial

A branch and a tag in subversion is considered a "cheap copy".
The "subversion book" has good information on what branches and tags are for: http://svnbook.red-bean.com/en/1.1/ch04.html

ps. Subversion 1.2 is out..when is arch going to update? changelog


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#6 2005-05-26 15:47:38

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Easy subversion tutorial

cactus wrote:

ps. Subversion 1.2 is out..when is arch going to update? changelog

Altered Jason Chu's PKGBUILD (changed version number and updated the DL-URL and md5sum) and it works here:

# $Id: PKGBUILD,v 1.46 2005/04/05 14:27:00 jason Exp $
# Contributer: Jason Chu <jason@archlinux.org>
# Maintainer: Jason Chu <jason@archlinux.org>
pkgname=subversion
pkgver=1.2.0
pkgrel=1
pkgdesc="Replacement for CVS, another versioning system"
depends=('glibc' 'expat' 'libxml2' 'gdbm' 'zlib' 'db>=4.3' 'neon' 'apr' 'apr-util')
makedepends=('apache' 'python' 'perl>=5.8.4-1' 'swig>=1.3.24')
source=(http://subversion.tigris.org/tarballs/$pkgname-$pkgver.tar.gz svnserve svn svnserve.conf)
md5sums=('ad2daf6ec0f17b84131828eca9888c98' '22d452e0de5168d56c438d99c7ad72fa'
         'a0db6dd43af33952739b6ec089852630' 'c0001ceb13418a065915e27dfdf592c0')
backup=('etc/xinetd.d/svn' 'etc/conf.d/svnserve')
url="http://subversion.tigris.org/"

build() {
   cd $startdir/src/$pkgname-$pkgver
#   export LDFLAGS="-L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_client/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_delta/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_fs/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_fs_base/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_fs_fs/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_repos/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_ra_svn/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_ra/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_ra_dav/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_ra_local/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_subr/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_diff/.libs 
#        -L$startdir/src/$pkgname-$pkgver/$pkgname/libsvn_wc/.libs"
   ./configure --prefix=/usr --with-apr=/usr/bin/apr-config --with-apr-util=/usr/bin/apu-config --with-zlib --with-neon=/usr
   make DESTDIR=$startdir/pkg || return 1

   export LD_LIBRARY_PATH=$startdir/pkg/usr/lib:$LD_LIBRARY_PATH
   make DESTDIR=$startdir/pkg install

   make DESTDIR=$startdir/pkg swig-py
   make install-swig-py DESTDIR=$startdir/pkg

   mkdir -p $startdir/pkg/usr/lib/python2.4
   mv $startdir/pkg/usr/lib/svn-python/ $startdir/pkg/usr/lib/python2.4/site-packages

   mkdir -p $startdir/pkg/usr/share/subversion
   cp -r tools/hook-scripts $startdir/pkg/usr/share/subversion
   rm -f $startdir/pkg/usr/share/subversion/hook-scripts/*.in

   make DESTDIR=$startdir/pkg swig-pl
   make install-swig-pl DESTDIR=$startdir/pkg

   rm -r $startdir/pkg/usr/lib/perl5/?.?.?

#   make DESTDIR=$startdir/pkg javahl
#   make DESTDIR=$startdir/pkg install-javahl

   mkdir -p $startdir/pkg/etc/rc.d
   mkdir -p $startdir/pkg/etc/xinetd.d
   mkdir -p $startdir/pkg/etc/conf.d

   install -m 755 $startdir/src/svnserve $startdir/pkg/etc/rc.d
   install -m 644 $startdir/src/svn $startdir/pkg/etc/xinetd.d
   install -m 644 $startdir/src/svnserve.conf
$startdir/pkg/etc/conf.d/svnserve
}

You'll want to pick up the " svnserve svn svnserve.conf" files in /var/abs/extra/devel/subverion/.

P.S. You're looking a little under the weather, lately

1149015154283fdadc92db.gif

I miss the cactus...

Offline

#7 2005-05-26 18:47:08

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Easy subversion tutorial

soloport wrote:

P.S. You're looking a little under the weather, lately

1149015154283fdadc92db.gif

I miss the cactus...

Springtime with allergies has that effect.
Look for a happier avatar in the coming days.  big_smile


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB