Replace the superrepo hooks with an update hook that rejects all
authorEvan Broder <broder@mit.edu>
Mon, 12 Oct 2009 06:16:27 +0000 (02:16 -0400)
committerEvan Broder <broder@mit.edu>
Mon, 12 Oct 2009 06:16:27 +0000 (02:16 -0400)
pushes.

svn path=/trunk/scripts/git-hooks/; revision=2500

super/build-pre-receive [deleted file]
super/post-receive [deleted file]
super/pre-receive [deleted file]
super/update [new file with mode: 0755]
super/zephyr-post-receive [deleted symlink]

diff --git a/super/build-pre-receive b/super/build-pre-receive
deleted file mode 100755 (executable)
index d6f84cb..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-set -e
-
-read oldrev newrev head
-if [ $head != 'refs/heads/dev' ]; then
-  echo "error: head not recognized: $head" >&2
-  exit 1
-fi
-if read; then
-  echo "error: one update at a time, please" >&2
-  exit 1
-fi
-
-tmpdir=$(mktemp -d /tmp/xvm-git-XXXXXX)
-echo "build directory $tmpdir"
-
-# XXX fixme
-sbuild () { echo "  SBUILD" "$@"; }
-
-build_package () {
-  packagepath=$1
-  rev=$2
-
-  package=${packagepath#packages/}
-  url=$(git config -f $tmpdir/git/.gitmodules submodule.$packagepath.url)
-  echo "building $package at new version $rev"
-
-  srcdir=$tmpdir/$package
-  mkdir $srcdir
-  # XXX remove that .git -- be sure to include it in `git submodule add`
-  git --git-dir=$url.git archive $rev | tar -xf - -C $srcdir
-  pushd $srcdir >/dev/null
-
-  eval $(perl -ne 'print if s/^(Version|Source|Distribution): /\1=/' \
-           <(dpkg-parsechangelog))
-  dpkg-buildpackage -us -uc -rfakeroot -S
-  cd ..
-
-  eval $(perl -ne 'print if s/^(Architecture): /\1=/' ${Source}_${Version}.dsc)
-  case $Architecture in
-    all)
-      sbuild -d $distribution --arch-all   ${Source}_${Version}.dsc;;
-    any)
-      sbuild -d $distribution --arch amd64 --arch-all ${Source}_${Version}.dsc
-      sbuild -d $distribution --arch i386  ${Source}_${Version}.dsc;;
-    *)
-      echo "build-pre-receive: arch '$Architecture' unimplemented" >&2
-      exit 1
-  esac
-
-  echo "XXX tag submodule as $Version"
-
-  [ $Distribution = 'unstable' ] \
-      || echo "$(basename $0): warning: Distribution is $Distribution, script expects unstable"
-
-  echo "built $package version $Version from commit $rev"
-  popd >/dev/null
-}
-
-git clone . $tmpdir/git
-
-git ls-tree $newrev packages/ \
- | grep ^160000\ commit \
- | while read x y newsubrev packagepath; do
-     # XXX deal with new packages
-     # XX deal with removed packages
-     oldsubrev=$(git ls-tree $oldrev $packagepath | perl -lane 'print $F[2]')
-     if [ $newsubrev == $oldsubrev ]; then
-       continue
-     fi
-
-     build_package $packagepath $newsubrev
-   done
-
-
-exit 0
-
-for package; do
-    changesfile=`pwd`/${Source}_*${Version}*.changes
-    for i in $changesfile; do
-        reprepro-env include unstable $i
-        reprepro-env copy stable unstable $(sed -ne 's/^Binary: //p' $i)
-    done
-    reprepro-env copy stable unstable $Source
-    
-    cd ..
-    rm -rf build-release/$package
-done
diff --git a/super/post-receive b/super/post-receive
deleted file mode 100755 (executable)
index 53bd274..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-file=`mktemp -t git-post-receive.XXXXXX` || exit $?
-cat >$file
-
-"$PWD"/hooks/zephyr-post-receive <$file
-
-rm -f $file
diff --git a/super/pre-receive b/super/pre-receive
deleted file mode 100755 (executable)
index bf0a2c0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-file=`mktemp -t git-pre-receive.XXXXXX` || exit $?
-cat >$file
-
-"$PWD"/hooks/build-pre-receive <$file
-
-rm -f $file
diff --git a/super/update b/super/update
new file mode 100755 (executable)
index 0000000..1e926e8
--- /dev/null
@@ -0,0 +1,26 @@
+#!/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" -o -z "$oldrev" -o -z "$newrev" ]; then
+        echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+        exit 1
+fi
+
+# --- Disallow all pushes
+
+echo "*** Pushing to the superrepo is not allowed" >&2
+echo "***" >&2
+echo "*** If you would like to update the superrepo, use remctl" >&2
+exit 1
diff --git a/super/zephyr-post-receive b/super/zephyr-post-receive
deleted file mode 120000 (symlink)
index eb677d1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../zephyr-post-receive
\ No newline at end of file