Dave Hall Consulting logo

Packaging Doctrine for Debian and Ubuntu

I have been indoctrinated into to the everything on production machines should be packaged school of thought. Rather than bang on about that, I intend to keep this post relatively short and announce that I have created Debian (and Ubuntu) packages for Doctrine, the ORM for PHP.

The packaging is rather basic, it gets installed just like any other Debianised PEAR package, that being the files go in /usr/share/php, the package.xml and any documentation goes into /usr/share/doc/<package>, and the tests are stored as examples in /usr/share/doc/<package>/examples. The generated package will be called php-doctrine_1.2.1-1_all.deb (or similar), to comply with the Debian convention of naming all PEAR packages php-<pear-package-name>_<version>_<architecture>.deb. I have only packaged 1.2.1, but the files can easily be adapted for other versions, some of the packaging is designed to be version agnostic anyway.

To create your own Doctrine deb, follow these steps:

  • Create a directory, such as ~/packaging/php-doctrine-1.2.1
  • Change into the new directory
  • Download my debian/ tarball and extract it in your php-doctrine-1.2.1 directory
  • Download the PEAR package tarball from the project website and extract it in your php-doctrine-1.2.1 directory
  • If you don't already have a standard Debian build environment setup, set one up by running sudo apt-get install build-essential
  • To build the package run dpkg-buildpackage -k<your-gpg-key-id> -rfakeroot . If you don't have a gpg key drop the "-k<your-gpg-key-id>" from the command

Now you should have a shiny new Doctrine deb. I think the best way to deploy it is using apt and private package repository.

Update: @micahg on identi.ca pointed me to a Doctrine ITP for Debian. Hopefully Federico's work will mean I no longer need to maintain my own packaging of Doctrine.

php-doctrine-debian.tar.gz2.01 KB

Superfluous line in debian/control

Slaven Rezic wrote:

The dpkg-buildpackage command does not work on my Debian/lenny system:

dpkg-checkbuilddeps: error: syntax error in debian/control at line 20: block lacks a package field

However, if I remove the empty line before the Description field in debian/control, then the creation of the package is successful.

Added Tue, 2010-02-23 23:13

package doctrine

gilberto dos santos alves wrote:

hi i am happy with you blog because following instructions from doctrine in my notebook with my installed Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny6 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_wsgi/2.5 mod_perl/2.0.4 Perl/v5.10.0 Server at localhost Port 80

and then

unpack sandbox, create a link for that directory and http://localhost/doctrine.php a receive this message:

Doctrine Command Line Interface build-all build-all-load build-all-reload compile create-db create-tables dql drop-db dump-data generate-migration generate-migrations-db generate-migrations-diff generate-migrations-models generate-models-db generate-models-yaml generate-sql generate-yaml-db generate-yaml-models load-data migrate rebuild-db

questions: ==================================================== what i do wrong because my test.php does not work? =================================================== // test.php <? require_once('bootstrap.php'); echo Doctrine::getPath();

============> error ===================>>>>>

// test.php Warning: require_once(bootstrap.php) [function.require-once]: failed to open stream: No such file or directory in /d1/down/sandbox/test.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'bootstrap.php' (include_path='.:/d1/down/sandbox') in /d1/down/sandbox/test.php on line 3

Added Tue, 2010-03-09 04:26

Re: package doctrine

Dave wrote:

I haven't tested it the packages with the doctrine Sandbox. I use them in development and production environments with Zend Framework.

A quick look at the output suggests that your include path isn't setup to look for PEAR packages in /usr/share/php/

Added Sat, 2010-03-13 19:15

RE: Superfluous line in debian/control

Dave wrote:

I finally found some time to test this again. It turns out I tar'd up the wrong version and posted it. This version builds on ubuntu karmic without a problem.

Added Mon, 2010-03-15 20:11