chiark / gitweb /
scripts/dist now supports chroots.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 12 Feb 2011 14:59:32 +0000 (14:59 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 12 Feb 2011 14:59:32 +0000 (14:59 +0000)
scripts/dist

index f428eef1977f7851aea03e81c97baf8a0dac0b1d..7616bb3246eb115b1c03318ed7495ed7854d11cb 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/bash
 #
 # This file is part of DisOrder
 #! /bin/bash
 #
 # This file is part of DisOrder
-# Copyright (C) 2005-2009 Richard Kettlewell
+# Copyright (C) 2005-2009, 2011 Richard Kettlewell
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 set -e
 web=$HOME/public_html/web/disorder
 
 set -e
 web=$HOME/public_html/web/disorder
+chroots=/srv/chroot
 
 make
 
 make
-make distcheck
+#make distcheck
 make dist-bzip2
 v=$(make echo-version)
 d=$(make echo-distdir)
 src=$d.tar.bz2
 
 make dist-bzip2
 v=$(make echo-version)
 d=$(make echo-distdir)
 src=$d.tar.bz2
 
-# Report and execute a command remotely
+v() {
+  echo ">" "$@"
+  "$@"
+}
+
+# Execute a command in the build environment
 remote() {
   local h=$1
 remote() {
   local h=$1
-  shift
-  echo "$h:" "$@"
-  ssh $h "$@"
+  local cmd="$2"
+  target=${h#*:}
+  case $h in
+  ssh:* )
+    v ssh ${target} "$cmd"
+    ;;
+  chroot:* )
+    v schroot -c${target} -- bash -c "cd && $cmd"
+    ;;
+  local:* )
+    cd
+    v "$cmd"
+    cd -
+    ;;
+  esac
 }
 
 }
 
-# Build .debs and copy to the right place
+# Put files into the build environment
+put() {
+  local src="$1"
+  local h=$2
+  local dst="$3"
+  target=${h#*:}
+  case $h in
+  ssh:* )
+    v scp $src ${target}:$dst
+    ;;
+  chroot:* )
+    v cp $src ${chroots}/${target}/home/${LOGNAME}/$dst
+    ;;
+  local:* )
+    v cp $src $dst
+    ;;
+  esac
+}
+
+# Retrieve files form the build environment
+get() {
+  local h=$1
+  local src="$2"
+  local dst="$3"
+  target=${h#*:}
+  case $h in
+  ssh:* )
+    v scp ${target}:$src $dst
+    ;;
+  chroot:* )
+    v cp ${chroots}/${target}/home/${LOGNAME}/$src $dst
+    ;;
+  local:* )
+    v cp $src $dst
+    ;;
+  esac
+}
+
+# Build a .deb in some build environment, and copy it to the distribution
+# location
 build() {
   local h=$1                   # build host
 build() {
   local h=$1                   # build host
-  local f=$2
-  local vs=$3
-  local dist=$4
+  local f=$2                    # distribution directory ("for")
+  local vs=$3                   # version suffix
+  local dist=$4                 # distribution (stable/oldstable)
 
   remote $h "mkdir -p _builds"
   remote $h "rm -rf _builds/*.deb _builds/$d"
 
   remote $h "mkdir -p _builds"
   remote $h "rm -rf _builds/*.deb _builds/$d"
-  scp $src $h:_builds
+  put $src $h _builds/$src
   remote $h "cd _builds && tar xfj $src"
   if [ "$vs" != "" ]; then
     remote $h "cd _builds/$d && scripts/setversion $v~$vs 'Backport to $vs' $dist"
   fi
   remote $h "cd _builds/$d && fakeroot debian/rules binary"
   mkdir -p $web/$f
   remote $h "cd _builds && tar xfj $src"
   if [ "$vs" != "" ]; then
     remote $h "cd _builds/$d && scripts/setversion $v~$vs 'Backport to $vs' $dist"
   fi
   remote $h "cd _builds/$d && fakeroot debian/rules binary"
   mkdir -p $web/$f
-  scp $h:_builds/*.deb $web/$f/.
+  get $h _builds/\*.deb $web/$f/.
 }
 
 # Build various debs
 }
 
 # Build various debs
-
-# Debian lenny (32-bit)
-build leucomorph lenny "" stable
-
-# Debian lenny (64-bit)
-build araminta lenny "" stable
+build chroot:lenny64 lenny lenny oldstable
+build ssh:leucomorph lenny lenny oldstable
+build ssh:araminta squeeze "" stable
+build ssh:sandestin squeeze "" stable
 
 # Update the web
 cp $src $web
 
 # Update the web
 cp $src $web