~ubuntu-branches/ubuntu/utopic/dh-make-php/utopic

« back to all changes in this revision

Viewing changes to dh-make-pear

  • Committer: Bazaar Package Importer
  • Author(s): Uwe Steinmann
  • Date: 2005-11-25 11:04:57 UTC
  • Revision ID: james.westby@ubuntu.com-20051125110457-hp4c6t4r7s42nd65
Tags: upstream-0.0.12
Import upstream version 0.0.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
PROGNAME=dh-make-pear
 
3
PROGVERSION=0.0.12
 
4
PREFIX=/usr
 
5
 
 
6
DEBPACKAGEPREFIX=php
 
7
DEBTEMPDIR=${PREFIX}/share/dh-make-php/pear.template
 
8
PACKAGEDOCFILES="README readme CREDITS TODO AUTHORS"
 
9
# if you change the examples directory make sure to adjust the
 
10
# regular expression to set the PACKAGEDOCFILES
 
11
PACKAGEEXPFILES="examples"
 
12
 
 
13
DEBMAINTAINER=
 
14
DEPENDS=
 
15
DEPARCH=all
 
16
 
 
17
. ${PREFIX}/share/dh-make-php/dh-make-php.lib
 
18
 
 
19
# usage() {{{
 
20
# print summary of options
 
21
usage()
 
22
{
 
23
        cat <<eof
 
24
This is ${PROGNAME} Version ${PROGVERSION}
 
25
Copyright (c) 2004-2005 Uwe Steinmann <steinm@debian.org>
 
26
 
 
27
Usage: ${PROGNAME} [options] pear-package
 
28
 
 
29
pear-package is a tgz file as it is downloaded by 'pear download'.
 
30
Options:
 
31
  --help | -h     show this usage information
 
32
  --version | -v  show version of program
 
33
  --maintainer    maintainer of the debian package
 
34
  --arch          set architecture (defaults to 'all')
 
35
  --depends       set more depends aside php
 
36
  --prefix        set prefix for package name (default is '${DEBPACKAGEPREFIX}')
 
37
  --templatedir   set alternative directory for templates
 
38
                  (default is ${DEBTEMPDIR})
 
39
 
 
40
eof
 
41
}
 
42
# }}}
 
43
 
 
44
# command line options {{{
 
45
if [ $# = 0 ]; then
 
46
        usage
 
47
        exit 0
 
48
fi
 
49
 
 
50
while
 
51
        case $1 in
 
52
                --help|-h) # print usage
 
53
                        usage
 
54
                        exit 0
 
55
                        ;;
 
56
                --version|-v) # show version
 
57
      echo ${PROGVERSION}
 
58
                        exit 0
 
59
                        ;;
 
60
                --maintainer) # set maintainer of debian package
 
61
                        DEBMAINTAINER="$2"; shift
 
62
                        ;;
 
63
                --arch) # set architecture of debian package
 
64
                        DEBARCH="$2"; shift
 
65
                        ;;
 
66
                --depends) # set extra depends for debian package
 
67
                        DEPENDS=", $2"; shift
 
68
                        ;;
 
69
                --prefix) # set prefix for name of debian package
 
70
                        DEBPACKAGEPREFIX=", $2"; shift
 
71
                        ;;
 
72
                --templatedir) # set alternative template dir
 
73
                        DEBTEMPDIR=", $2"; shift
 
74
                        ;;
 
75
                "")
 
76
                        break
 
77
                        ;;
 
78
                *)
 
79
                        PEARPACKAGENAME="$1"
 
80
                        break
 
81
                        ;;
 
82
        esac
 
83
do test $# -gt 0 && shift; done
 
84
# }}}
 
85
 
 
86
if [ -n "${PEARPACKAGENAME}" ]; then
 
87
        if [ -f ${PEARPACKAGENAME} ]; then
 
88
                tar xzf ${PEARPACKAGENAME}
 
89
        else
 
90
                if TEMPMSG=$(pear download ${PEARPACKAGENAME} 2> /dev/null); then
 
91
                        echo ${TEMPMSG}
 
92
                        PEARPACKAGENAME=$(echo ${TEMPMSG} | awk -F ' ' '{print $2'})
 
93
                        tar xzf ${PEARPACKAGENAME}
 
94
                else
 
95
                        echo "Downloading pear package '${PEARPACKAGENAME}' failed!";
 
96
                        echo "Check http://pear.php.net/ for available packages.";
 
97
                        exit 0
 
98
                fi
 
99
        fi
 
100
else
 
101
        usage
 
102
        exit 0
 
103
fi
 
104
 
 
105
# get information about package from package.xml
 
106
eval_package
 
107
 
 
108
echo "Creating debian source package: ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}"
 
109
echo "Upstream is: ${UPSTREAM}"
 
110
 
 
111
get_maintainer
 
112
 
 
113
if [ -d ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION} ] ; then
 
114
        echo "Directory '${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}' already exits."
 
115
        exit
 
116
fi
 
117
ln -s ${PEARPACKAGENAME} ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz
 
118
mkdir ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
 
119
mv ${PHP_PKG_NAME}-${VERSION} ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
 
120
mv package.xml ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
 
121
#tar czf ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}_${VERSION}.orig.tar.gz ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}
 
122
mkdir -p ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian
 
123
 
 
124
cp ${DEBTEMPDIR}/compat ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian
 
125
cp ${DEBTEMPDIR}/dirs ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian
 
126
 
 
127
install_docfiles
 
128
install_expfiles
 
129
 
 
130
PACKAGEXML=${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/package.xml
 
131
 
 
132
sed -e "s/##date##/`(LC_ALL=C; date -R)`/g" \
 
133
    -e "s/##maintainer##/${DEBMAINTAINER}/g" \
 
134
    -e "s/##upstream##/${UPSTREAM}/g" \
 
135
    -e "s/##license##/${LICENSE}/g" \
 
136
    -e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
 
137
                ${DEBTEMPDIR}/copyright > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/copyright
 
138
if [ -n "${LICENSEFILE}" ]; then
 
139
        cat "${LICENSEFILE}" >> ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/copyright
 
140
fi
 
141
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
 
142
    -e "s/##maintainer##/${DEBMAINTAINER}/g" \
 
143
    -e "s�##summary##�${SUMMARY}�g" \
 
144
    -e "s/##depends##/${DEPENDS}/g" \
 
145
    -e "s/##architecture##/${DEPARCH}/g" \
 
146
                ${DEBTEMPDIR}/control > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/control
 
147
                xsltproc --nonet --novalid  --param Element "/*/description" ${PREFIX}/share/dh-make-php/xslt/common.xsl ${PACKAGEXML} | fold -s -w 70|sed -e "s�^[ \t]*$�.�g" -e "s�^� �g" >> ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/control
 
148
#               sgrep -e '"<description>"__"</description>"' ${PACKAGEXML} | fold -s -w 70|sed -e "s�^[ \t]*$�.�g" -e "s�^� �g" >> ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/control
 
149
                # changelog.xsl is copied into the source package in order to prevent
 
150
                # a dependency on dh-make-php
 
151
                cp ${PREFIX}/share/dh-make-php/xslt/changelog.xsl ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/
 
152
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
 
153
    -e "s/##version##/${VERSION}/g" \
 
154
    -e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
 
155
                ${DEBTEMPDIR}/rules > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/rules
 
156
chmod 755 ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/rules
 
157
 
 
158
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
 
159
    -e "s/##date##/`(LC_ALL=C; date -R)`/g" \
 
160
    -e "s/##maintainer##/${DEBMAINTAINER}/g" \
 
161
    -e "s/##version##/${VERSION}/g" \
 
162
                ${DEBTEMPDIR}/changelog > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/changelog
 
163
 
 
164
sed -e "s/##packagename##/${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}/g" \
 
165
    -e "s/##date##/`(LC_ALL=C; date -R)`/g" \
 
166
    -e "s/##maintainer##/${DEBMAINTAINER}/g" \
 
167
                ${DEBTEMPDIR}/README.Debian > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/README.Debian
 
168
 
 
169
sed -e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
 
170
                ${DEBTEMPDIR}/prerm > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/prerm
 
171
 
 
172
sed -e "s/##pearpkgname##/${PHP_PKG_NAME}/g" \
 
173
                ${DEBTEMPDIR}/watch > ${DEBPACKAGEPREFIX}-${PHP_PKG_LOWNAME}-${VERSION}/debian/watch
 
174