~jconti/recent-notifications/trunk

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
#!/bin/bash

VERSION=`python -c "from recent_notifications.Globals import VERSION; print VERSION"`
NAME="recent-notifications-${VERSION}"
SDIST="${NAME}.tar.gz"
ORIG="recent-notifications_${VERSION}.orig.tar.gz"

# Get command line arguments
BUILD_BINARY=0
CLEAN=0
PRINT_HELP=0

usage () {
  echo "usage: build-package.sh [options]"
  echo ""
  echo "Options:"
  echo "-b, --binary  only build an unsigned binary package"
  echo "-c, --clean   delete everything in the dist directory"
  echo "-h, --help    print this help message and exit"
  echo ""
}

for ARG in $*
do
  case "${ARG}" in
    "-b" | "--binary") BUILD_BINARY=1;;
    "-c" | "--clean" ) CLEAN=1;;
    "-h" | "--help"  ) PRINT_HELP=1;;
  esac
done

# Print the usage and exit
if [ "${PRINT_HELP}" -eq "1" ]
then
  usage
  exit
fi

# Clean the dist directory
if [ "${CLEAN}" -eq "1" ]
then
  echo "Cleaning the dist directory"
  rm -rf dist/*
fi

mkdir -p "dist/deb"

echo "Building source distribution for ${SDIST}"
python setup.py sdist
rm "MANIFEST"
cd "dist"
tar xzf "${SDIST}"
rm -rf "${NAME}/debian"
tar czf "deb/${ORIG}" "${NAME}"
cd "deb"

echo "Unpacking source distribution in deb directory"
tar xzf "../${SDIST}"
cd "${NAME}"

export DEBUILD_LINTIAN=yes
export DEBUILD_LINTIAN_OPTS="-i -I --show-overrides"

echo "Building deb package"
if [ "${BUILD_BINARY}" -eq "1" ]
then
  dpkg-buildpackage -us -uc
else
  # Build the lucid source package
  #dpkg-buildpackage -S
  debuild -S
  # Update the changelog for lucid
  sed -i -e 's/lucid/maverick/g' debian/changelog
  # Build the maverick source package
  #dpkg-buildpackage -S
  debuild -S
fi