summaryrefslogtreecommitdiff
path: root/bin/build-all-deb-packages
blob: 57e7edc0a8229a20a7d25bf6c3151dbccfe5d141 (plain)
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
#!/bin/bash

# Copyright (C) 2011-2015 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#
# This 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 3 of the License, or
# (at your option) any later version.
#
# This 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.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

COMPONENT_MAIN="main"
COMPONENT_LTS="lts"
COMPONENT_NIGHTLY="nightly"

LIB_PACKAGES_NIGHTLY=
LIB_PACKAGES_MAIN=
APP_PACKAGES_NIGHTLY=
APP_PACKAGES_MAIN=

PREFIX=$(echo `basename $0` | cut -d"-" -f1)
test -f ~/.buildscripts/$PREFIX.conf && . ~/.buildscripts/$PREFIX.conf || { echo "$0 has no valid context prefix..."; exit 1; }

set -ex

COMPONENT=${1:-""}
CODENAME=${2:-""}

# build the newest code... (nightly-builds)
[ "x$COMPONENT" = "x$COMPONENT_NIGHTLY" ] || [ -z $COMPONENT ] && {
    echo -e $LIB_PACKAGES_NIGHTLY $APP_PACKAGES_NIGHTLY | while read pkg comp checkout; do
	if [ -n $CODENAME ]; then 
		comp="$comp/$CODENAME"
	fi
	if [ "x$(basename $0)" = "x$PREFIX-build-all-packages" ]; then
		$PREFIX-build-package $pkg $comp $checkout
	elif [ "x$(basename $0)" = "x$PREFIX-upload-all-packages" ]; then
		$PREFIX-upload-package $pkg $comp $checkout
	elif [ "x$(basename $0)" = "x$PREFIX-build+upload-all-packages" ]; then
		$PREFIX-build-package $pkg $comp $checkout && $PREFIX-upload-package $pkg $comp $checkout
	fi
    done
}

# build all packages tagged as build-main
[ "x$COMPONENT" = "x$COMPONENT_MAIN" ] || [ -z $COMPONENT ] && {
    echo -e $LIB_PACKAGES_MAIN $APP_PACKAGES_MAIN | while read pkg comp checkout; do
	if [ -n $CODENAME ]; then
		comp="$comp/$CODENAME"
	fi
	if [ "x$(basename $0)" = "x$PREFIX-build-all-packages" ]; then
		$PREFIX-build-package $pkg $comp $checkout
	elif [ "x$(basename $0)" = "x$PREFIX-upload-all-packages" ]; then
		$PREFIX-upload-package $pkg $comp $checkout
	elif [ "x$(basename $0)" = "x$PREFIX-build+upload-all-packages" ]; then
		$PREFIX-build-package $pkg $comp $checkout && $PREFIX-upload-package $pkg $comp $checkout
	fi
    done
}

# build all packages marked as lts
[ "x$COMPONENT" = "x$COMPONENT_LTS" ] || [ -z $COMPONENT ] && {
    echo -e $LIB_PACKAGES_LTS $APP_PACKAGES_LTS | while read pkg comp checkout; do
	if [ -n $CODENAME ]; then
		comp="$comp/$CODENAME"
	fi
	if [ "x$(basename $0)" = "x$PREFIX-build-all-packages" ]; then
		$PREFIX-build-package $pkg $comp $checkout
	elif [ "x$(basename $0)" = "x$PREFIX-upload-all-packages" ]; then
		$PREFIX-upload-package $pkg $comp $checkout
	elif [ "x$(basename $0)" = "x$PREFIX-build+upload-all-packages" ]; then
		$PREFIX-build-package $pkg $comp $checkout && $PREFIX-upload-package $pkg $comp $checkout
	fi
    done
}

echo "Component: $COMPONENT"
echo "Main: $COMPONENT_MAIN"
echo "LTS: $COMPONENT_LTS"
echo "Nightly: $COMPONENT_NIGHTLY"