chiark / gitweb /
Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/disorder
[disorder] / scripts / dist
CommitLineData
460b9539 1#! /bin/bash
2#
3# This file is part of DisOrder
7bfa7f4c 4# Copyright (C) 2005-2009, 2011 Richard Kettlewell
460b9539 5#
e7eb3a27 6# This program is free software: you can redistribute it and/or modify
460b9539 7# it under the terms of the GNU General Public License as published by
e7eb3a27 8# the Free Software Foundation, either version 3 of the License, or
460b9539 9# (at your option) any later version.
e7eb3a27
RK
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#
460b9539 16# You should have received a copy of the GNU General Public License
e7eb3a27 17# along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 18#
19
20set -e
96b55624 21web=$HOME/public_html/web/disorder
7bfa7f4c 22chroots=/srv/chroot
96b55624 23
460b9539 24make
7bfa7f4c 25#make distcheck
460b9539 26make dist-bzip2
fef972ab 27v=$(make echo-version)
460b9539 28d=$(make echo-distdir)
96b55624
RK
29src=$d.tar.bz2
30
7bfa7f4c
RK
31v() {
32 echo ">" "$@"
33 "$@"
34}
35
36# Execute a command in the build environment
96b55624
RK
37remote() {
38 local h=$1
7bfa7f4c
RK
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
2709e270 50 v bash -c "cd && $cmd"
7bfa7f4c
RK
51 cd -
52 ;;
53 esac
96b55624
RK
54}
55
7bfa7f4c
RK
56# Put files into the build environment
57put() {
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:* )
2709e270 70 v cp $src $HOME/$dst
7bfa7f4c
RK
71 ;;
72 esac
73}
74
75# Retrieve files form the build environment
76get() {
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:* )
2709e270 89 v cp $HOME/$src $dst
7bfa7f4c
RK
90 ;;
91 esac
92}
93
94# Build a .deb in some build environment, and copy it to the distribution
95# location
96b55624
RK
96build() {
97 local h=$1 # build host
7bfa7f4c
RK
98 local f=$2 # distribution directory ("for")
99 local vs=$3 # version suffix
100 local dist=$4 # distribution (stable/oldstable)
96b55624
RK
101
102 remote $h "mkdir -p _builds"
103 remote $h "rm -rf _builds/*.deb _builds/$d"
7bfa7f4c 104 put $src $h _builds/$src
96b55624 105 remote $h "cd _builds && tar xfj $src"
fef972ab
RK
106 if [ "$vs" != "" ]; then
107 remote $h "cd _builds/$d && scripts/setversion $v~$vs 'Backport to $vs' $dist"
108 fi
96b55624
RK
109 remote $h "cd _builds/$d && fakeroot debian/rules binary"
110 mkdir -p $web/$f
7bfa7f4c 111 get $h _builds/\*.deb $web/$f/.
96b55624
RK
112}
113
114# Build various debs
2709e270
RK
115build local:araminta wheezy "" sid
116build chroot:wheezy32 wheezy "" sid
96b55624
RK
117
118# Update the web
6016a2da 119cp $src README README.developers CHANGES.html $web
460b9539 120cd doc
121for f in *.[1-9].html; do
122 echo $f
96b55624
RK
123 rm -f $web/$f
124 sed < $f > $web/$f 's/^@.*//'
460b9539 125done
96b55624
RK
126cp plumbing.svg $web/.
127if [ -f plumbing.png ]; then
128 cp plumbing.png $web/.
129fi
130