| 1 | #! /bin/bash |
| 2 | # |
| 3 | # This file is part of DisOrder |
| 4 | # Copyright (C) 2005-2009, 2011 Richard Kettlewell |
| 5 | # |
| 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation, either version 3 of the License, or |
| 9 | # (at your option) any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | # |
| 19 | |
| 20 | set -e |
| 21 | web=$HOME/public_html/web/disorder |
| 22 | chroots=/srv/chroot |
| 23 | |
| 24 | make |
| 25 | #make distcheck |
| 26 | make dist-bzip2 |
| 27 | v=$(make echo-version) |
| 28 | d=$(make echo-distdir) |
| 29 | src=$d.tar.bz2 |
| 30 | |
| 31 | v() { |
| 32 | echo ">" "$@" |
| 33 | "$@" |
| 34 | } |
| 35 | |
| 36 | # Execute a command in the build environment |
| 37 | remote() { |
| 38 | local h=$1 |
| 39 | local cmd="$2" |
| 40 | target=${h#*:} |
| 41 | case $h in |
| 42 | ssh:* ) |
| 43 | v ssh ${target} "$cmd" |
| 44 | ;; |
| 45 | chroot:* ) |
| 46 | v schroot -c${target} -- bash -c "cd && $cmd" |
| 47 | ;; |
| 48 | local:* ) |
| 49 | cd |
| 50 | v bash -c "cd && $cmd" |
| 51 | cd - |
| 52 | ;; |
| 53 | esac |
| 54 | } |
| 55 | |
| 56 | # Put files into the build environment |
| 57 | put() { |
| 58 | local src="$1" |
| 59 | local h=$2 |
| 60 | local dst="$3" |
| 61 | target=${h#*:} |
| 62 | case $h in |
| 63 | ssh:* ) |
| 64 | v scp $src ${target}:$dst |
| 65 | ;; |
| 66 | chroot:* ) |
| 67 | v cp $src ${chroots}/${target}/home/${LOGNAME}/$dst |
| 68 | ;; |
| 69 | local:* ) |
| 70 | v cp $src $HOME/$dst |
| 71 | ;; |
| 72 | esac |
| 73 | } |
| 74 | |
| 75 | # Retrieve files form the build environment |
| 76 | get() { |
| 77 | local h=$1 |
| 78 | local src="$2" |
| 79 | local dst="$3" |
| 80 | target=${h#*:} |
| 81 | case $h in |
| 82 | ssh:* ) |
| 83 | v scp ${target}:$src $dst |
| 84 | ;; |
| 85 | chroot:* ) |
| 86 | v cp ${chroots}/${target}/home/${LOGNAME}/$src $dst |
| 87 | ;; |
| 88 | local:* ) |
| 89 | v cp $HOME/$src $dst |
| 90 | ;; |
| 91 | esac |
| 92 | } |
| 93 | |
| 94 | # Build a .deb in some build environment, and copy it to the distribution |
| 95 | # location |
| 96 | build() { |
| 97 | local h=$1 # build host |
| 98 | local f=$2 # distribution directory ("for") |
| 99 | local vs=$3 # version suffix |
| 100 | local dist=$4 # distribution (stable/oldstable) |
| 101 | |
| 102 | remote $h "mkdir -p _builds" |
| 103 | remote $h "rm -rf _builds/*.deb _builds/$d" |
| 104 | put $src $h _builds/$src |
| 105 | remote $h "cd _builds && tar xfj $src" |
| 106 | if [ "$vs" != "" ]; then |
| 107 | remote $h "cd _builds/$d && scripts/setversion $v~$vs 'Backport to $vs' $dist" |
| 108 | fi |
| 109 | remote $h "cd _builds/$d && fakeroot debian/rules binary" |
| 110 | mkdir -p $web/$f |
| 111 | get $h _builds/\*.deb $web/$f/. |
| 112 | } |
| 113 | |
| 114 | # Build various debs |
| 115 | build local:araminta wheezy "" sid |
| 116 | build chroot:wheezy32 wheezy "" sid |
| 117 | |
| 118 | # Update the web |
| 119 | cp $src README README.developers CHANGES.html $web |
| 120 | cd doc |
| 121 | for f in *.[1-9].html; do |
| 122 | echo $f |
| 123 | rm -f $web/$f |
| 124 | sed < $f > $web/$f 's/^@.*//' |
| 125 | done |
| 126 | cp plumbing.svg $web/. |
| 127 | if [ -f plumbing.png ]; then |
| 128 | cp plumbing.png $web/. |
| 129 | fi |
| 130 | |