Archived
1
0
Fork 0

Start defense tag hook

This commit is contained in:
Mercier Pierre-Olivier 2013-09-18 07:53:50 +02:00
parent 751afab04f
commit bad4dd3766

View file

@ -74,7 +74,73 @@ sub repository_name
sub tag_defense
{
my $creation = shift;
# From here, we have:
# 1: "defense"
# 2: $version
# 3: $id
# 4: $path
# 5: $year
my $version = $_[3] // 1;
my $project_id = repository_name();
if ($_[3])
{
# Check on ID/flavour_id
if ($_[3] =~ /^\d+$/) {
log ERROR, "defense:* tag can't take version. Tag format: defense:version:id:year";
}
$project_id .= "-" . $_[3];
}
$project_id = lc $project_id;
$project_id =~ s/[^a-z0-9-_]/_/g;
my $year;
if ($_[5])
{
# Check on year
if ($_[5] !~ /^\d+$/) {
log ERROR, "project:*:* second argument is the year. Tag format: project:id:year";
}
$year = $_[5];
}
else {
$year = LDAP::get_year;
}
if ($creation)
{
my $newref = $ARGV[2];
my $path;
if ($_[4]) {
$path = $_[4];
}
else
{
}
log INFO, "Création/mise à jour de la soutenance...";
my $content = qx(git show $newref:project.xml);
# Check file exists
if ($?) {
log ERROR, "Créez un fichier project.xml à la racine du dépôt.";
}
# Check DTD validity
if (check_xml(\$content, "http://acu.epita.fr/dtd/defense.dtd")) {
log ERROR, "Corrigez les erreurs du fichier XXX.xml avant de lancer la création du projet.";
}
# TODO: check user permissions
}
}
sub tag_document