[sysadmin-bin: 18/168] Pass the module name to CIA
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 18/168] Pass the module name to CIA
- Date: Thu, 24 May 2012 19:52:58 +0000 (UTC)
commit 1a306583802ecb111ea952ecb361ee71fbd500da
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Feb 10 15:48:03 2009 -0500
Pass the module name to CIA
post-receive-notify-cia: Determine the module name from GIT_DIR
and pass to the ciabot.pl.
ciabot.pl: Get the module name from the GNOME_GIT_MODULE environment
variable that we set and write it into the email we send out.
ciabot.pl | 6 ++++++
post-receive-notify-cia | 15 +++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/ciabot.pl b/ciabot.pl
index 3eb1a25..099ca0d 100755
--- a/ciabot.pl
+++ b/ciabot.pl
@@ -115,6 +115,11 @@ my $line;
$commit = $ARGV[0];
$branch = $ARGV[1];
+$module = undef;
+if (exists $ENV{'GNOME_GIT_MODULE'}) {
+ $module = $ENV{'GNOME_GIT_MODULE'};
+}
+
open COMMIT, "git-cat-file commit $commit|" or die "git-cat-file commit $commit: $!";
my $state = 0;
$logmsg = '';
@@ -192,6 +197,7 @@ $message = <<EM
EM
;
$message .= " <branch>$branch</branch>" if ($branch);
+$message .= " <module>$module</module>" if ($module);
$message .= <<EM
</source>
<timestamp>
diff --git a/post-receive-notify-cia b/post-receive-notify-cia
index 131f553..5a90ef2 100755
--- a/post-receive-notify-cia
+++ b/post-receive-notify-cia
@@ -5,6 +5,21 @@
BINDIR=$(cd $(dirname $0) && pwd)
+# Set GIT_DIR either from the working directory, or from the environment
+# variable.
+GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
+if [ -z "$GIT_DIR" ]; then
+ echo >&2 "fatal: post-receive: GIT_DIR not set"
+ exit 1
+fi
+
+# We figure out the module from the directory name with .git stripped. Then
+# pass that to ciabot.pl as an environment variable. (We use an environment
+# variable to get a minimal delta from upstream ciabot.pl.)
+absdir=$(cd $GIT_DIR && pwd)
+GNOME_GIT_MODULE=$(basename ${absdir%.git})
+export GNOME_GIT_MODULE
+
# Adapted from:
# http://kitenet.net/~joey/blog/entry/lazyweb:_git_cia_hooks/
while read oldrev newrev refname; do
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]