SNV SERVER en Gentoo - Poner fijas las USE flags: # echo "dev-util/subversion apache2 berkdb" >> /etc/portage/package.use # emerge -pv subversion These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] dev-util/subversion-1.3.2-r1 USE="apache2 berkdb nls perl zlib -bash-completion -emacs -java -nowebdav -python -ruby" 0 kB Total size of downloads: 0 kB - Crear el repositorio inicial y sus permisos: - svn sobre ssh: 1. Arreglar los permisos de el repositorio: groupadd svnusers chown -R root:svnusers /var/svn/repos/ chmod -R g-w /var/svn/repos chmod -R g+rw /var/svn/repos/db chmod -R g+rw /var/svn/repos/locks 2. Crear un wrapper para svserve en /usr/local/bin para poner el umask que quires, por ejemplo: #!/bin/bash umask 002 exec /usr/bin/svnserve "$@" - Editar el script de inicio de svnserve para que use el wrapper que creamos # vim /etc/init.d/svnserve start() { ebegin "Starting svnserve" # Ensure that we run from a readable working dir, and that we do not # lock filesystems when being run from such a location. cd / start-stop-daemon --start --quiet --background --make-pidfile \ --pidfile /var/run/svnserve.pid --exec /usr/local/bin/svnserve \ --chuid ${SVNSERVE_USER:-apache}:${SVNSERVE_GROUP:-apache} -- \ --foreground --daemon ${SVNSERVE_OPTS:---root=/var/svn} eend $? } - Agregar usuario al grupo snvusers: # gpasswd -a tuxjm svnusers $ id uid=1001(tuxjm) gid=440(tuxjm) groups=16(cron),81(apache),100(users),440(tuxjm),5002(svnusers) - Crear repo inicial: $ cd ~ $ mkdir SVN_REPOS/ $ mkdir -p tuxjm_docs/{trunk,tags,branches} $ cd tuxjm_docs/trunk/ $ cp -r -v -a ../../../public_html/* . $ cd ../../ $ svn import tuxjm_docs file:///var/svn/repos/tuxjm_docs Listado por modo archivo (file:///) $ svn list --verbose file:///var/svn/repos 1 tuxjm Oct 04 10:09 tuxjm_docs/ Listado por modo svn+ssh $ svn list --verbose svn+ssh://tuxjm@tuxjm.net/var/svn/repos 1 tuxjm Oct 04 10:09 tuxjm_docs/ - Resumen de comandos: * svn import: add a location to the repository * svn checkout: copy to a location from the repository * svn update: brings your working copy up-to-date with the repository. * svn diff: output the differences between your changes and the last update. * svn status: show the status of your changes. This command should systematically be used before committing. * svn commit: commits the new version of your files to the repository. * svn revert: revert your changes to the last update. - Ejemplos reales: Supon que estabas en $SERVER e importaste tu codigo en el svn. Ahora pretende que estas en $REMOTE y quieres la misma estructura de directorios como la original asi como tambien checkout una copia de el codigo que acabas de importar. $ cd $HOME $ mkdir -p SVN_REPOS/tuxjm_docs $ svn checkout svn+ssh://tuxjm@$REMOTE/var/svn/repos/tuxjm_docs SVN_REPOS/tuxjm_docs/ ..... ....... ......... A SVN_REPOS/tuxjm_docs/trunk/explicacion-squid.slackbuild.txt A SVN_REPOS/tuxjm_docs/trunk/aceleracion_pci_radeon_7000.txt A SVN_REPOS/tuxjm_docs/trunk/snort+slack.txt A SVN_REPOS/tuxjm_docs/trunk/OOo2 A SVN_REPOS/tuxjm_docs/branches A SVN_REPOS/tuxjm_docs/tags Checked out revision 1. Ahora mientras estas en $REMOTE, haces unos cambios en tu working copy y te quires asegurar de que los cambios se hicieron y su status, dodne encuentras que un archivo ha cambiado, un archivo ha sido agregado, y uno eliminado. esto es lo que esperas, asi que haces commit de las actualizaciones a $SERVER. $ cd $HOME $ cd SVN_REPOS $ vim tuxjm_docs/trunk/remove-comments.txt $ svn diff tuxjm_docs Index: tuxjm_docs/trunk/remove-comments.txt =================================================================== --- tuxjm_docs/trunk/remove-comments.txt (revision 1) +++ tuxjm_docs/trunk/remove-comments.txt (working copy) @@ -1 +1,4 @@ -grep -vE '^$|^#' archivo.conf > archivo-nocomments.conf +Como quitar comentarios con "#" y lineas en blanco de un archivo +de configuracion para enviarlo a alguien y sea mas facil de examinarlo. + +$ grep -vE '^$|^#' archivo.conf > archivo-nocomments.conf jmedina@jamedina:~/temp/SVN_REPOS$ svn status tuxjm_docs M tuxjm_docs/trunk/remove-comments.txt Agregar un archivo a la copia local: $ cp -v /home/jmedina/Desktop/gentoo-svn-over-ssh.txt tuxjm_docs/trunk/ `/home/jmedina/Desktop/gentoo-svn-over-ssh.txt' -> `tuxjm_docs/trunk/gentoo-svn-over-ssh.txt' $ svn status tuxjm_docs ? tuxjm_docs/trunk/gentoo-svn-over-ssh.txt $ svn add tuxjm_docs/trunk/gentoo-svn-over-ssh.txt A tuxjm_docs/trunk/gentoo-svn-over-ssh.txt $ svn status tuxjm_docs A tuxjm_docs/trunk/gentoo-svn-over-ssh.txt $ touch tuxjm_docs/trunk/test-svn-del-file $ svn status tuxjm_docs ? tuxjm_docs/trunk/test-svn-del-file M tuxjm_docs/trunk/remove-comments.txt A tuxjm_docs/trunk/gentoo-svn-over-ssh.txt $ svn add tuxjm_docs/trunk/test-svn-del-file A tuxjm_docs/trunk/test-svn-del-file jmedina@jamedina:~/temp/SVN_REPOS$ svn status tuxjm_docs M tuxjm_docs/trunk/remove-comments.txt A tuxjm_docs/trunk/test-svn-del-file A tuxjm_docs/trunk/gentoo-svn-over-ssh.txt $ svn commit tuxjm_docs # make a comment about your submittion Adding tuxjm_docs/trunk/gentoo-svn-over-ssh.txt Sending tuxjm_docs/trunk/remove-comments.txt Adding tuxjm_docs/trunk/test-svn-del-file Transmitting file data ... Committed revision 2. Ahora regresas a la maquina donde se hizo todo originalmente, y quires actualizar tu working copy con los cambios que hiciste hace rato en el servidor. $ cd $HOME $ cd SVN_REPOS $ svn update tuxjm_docs #At revision 2. svn revert Documents/code/$PROJECT_1 REFERENCIAS: SVN Book: http://svnbook.red-bean.com/en/1.1/ch01s07.html http://gentoo-wiki.com/HOWTO_Subversion http://gentoo-wiki.com/HOWTO_Apache2_with_subversion_SVN_and_DAV Introducción a Subversion: http://libertonia.escomposlinux.org/story/2004/5/19/142850/344 SVN Trac Install: http://wiki.koeln.ccc.de/index.php/SVN_Trac_Install Servidor subversion con Gentoo: http://www.marblestation.com/blog/?p=148