the PEAR package name should :
PEAR has its own packaging system, and debian packages have to register themselves with PEAR.
You may use pear install -r package.xml in postinst and pear uninstall -r PEAR_MODULE_NAME in prerm to achieve that
Respond to bugs, use rss2email to subscribe to the RSS feed for that package to know about new releases.
We wanted to fulfill a few wishes :
First, get the official pear module you want to package using the pear command from the php4-pear package
And then prepare our deb-source tree : rename the tgz into a package_version.orig.tar.gz, and unpack it.
I know that to decompress the orig.tar.gz into a subdir seems to be awkward, but in fact, it has a file (package.xml) that is at the toplevel of the archive, and dpkg knows how to deal with it alone ! big good boy ;)
how it works ? In three steps :
The very good points here are :
The bad point is that pear does at the same time : configure, make and make install. So it's hard to split them (build: and binary: targets of the debian/rules)
You only need to copy the following debian/rules :
you have to get the pear.xsl used to generate the upstream's changelog
#!/usr/bin/make -f
pear_pkg := $(shell xpath -q -e '/package/name/text()' package.xml)
package = $(shell echo php-$(pear_pkg) | tr '[:upper:]_' '[:lower:]-')
clean:
rm -f \
debian/package.tgz \
debian/$(package).postinst \
debian/$(package).prerm \
debian/watch \
debian/Changelog
dh_testdir
dh_testroot
dh_clean
build:
cat debian/postinst.tpl | perl -e 'while(<>) { exit if /@xml@/; print;}' \
> debian/$(package).postinst
cat package.xml >> debian/$(package).postinst
cat debian/postinst.tpl | perl -e 'while(<>) { print if $$b; $$b=1 if /@xml@/;}' \
>> debian/$(package).postinst
cat debian/prerm.tpl | sed -e 's/@pear_pkg@/$(pear_pkg)/g' \
> debian/$(package).prerm
cat debian/watch.tpl | sed -e 's/@pear_pkg@/$(pear_pkg)/g' \
> debian/watch
xsltproc --nonet --novalid debian/pear.xsl package.xml > debian/Changelog
tar czf debian/package.tgz `ls | grep -v debian`
binary: binary-arch binary-indep
# Nothing to do here
binary-arch:
# Nothing to do here
binary-indep:
dh_testdir
dh_installdirs
# Custom package commands
pear install -n -R debian/$(package)/ debian/package.tgz
rm -rf \
debian/$(package)/usr/share/php/.filemap \
debian/$(package)/usr/share/php/.lock \
debian/$(package)/usr/share/php/.registry
# Resume debhelper scripts
dh_testroot
dh_installchangelogs debian/Changelog
dh_installdocs
dh_installdeb
dh_fixperms
dh_compress
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: binary binary-arch binary-indep build clean
We need to keep the package.xml safe, since it allows us to register the package in PEAR.
You'll have to create a debian/postinst.tpl which should have a line beeing exactly '@xml@', that will be replaced by the package.xml content. It should looks like :
#! /bin/sh
set -e
case "$1" in
configure)
curdir=`pwd`
tmp=`mktemp -t -d`
cd $tmp
(cat <<-EOF
@xml@
EOF
) > package.xml
pear install -r package.xml &>/dev/null
cd $curdir
rm -rf $tmp
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
We have to know the PEAR's module name here, in order to be unregistered from PEAR at remove, upgrade or deconfigure time. You have to create a prerm.tpl containing the @pear_pkg@ token, that will be replaced by the PEAR's module name :
#!/bin/sh
set -e
case "$1" in
remove|upgrade|deconfigure)
pear uninstall -r @pear_pkg@ 1>/dev/null 2>/dev/null
;;
*)
;;
esac
#DEBHELPER#
exit 0
It works like the postrm template does. it replaces the @pear_pkg@ token with the PEAR's module name. So here is a watch.tpl example:
version=2 http://pear.php.net/package/@pear_pkg@/download /get/@pear_pkg@-([\d.]+)\.tgz
don't forget to create debian/changelog, debian/copyright (see policy above) and debian/control file, and you'll be done
be carefull, your Build-Depends(-Indep) in debian/control has to mention php4-pear, libxml-xpath-perl and xsltproc
TODO: