~percona-dev/percona-server/release-5.5.11-20.2-fix-bug-764138

« back to all changes in this revision

Viewing changes to build/build-dpkg.sh

  • Committer: Ignacio Nin
  • Date: 2011-03-19 08:50:37 UTC
  • mfrom: (91.1.1 release-5.5.9-20.1)
  • Revision ID: ignacio.nin@percona.com-20110319085037-llxjusfhpgjxvt3u
debian packaging update and testing

Tested and updated the debian packaging. Changes include:
- Import patches to dpatch system
- Polish control file
- Polish rules file
- Polish post-install scripts
- Move installation from /opt/percona to /usr
- Add builscript for debian
- Downgrade format to 1.0 in order to conform to requirements

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Usage: build-dpkg.sh [target dir]
 
3
# The default target directory is the current directory. If it is not
 
4
# supplied and the current directory is not empty, it will issue an error in
 
5
# order to avoid polluting the current directory after a test run.
 
6
#
 
7
# The program will setup the dpkg building environment and ultimately call
 
8
# dpkg-buildpackage with the appropiate parameters.
 
9
#
 
10
 
 
11
# Bail out on errors, be strict
 
12
set -ue
 
13
 
 
14
# Examine parameters
 
15
go_out="$(getopt --options "k:" --longoptions key: \
 
16
    --name "$(basename "$0")" -- "$@")"
 
17
test $? -eq 0 || exit 1
 
18
eval set -- $go_out
 
19
 
 
20
BUILDPKG_KEY=''
 
21
 
 
22
for arg
 
23
do
 
24
    case "$arg" in
 
25
    -- ) shift; break;;
 
26
    -k | --key ) shift; BUILDPKG_KEY="-pgpg -k$1"; shift;;
 
27
    esac
 
28
done
 
29
 
 
30
# Working directory
 
31
if test "$#" -eq 0
 
32
then
 
33
    WORKDIR="$(pwd)"
 
34
 
 
35
    # Check that the current directory is not empty
 
36
    if test "x$(echo *)" != "x*"
 
37
    then
 
38
        echo >&2 \
 
39
            "Current directory is not empty. Use $0 . to force build in ."
 
40
        exit 1
 
41
    fi
 
42
 
 
43
elif test "$#" -eq 1
 
44
then
 
45
    WORKDIR="$1"
 
46
 
 
47
    # Check that the provided directory exists and is a directory
 
48
    if ! test -d "$WORKDIR"
 
49
    then
 
50
        echo >&2 "$WORKDIR is not a directory"
 
51
        exit 1
 
52
    fi
 
53
 
 
54
else
 
55
    echo >&2 "Usage: $0 [target dir]"
 
56
    exit 1
 
57
 
 
58
fi
 
59
 
 
60
SOURCEDIR="$(cd $(dirname "$0"); cd ..; pwd)"
 
61
test -e "$SOURCEDIR/Makefile" || exit 2
 
62
 
 
63
# Extract version from the Makefile
 
64
MYSQL_VERSION="$(grep ^MYSQL_VERSION= "$SOURCEDIR/Makefile" \
 
65
    | cut -d = -f 2)"
 
66
PERCONA_SERVER_VERSION="$(grep ^PERCONA_SERVER_VERSION= "$SOURCEDIR/Makefile" | cut -d = -f 2)"
 
67
PRODUCT="Percona-Server-$MYSQL_VERSION-$PERCONA_SERVER_VERSION"
 
68
DEBIAN_VERSION="$(lsb_release -sc)"
 
69
 
 
70
 
 
71
# Build information
 
72
export BB_PERCONA_REVISION="$(cd "$SOURCEDIR"; bzr log -r-1 | grep ^revno: | cut -d ' ' -f 2)"
 
73
export DEB_BUILD_OPTIONS='nostrip debug nocheck'
 
74
 
 
75
# Prepare sources
 
76
(
 
77
    cd "$SOURCEDIR"
 
78
    make clean all
 
79
)
 
80
 
 
81
# Build
 
82
(
 
83
    # Make a copy in workdir and copy debian files
 
84
    cd "$WORKDIR"
 
85
 
 
86
    rm -rf "$PRODUCT/"
 
87
    cp -a "$SOURCEDIR/$PRODUCT/" .
 
88
    (
 
89
        cd "$PRODUCT/"
 
90
 
 
91
        # Copy debian files from source
 
92
        cp -R "$SOURCEDIR/build/debian" .
 
93
        chmod +x debian/rules
 
94
 
 
95
        # Update distribution name
 
96
        dch -m -v "$MYSQL_VERSION-$PERCONA_SERVER_VERSION-$BB_PERCONA_REVISION.$DEBIAN_VERSION" 'Update distribution'
 
97
 
 
98
        dpkg-buildpackage -rfakeroot $BUILDPKG_KEY
 
99
 
 
100
    )
 
101
 
 
102
    rm -rf "$PRODUCT"
 
103
 
 
104
)