summaryrefslogtreecommitdiffstats
path: root/debian/buildsys-select.sh
blob: 291d669f653bd10ddd586300dd1ab32633874bf4 (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
#!/bin/sh
#
# This script will select the build target, which is one of:
#   2.3 	- Build for python2.3
#   2.4		- Build for python2.4
#   pycentral	- Build with python-central support

FILES="control.in bcfg2.init bcfg2-server.init pycompat compat"
SUITE=$1

if [ ! -d buildsys ]; then
  echo "you need to be in debian/ directory"
  exit 1
fi

copy_files() {
  for i in $FILES; do
    if [ -e buildsys/$SUITE/$i ]; then
      cp buildsys/$SUITE/$i $i
    else
      cp buildsys/common/$i $i
    fi
  done
}

toggle_DPS() {
  case $1 in
    enable)
      sed -i -e 's/^#DEB_PYTHON_SYSTEM/DEB_PYTHON_SYSTEM/' rules
      ;;
    disable)
      sed -i -e 's/^DEB_PYTHON_SYSTEM/#DEB_PYTHON_SYSTEM/' rules
      ;;
    *)
      echo "internal error!"
      exit 1
      ;;
  esac
}

generate_control() {
  cp control.in control
  if [ "$SUITE" = "pycentral" ]; then
    toggle_DPS enable
  else
    toggle_DPS disable
  fi
  cd .. && DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean
}

case $SUITE in
  2.3|2.4|pycentral)
    copy_files
    generate_control
    ;;
  clean)
    rm $FILES control
    toggle_DPS enable
    echo "removed build files, select a build system to enable build"
    ;;
  *)
    echo "Usage: $0 2.3|2.4|pycentral|clean"
    ;;
esac