-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebs
executable file
·105 lines (96 loc) · 2.43 KB
/
debs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#! /bin/bash
#
# This file is part of autoztool
# Copyright (C) 2010 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
set -e
pkg=autoztool # package name
version=$(make echo-version) # get version number
debversion=$(perl -lne '/\((.*)\)/ && print $1;exit' debian/changelog) # deb version number
source=${pkg}-${version} # source directory
archive=${pkg}-${version}.tar.gz # tarball
# s COMMAND...
#
# Echo a command then execute it.
s() {
echo "$@" >&2
"$@"
}
# r HOST COMMAND...
#
# Echo a command then execute it remotely.
r() {
local host=$1
shift
echo "$host:" "$@" >&2
case $host in
chroot:* )
schroot -pc${host#*:} -- bash -c "$@"
;;
* )
ssh $host "$@"
;;
esac
}
# build HOST ARCH
#
# Create a .deb on HOST for architecture ARCH, then copy it back here
# and add it to the list of build products.
build() {
local host=$1
local arch=$2
local deb="${pkg}_${debversion}_${arch}.deb"
echo
echo "Build on $host for $arch"
echo
r $host "cd && mkdir -p _builds"
r $host "cd \$HOME/_builds && rm -rf ${source} ${archive} ${deb}"
case $host in
chroot:* )
s cp ${archive} $HOME/_builds
;;
* )
s scp ${archive} $host:_builds/.
;;
esac
r $host "cd \$HOME/_builds && tar xfz ${archive}"
r $host "cd \$HOME/_builds/${source} && debian/rules build"
r $host "cd \$HOME/_builds/${source} && fakeroot debian/rules binary"
case $host in
chroot:* )
s cp $HOME/_builds/$deb products/.
;;
* )
s scp $host:_builds/$deb products/.
;;
esac
echo
echo "Built $deb"
echo
}
# Build the source archive
s make distcheck
rm -rf products
mkdir products
cp ${archive} products/.
# Build .deb files
s build araminta amd64
# List built products
echo
echo Final build products:
echo
ls -l products