Artisan Numérique

/développement/gestionnaire de version/sgv/cvs/ Mettre en oeuvre un serveur CVS

CVS est un vénérable système de gestion de sources. Ce qui suit est plus une série de cas pratique qu'un tutorial à part entière

Création de la base de donnée

gastoncvs -d /cvsroot init
initalisation du dépôt

Création de l'espace « Mot de passes »

rootsu - cvs # passage en utilisateur cvs
rootexport CVSROOT=/cvsroot
rootcvs co CVSROOT
rootcd CVSROOT
roottouch passwd
rootcvs add passwd
rootcvs update
rootcvs commit -m

Ajouter laligne "passwd" à la fin du fichier checkoutlist
rootecho passwd >> checkoutlist
rootcvs update
rootcvs commit -m
rootcd ..
rootcvs release -d CVSROOT

Ajout des utilisateurs

#!/usr/bin/perl -W
use strict;

my ($user_name, $password) = @ARGV;
if(!$user_name || !$password){print "Usage: $0 [username] [password]\n";exit;};

system ('cvs -Q co CVSROOT/passwd');
my $password_file = "CVSROOT/passwd";
open (INFILE, "$password_file") or die("Failed to open $password_file\n");

srand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("<fo nt color="c">c", eval $randletter, eval $randletter);
my $plaintext = $password;
my $crypttext = crypt ($plaintext, $salt);

my $output;
my $switched = '0';

while (&lt;INFILE&gt;)
{
  if ($_=~m/^$user_name\:/)
  {
    $_ =~ s/$user_name:.*:/$user_name:${crypttext}:/;
    print STDOUT "User $user_name exists, updating password\n";
    $switched = '1';
  };

  $output .= $_;
};

close INFILE;
if ($switched != '1')
{
  # add the new user
  open (OUTFILE, "&gt;&gt;$password_file") or die("Can't open $password_file\n");
  print OUTFILE "${user_name}\:${crypttext}\:cvs\n";
  #or print STDERR "couldn't push to $password_file\n";
}
else
{
  # update the file for new password
  open (OUTFILE, "&gt;$password_file") or die("Can't open $password_file\n");
  print OUTFILE $output
};

close OUTFILE;
system ('cvs update CVSROOT ; cvs commit -m "updating password file for $user_name" CVSROOT');
system ('cvs -Q release -d CVSROOT');
Outil de création de compte utilisateur CVS

Ne pas oublier de mettre chaque utilisateur aillant acces à CVS dans le groupe CVS

Importation

Pour importer un dossier en tant que module, il faut se placer dans le dossier et taper la commande suivante :

cvs import -I ! -W "*.jar -k 'b'" -m "initial" NOM_MODULE yoran release

Erreur au login

cvs -d :pserver:gaston@machine_cvs:/cvsroot login

Logging in to :pserver:gaston@machine_cvs:/cvsroot
CVS password:
cvs login: CVSROOT must be an absolute pathname (not `${cvs.root}')
cvs login: when using local access method.
cvs login: warning: skipping invalid entry in password file at line 5

rm -rf ~/.cvspass
cvs -d :pserver:gaston@machine_cvs:/cvsroot login
Logging in to :pserver:gaston@machine_cvs:/cvsroot
CVS password:

Ajout d'un hook

Dans CVSROOT/hook.sh

#logger "hello"
      repository=echo $1 | cut -d" " -f1</a>
    repository=/minerva/cvsroot/$repository
    logger "Mise à jour des droits sur $repository"
    chmod gu+rwX,o-rwx $repository -Rf &gt; /dev/null
    chown :minerva  $repository -Rf &gt; /dev/null
    cat &gt; /dev/null

Dans CVSROOT/login

DEFAULT (/minerva/cvsroot/CVSROOT/hook.sh %{V})

Gestion automatique des binaires

Dans CVSROOT/cvswrapper

# This file affects handling of files based on their names.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
#  wildcard   [option value][option value]...
# This file affects handling of files based on their names.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
#  wildcard   [option value][option value]...
#
#  where option is one of
#  -m     update methodology  value: MERGE or COPY
#  -k     expansion mode    value: b, o, kkv, &c
#
#  and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'
*.CLASS -k 'b' -m 'COPY'
*.DOC -k 'b' -m 'COPY'
*.EAR -k 'b' -m 'COPY'
*.GIF -k 'b' -m 'COPY'
*.JPG -k 'b' -m 'COPY'
*.PDF -k 'b' -m 'COPY'
*.TAR -k 'b' -m 'COPY'
*.WAR -k 'b' -m 'COPY'
*.ZIP -k 'b' -m 'COPY'
*.avi -k 'b' -m 'COPY'
*.bin -k 'b' -m 'COPY'
*.bz  -k 'b' -m 'COPY'
*.bz2 -k 'b' -m 'COPY'
*.class -k 'b' -m 'COPY'
*.doc -k 'b' -m 'COPY'
*.ear -k 'b' -m 'COPY'
*.exe -k 'b' -m 'COPY'
*.gif -k 'b' -m 'COPY'
*.gz  -k 'b' -m 'COPY'
*.hqx -k 'b' -m 'COPY'
*.jar -k 'b' -m 'COPY'
*.jpeg  -k 'b' -m 'COPY'
*.jpg -k 'b' -m 'COPY'
*.mov -k 'b' -m 'COPY'
*.mp3 -k 'b' -m 'COPY'
*.mpg -k 'b' -m 'COPY'
*.pdf -k 'b' -m 'COPY'
*.png -k 'b' -m 'COPY'
*.ppt -k 'b' -m 'COPY'
*.rpm -k 'b' -m 'COPY'
*.sit -k 'b' -m 'COPY'
*.srpm  -k 'b' -m 'COPY'
*.swf -k 'b' -m 'COPY'
*.tar -k 'b' -m 'COPY'
*.tbz -k 'b' -m 'COPY'
*.tgz -k 'b' -m 'COPY'
*.tif -k 'b' -m 'COPY'
*.tiff  -k 'b' -m 'COPY'
*.war -k 'b' -m 'COPY'
*.xbm -k 'b' -m 'COPY'
*.xls -k 'b' -m 'COPY'
*.zip -k 'b' -m 'COPY'
*.sxc -k 'b' -m 'COPY'
*.sxw -k 'b' -m 'COPY'
*.psd -k 'b' -m 'COPY'
#