var/lib/invirt-dev/queue
var/log/invirt/builds
usr/share/invirt-dev/build-hooks
+usr/share/invirt-dev/git-hooks
reprepro-env usr/bin
+invirt-configure-git-hooks usr/bin
repository-config/* srv/repository/conf
-build-hooks usr/share/invirt-dev
\ No newline at end of file
+build-hooks usr/share/invirt-dev
+git-hooks usr/share/invirt-dev
echo " adduser \$user sbuild"
echo "to make individual users that will build packages."
echo "-----"
+
+ invirt-configure-git-hooks || {
+ echo "-----"
+ echo "invirt-dev: Could not configure git hooks."
+ echo "Run 'invirt-configure-git-hooks'once you"
+ echo "have configured your repositories appropriately."
+ echo "-----"
+ }
;;
abort-upgrade|abort-remove|abort-deconfigure)
--- /dev/null
+../sub/post-receive
\ No newline at end of file
--- /dev/null
+../sub/zephyr-post-receive
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+
+file=`mktemp -t git-post-receive.XXXXXX` || exit $?
+cat >$file
+
+"$PWD"/hooks/zephyr-post-receive <$file
+
+rm -f $file
--- /dev/null
+#!/bin/sh
+
+ref="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+
+if [ -z "$GIT_DIR" ]; then
+ echo "Don't run this script from the command line." >&2
+ echo " (if you want, you could supply GIT_DIR then run" >&2
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
+ exit 1
+fi
+
+if [ -z "$ref" ] || [ -z "$oldrev" ] || [ -z "$newrev" ]; then
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+ exit 1
+fi
+
+# --- Disallow pushing to the branches for pockets
+
+pocket_to_git() {
+ local pocket git
+ pocket="$1"
+ git="$(invirt-getconf "git.pockets.$pocket.git" 2>/dev/null)"
+ if [ $? != 0 ]; then
+ git="$pocket"
+ fi
+ echo "$git"
+}
+
+for pocket in $(invirt-getconf -l build.pockets); do
+ if [ "$ref" = "refs/heads/$(pocket_to_git "$pocket")" ]; then
+ echo "*** Pushing to a pocket branch in this repository is not allowed" >&2
+ exit 1
+ fi
+done
+
+# --- Disallow pushing tags
+
+case "$ref" in
+ refs/heads/*)
+ ;;
+ *)
+ echo "*** Pushing non-branches to this repository is not allowed" >&2
+ exit 1
+ ;;
+esac
--- /dev/null
+#!/bin/sh
+#
+# This script is run after receive-pack has accepted a pack and the
+# repository has been updated. It is passed arguments in through stdin
+# in the form
+# <oldrev> <newrev> <refname>
+# For example:
+# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
+
+base=build.hooks.post_commit.zephyr
+
+class=$(invirt-getconf "$base.class" 2>/dev/null)
+instance=$(invirt-getconf "$base.instance" 2>/dev/null)
+zsig=$(invirt-getconf "$base.zsig" 2>/dev/null)
+color=$(invirt-getconf "$base.color" 2>/dev/null)
+
+if [ "${color:-true}" = "true" ]; then
+ usecolor="--color"
+else
+ usecolor=""
+fi
+
+if [ -z "$class" ]; then
+ echo "I don't know where to send a commit zephyr!" >&2
+ echo "Please provide a value for $base.class in" >&2
+ echo "your invirt config file." >&2
+ exit 1
+fi
+while read oldrev newrev refname; do
+ if [ "$oldrev" = "0000000000000000000000000000000000000000" ]; then
+ # dammit git
+ zwrite -c "$class" -i "$(basename "$refname")" -s "${zsig:-Git}: $refname" -d \
+ -m "New branch created."
+ continue
+ fi
+ git rev-list --first-parent --reverse "$oldrev..$newrev" | while read rev; do
+ shortrev=`git log -1 --pretty=format:%h "$rev"`
+ (git show --stat -M $usecolor "$rev" |
+ sed -e 's/@/@@/g' \
+ -e 's/}/@(})/g' \
+ -e 's/\e\[m/}@{/g' \
+ -e 's/\e\[33m/@color(yellow)/g' \
+ -e 's/\e\[31m/@color(red)/g' \
+ -e 's/\e\[32m/@color(green)/g' \
+ -e '1s/^/@{/' \
+ -e '$s/$/}/') |
+ zwrite -c "$class" -i "${instance:-$shortrev}" -s "${zsig:-Git}: $refname" -d
+ done
+done
--- /dev/null
+#!/bin/sh
+
+ref="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+
+if [ -z "$GIT_DIR" ]; then
+ echo "Don't run this script from the command line." >&2
+ echo " (if you want, you could supply GIT_DIR then run" >&2
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
+ exit 1
+fi
+
+if [ -z "$ref" ] || [ -z "$oldrev" ] || [ -z "$newrev" ]; then
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+ exit 1
+fi
+
+# --- Disallow all pushes
+
+echo "*** Pushing to the superproject is not allowed" >&2
+echo "***" >&2
+echo "*** If you would like to update the superproject, use remctl" >&2
+exit 1
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+link_to() {
+ rm -rf "$1"
+ ln -s "$2" "$1"
+}
+
+package_base=/srv/git/invirt
+hook_base=/usr/share/invirt-dev/git-hooks
+
+link_to "$package_base/packages.git/hooks" "$hook_base/super"
+
+for pkg in "$package_base"/*/*.git; do
+ case "$pkg" in
+ "$package_base/packages/*.git") link_to "$pkg/hooks" "$hook_base/sub" ;;
+ *) link_to "$pkg/hooks" "$hook_base/other" ;;
+ esac
+done