From b5806fac12480f002e7f193f5f6f7734dd26f645 Mon Sep 17 00:00:00 2001 From: Mercier Pierre-Olivier Date: Wed, 23 Oct 2013 06:57:13 +0200 Subject: [PATCH] Add hook for conferences repository --- Makefile | 1 + hooks/conferences.pl | 49 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 hooks/conferences.pl diff --git a/Makefile b/Makefile index 1d62a40..12886aa 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ install: ! test -d $(GITOLITE_DEST) || $(MAKEDIR) -p $(GITOLITE_DEST)/update.secondary.d ! test -d $(GITOLITE_DEST) || $(COPY) hooks/gl-pre-git $(GITOLITE_DEST)/ ! test -d $(GITOLITE_DEST) || $(COPY) hooks/subjects.pl $(GITOLITE_DEST)/update.secondary.d/ + ! test -d $(GITOLITE_DEST) || $(COPY) hooks/conferences.pl $(GITOLITE_DEST)/update.secondary.d/ ! test -d $(GITOLITE_DEST) || $(COPY) hooks/submissions.pl $(GITOLITE_DEST)/update.secondary.d/ update: diff --git a/hooks/conferences.pl b/hooks/conferences.pl new file mode 100644 index 0000000..755d021 --- /dev/null +++ b/hooks/conferences.pl @@ -0,0 +1,49 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use v5.10; +use Digest::SHA qw(sha1_base64); +use File::Basename; +use utf8; + +use ACU::API::Projects; +use ACU::Defense; +use ACU::LDAP; +use ACU::Log; +$ACU::Log::log_file = "/var/log/hooks/" . basename($0) . ".log"; +use ACU::Process; + +# First, check if the repository is in the conferences/ directory +exit 0 if ($ENV{GL_REPO} !~ /^conferences\//); + +my ($ref, $oldsha, $newsha) = @ARGV; + +log DONE, "This is a conference repository!"; + +my %known_tags = ( + "subject" => \&tag_document, +); + +if ($ref =~ m<^refs/tags(/.+)$>) +{ + my $tag = $1; + my @args; + + while ($tag =~ m<[,/]([^,]*)>g) { + push @args, $1; + } + + my $create = ($newsha ne '0' x 40); + + if (exists $known_tags{$args[0]}) { + exit $known_tags{$args[0]}($create, @args); + } +} + +exit 0; + +sub tag_document +{ + +}