Debian – upgrade xdebug without using apt

aptdebianmake

I'm running debian 5.0.6 and have installed xdebug 2.0.3 via aptitude. Now I want to install PHPUnit, and when trying to do it through pear, I get the error that PHPUnit wants a more recent xdebug

phpunit/PHPUnit requires PHP extension "xdebug" (version >= 2.0.5), installed version is 2.0.3

Looking at the debian site, I don't see a package for 2.0.5. Is it safe to try upgrade xdebug outside of the apt system? I'm not entirely clear on how these things ( php, apache2, and xdebug ) are interrelated, and I don't want to break things and have downtime. My rough guess would be that I would build xdebug 2.0.5 and then restart Apache. If I go it alone, is aptitude going to trip up on that later, when an xdebug package comes out?

Best Answer

There is a recent enough version of xdebug in squeeze (the next release of Debian, which will be ready any month now). It doesn't have an official backport to stable (otherwise the backport would be listed on the xdebug package search page). The binary package depends on a recent version of PHP, but you should be able to compile the source package on lenny, since its build dependencies are satisfiable on lenny. Here's a recipe for building the package:

  1. Download the three files (.dsc, .orig.tar.gz, and .debian.tar.gz). Since this is a punctual need, just do it manually.
  2. Install the build dependencies (here debhelper and php5-dev) with apt-get or aptitude. Also install the basic set of development packages; the build-essential package will pull them all. Also install fakeroot.
  3. Unpack the source: dpkg-source -x xdebug_2.1.0-1.dsc and change to the source directory: cd xdebug-2.1.0.
  4. (You can skip this step if you don't make any change in the source package.)
    Edit the debian/changelog file to add a new changelog entry. This is easily done in Emacs:
    • make sure the dpkg-dev-el package is installed;
    • open debian/changelog in Emacs;
    • use C-c C-a to add an entry;
    • choose a new version number (here 2.1.0~user394+1 would be a reasonable choice, following the pattern used by the official backports);
    • write a log entry (e.g., backport to lenny, describe the changes you made);
    • use C-c C-c to finalize the entry.
  5. Compile the package: dpkg-buildpackage -rfakeroot -us -uc
    If you have a PGP/GPG key, don't pass -us -uc and enter your passphrase if prompted to cryptographically sign the packages.
  6. Profit Install the binary package.

To summarize the steps:

wget http://ftp.de.debian.org/debian/pool/main/x/xdebug/xdebug_2.1.0{.orig.tar.gz,-1.{dsc,debian.tar.gz}}
sudo aptitude install build-essential fakeroot debhelper php5-dev
dpkg-source -x xdebug_2.1.0-1.dsc
cd xdebug-2.1.0
# patch as necessary
emacs debian/changelog # not necessary if unpatched
dpkg-buildpackage -rfakeroot -us -uc
dpkg -i ../php5-xdebug_2.1.0_*.deb
Related Question