source: trunk/debathena/scripts/sbuildhack @ 25476

Revision 25476, 1.6 KB checked in by jdreed, 12 years ago (diff)
Use control fields instead of nobuild files (Trac #913)
  • 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
32NOBUILD=$(grep-dctrl -n -s Debathena-No-Build -F Debathena-No-Build -e . "$dscfile")
33BUILDFOR=$(grep-dctrl -n -s Debathena-Build-For -F Debathena-Build-For -e . "$dscfile")
34
35if [ -n "$NOBUILD" ] && [ -n "$BUILDFOR" ]; then
36    echo "It is an error to specify both Debathena-Build-For and Debathena-No-Build fields."
37    echo "Pick one and try again."
38    exit 1
39fi
40
41if [ -z "$NOBUILD" ] && [ -z "$BUILDFOR" ] && [ -e nobuild ]; then
42    NOBUILD="$(cat nobuild)"
43    echo "NOTE: Please migrate ./nobuild to XSC-Debathena-No-Build!"
44fi
45
46if [ -n "$NOBUILD" ] && echo "$NOBUILD" | fgrep -q "$dist"; then
47  echo "Skipping $dist since it is listed in the Debathena-No-Build field"
48  exit
49fi
50
51if [ -n "$BUILDFOR" ] && ! echo "$BUILDFOR" | fgrep -q "$dist"; then
52  echo "Skipping $dist since it is not listed in the Debathena-Build-For field"
53  exit
54fi
55
56sbuild --append-to-version=`gettag "$dist"` \
57        -d "$dist" --arch="$arch" \
58        --apt-update --apt-distupgrade \
59        --setup-hook="$(readlink -f "$(dirname "$0")/chroot-sources")" \
60        -v "$@"
Note: See TracBrowser for help on using the repository browser.