summaryrefslogtreecommitdiffstats
path: root/gitmirror
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-09-30 22:05:14 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-09-30 22:05:14 -0700
commit43c9205623a3cb36520c6f68ca518f2a83f3868f (patch)
tree7f350df59f3d5b5b33acab0378fd54549a42cfa5 /gitmirror
parentb6e3f41106cfc1cded07b047b499f2569393b4a4 (diff)
downloadnasmbuild-43c9205623a3cb36520c6f68ca518f2a83f3868f.tar.gz
nasmbuild-43c9205623a3cb36520c6f68ca518f2a83f3868f.tar.xz
nasmbuild-43c9205623a3cb36520c6f68ca518f2a83f3868f.zip
Add git mirror scripts to version control
Scripts to track a remote git tree, and to send email on changes.
Diffstat (limited to 'gitmirror')
-rw-r--r--gitmirror/git.config15
-rwxr-xr-xgitmirror/robot.sh37
-rwxr-xr-xgitmirror/robotfmt.pl27
3 files changed, 79 insertions, 0 deletions
diff --git a/gitmirror/git.config b/gitmirror/git.config
new file mode 100644
index 0000000..bf5f05b
--- /dev/null
+++ b/gitmirror/git.config
@@ -0,0 +1,15 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+[remote "origin"]
+ url = git://repo.or.cz/nasm.git
+ fetch = +refs/heads/*:refs/remotes/origin/*
+[branch "master"]
+ remote = origin
+ merge = refs/heads/master
+[remote "zytor"]
+ url = /pub/git/nasm/nasm.git
+ fetch = +refs/heads/*:refs/remotes/zytor/*
+ push = +refs/remotes/origin/*:refs/heads/*
diff --git a/gitmirror/robot.sh b/gitmirror/robot.sh
new file mode 100755
index 0000000..8f7a25c
--- /dev/null
+++ b/gitmirror/robot.sh
@@ -0,0 +1,37 @@
+#!/bin/bash -xe
+
+MAILTO='NASM commits list <nasm-cvs@lists.sourceforge.net>'
+#MAILTO='NASM commits list <hpa+nasm/cvs@zytor.com>'
+SENDER='nasmbuild@zytor.com'
+
+# /usr/sbin needed for sendmail
+export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:$HOME/bin
+
+(
+ flock -nx 8 || exit 0
+
+ mkdir -m 0700 -p /tmp/$USER
+
+ cd $HOME/gitmirror/git
+ git fetch
+ git reset --hard origin/master
+ git push -f zytor
+ git push --tags -f zytor
+
+ HEAD=$(git-rev-parse HEAD)
+ OLD_HEAD=$(cat ../LAST_EMAIL)
+
+ if [ x"$HEAD" != x"$OLD_HEAD" ]; then
+ mkdir -m 0700 /tmp/$USER/gitpatches.$$
+
+ # -k = no [PATCH], since we're sending to a mailing list.
+ git format-patch -M -C -C -k -o /tmp/gitpatches.$$ $OLD_HEAD..$HEAD
+
+ for f in /tmp/gitpatches.$$/*; do
+ ../robotfmt.pl "$MAILTO" < "$f" | sendmail -f "$SENDER" -t
+ done
+
+ echo "$HEAD" > ../LAST_EMAIL
+ rm -rf /tmp/$USER/gitpatches.$$
+ fi
+) 8< "$0"
diff --git a/gitmirror/robotfmt.pl b/gitmirror/robotfmt.pl
new file mode 100755
index 0000000..0eeefed
--- /dev/null
+++ b/gitmirror/robotfmt.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+($mailto) = @ARGV;
+
+$hdr = 1;
+while (defined($line = <STDIN>)) {
+ chomp $line;
+ if ($hdr) {
+ next if ($line =~ /^From /); # Skip line
+ if ($line =~ /^Date:/) {
+ $date = $line;
+ next;
+ }
+ if ($line eq '') {
+ $hdr = 0;
+ print "To: $mailto\n";
+ print "X-Mailer: NASM-git-log-daemon\n";
+ print "\n";
+ print $date, "\n";
+ print "\n";
+ next;
+ }
+ }
+ print $line, "\n";
+}
+
+exit 0;