summaryrefslogtreecommitdiff
path: root/tools/submod-mk
blob: eb61da186527d65518edf0792bc5990429ecdd40 (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
#!/bin/bash
#
# **** License ****
#
# Copyright (C) 2013 Vyatta, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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, see <http://www.gnu.org/licenses/>.
#
# **** End License ****

progname=${0##*/}
shopt -s nullglob
shopt -s extglob
cd packages

info=echo
trace=
noclean="-nc"
build="debuild -i -b -uc -us"

declare -a submodule
declare -a debs
for debian in !(installer|linux-kernel-di-i386-2.6)/debian ; do
    smod=${debian%/*}
    debs=( ${smod}_*.deb )
    if [ ${#debs[@]} -eq 0 ] ; then
	submodule+=( $smod )
    fi
done

while [ $# -gt 0 ] ; do
    case "$1" in
	-h | --help )
	    cat <<-EOF
Usage: $progname [Options] [ SUBMODULE... ]
Options:
  -n | --do-nothing	Don´t actually remove or build anything,
  			just show what would be done
  -q | --quiet		Quiet, don't print progress info
  -c | --clean		Clean build
  -b | --binary		Skip source package build (default)
  -s | --source		Build binary and source packages
  -S | --signed-source	Build and sign packages

If no SUBMODULE(s) given, build all checked-out submodules w/o debs.
EOF
	    exit 0;;
	-n | --do-nothing )
	    trace=echo
	    shift;;	    
	-q | --quiet )
	    info='#'
	    shift;;
	-c | --clean )
	    noclean=
	    shift;;
	-b | --binary )
	    shift ;;		# default
	-s | --source )
	    build="git buildpackage -uc -us"
	    shift;;
	-S | --signed-source )
	    build="git buildpackage"
	    shift;;
	* )
	    submodule=( $@ )
	    break;;
    esac
done

for (( i=0; i<${#submodule[@]}; i++)) ; do
    eval $info P: ${submodule[i]}
    ( cd ${submodule[i]} && eval $trace $build $noclean ) || exit $?
done