source: trunk/debathena/scripts/sbuildhack @ 25479

Revision 25479, 1.6 KB checked in by jdreed, 12 years ago (diff)
Fix quoting issues sbuildhack errors out if no .dsc file specified
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Wrapper around sbuild.  The main purpose is to append a
4# distribution-dependent string like "~ubuntu7.10" to the binary
5# package version
6
7# This script us normally run as "da sbuildhack filename.dsc".
8
9# This script will skip dists listed in ./nobuild.
10
11usage() {
12    echo "Usage: $0 <dist>-<arch> ..." >&2
13    exit 1
14}
15
16. $(dirname "$0")/debian-versions.sh
17
18dist_arch=$1; shift
19if [ -z "$dist_arch" ]; then usage; fi
20IFS=- read dist arch <<EOF
21$dist_arch
22EOF
23if [ -z "$dist" ] || [ -z "$arch" ]; then usage; fi
24
25dscfile=
26for i in "$@"; do
27  if echo "$i" | grep -q '\.dsc$'; then
28    dscfile=$i
29  fi
30done
31
32[ -n "$dscfile" ] || usage
33
34NOBUILD=$(grep-dctrl -n -s Debathena-No-Build -F Debathena-No-Build -e . "$dscfile")
35BUILDFOR=$(grep-dctrl -n -s Debathena-Build-For -F Debathena-Build-For -e . "$dscfile")
36
37if [ -n "$NOBUILD" ] && [ -n "$BUILDFOR" ]; then
38    echo "It is an error to specify both Debathena-Build-For and Debathena-No-Build fields."
39    echo "Pick one and try again."
40    exit 1
41fi
42
43if [ -z "$NOBUILD" ] && [ -z "$BUILDFOR" ] && [ -e nobuild ]; then
44    NOBUILD="$(cat nobuild)"
45    echo "NOTE: Please migrate ./nobuild to XSC-Debathena-No-Build!"
46fi
47
48if [ -n "$NOBUILD" ] && echo "$NOBUILD" | fgrep -q "$dist"; then
49  echo "Skipping $dist since it is listed in the Debathena-No-Build field"
50  exit
51fi
52
53if [ -n "$BUILDFOR" ] && ! echo "$BUILDFOR" | fgrep -q "$dist"; then
54  echo "Skipping $dist since it is not listed in the Debathena-Build-For field"
55  exit
56fi
57
58sbuild --append-to-version=`gettag "$dist"` \
59        -d "$dist" --arch="$arch" \
60        --apt-update --apt-distupgrade \
61        --setup-hook="$(readlink -f "$(dirname "$0")/chroot-sources")" \
62        -v "$@"
Note: See TracBrowser for help on using the repository browser.