All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
3 # - automate builds with sbuild and dinstall the result
5 # Copyright (c) 2008 martin f. krafft <madduck@debian.org>
6 # Released under the terms of the Artistic Licence 2.0.
12 BUILDDIR="$(mktemp -dt $ME.XXXXXXXX)"
13 trap "cd /tmp && rm -r '$BUILDDIR'" 0
15 BUNDLE_DIR="${TMPDIR:-/tmp}"
18 echo "Copying files destined for $1 back to $TARGET_DIR..."
19 dcmd cp -v "$2" "$TARGET_DIR"
24 print_bundle_location() {
25 echo "Bundle available at $@ ."
30 MBUILDRCS="/etc/mbuild/rc $HOME/.mbuildrc $HOME/.mbuild/rc"
31 for rc in $MBUILDRCS; do
32 [ -r "$rc" ] && . "$rc"
35 if [ -z "$KEYID" ]; then
36 echo "E: \$KEYID is not defined in rc file." >&2
40 DEB_BUILD_ARCH="$(dpkg-architecture -qDEB_BUILD_ARCH)"
44 echo "$ME -- wrapper for sbuild"
45 echo "Copyright © martin f. krafft <madduck@debian.org>"
46 echo "Released under the terms of the Artistic Licence 2.0"
53 echo "Usage: $ME [options] [sbuild_options] file_source.changes"
55 echo "Valid options are:"
56 cat <<-_eof | column -s\& -t
57 --dist & specify the target distribution (default: from changes file)
58 --arch & specify the target architecture (default: $DEB_BUILD_ARCH)
59 -sa & pass --force-orig-source to sbuild
60 -B & do a binary-only build
61 -h|--help & show this output.
62 -V|--version & show version information.
72 -h|--help) usage; exit 0;;
73 -V|--version) about; exit 0;;
74 --arch=*) arch="${opt#--arch=}";;
75 -sa) sbuild_args="${sbuild_args:+$sbuild_args }--force-orig-source";;
77 --*) sbuild_args="${sbuild_args:+$sbuild_args }$opt";;
79 if [ -z "$schangesfile" ]; then
80 if [ -f "$opt" ] && [ -r "$opt" ]; then
83 echo "E: file does not exist: $opt" >&2
87 echo "E: cannot pass more than one source changes file: $opt" >&2
92 echo "E: unknown option: $opt" >&2
98 if [ -z "$schangesfile" ]; then
103 [ -z "$arch" ] && arch="$DEB_BUILD_ARCH"
105 dist="$(sed -ne 's,Distribution: ,,p' "$schangesfile")"
107 schangesfile_basename="${schangesfile##*/}"
108 packagename="${schangesfile_basename%%_*}"
109 packagenameversion="${schangesfile_basename%_*}"
110 dscfile_basename="$packagenameversion".dsc
112 case "$schangesfile" in
113 */*) cd "${schangesfile%/*}";;
116 dcmd cp "${schangesfile##*/}" "$BUILDDIR"
117 schangesfile="$schangesfile_basename"
121 dcmd "$dscfile_basename" | while read f; do
122 test -f "$f" && continue
125 *.tar.gz) apt-get --tar-only --only-source source "$packagename";;
127 echo "E: I do not know how to obtain the file: $f" >&2
133 [ "$binonly" = 0 ] && sbuild_args="${sbuild_args:+$sbuild_args }--source --arch-all"
135 sbuild $sbuild_args --arch="$arch" --dist="$dist" --keyid=$KEYID \
138 changesfile="${packagenameversion}_${arch}.changes"
140 mergechanges "$schangesfile" "$changesfile" > temp-combined.changes
141 mv temp-combined.changes "$changesfile"
142 changestool "$changesfile" updatechecksums
144 #sign_changes_file "$changesfile"
146 dinstall "$dist" "$changesfile"
148 DATESTR="$(date +%Y.%m.%d.%H%M%S)"
149 BUILD_PREFIX="${packagenameversion}_${arch}.${DATESTR}"
151 mv current "${BUILD_PREFIX}".buildlog
154 bundle="${BUNDLE_DIR}/${BUILD_PREFIX}".bundle.tar
161 print_bundle_location "$bundle"