[php-maint] [Webapps-common-discuss] up-to-date policy for PHP PEAR modules

Gregory Colpart reg at evolix.fr
Sat Sep 22 01:07:47 UTC 2007


Hi,

On Tue, Sep 18, 2007 at 06:30:23PM +0200, sean finney wrote:
> 
> > I think /usr/share/php/ should be only for debian-packaged pear
> > modules and locally installed pear modules should go to
> > /usr/local/php/ or whatever directory (similar to perl policy).
> > We should probably change a few things to make easier the deal
> > between debian-packaged and local pear modules (create empty
> > /usr/local/php/ dir, set include_path to
> > '.:/usr/local/php:/usr/share/php' in php.ini, perhaps write a
> > /usr/bin/pear-local wrapper, etcetera)
> 
> yes... in addition to steve's comments about what the directories should be, i 
> think that the "pear" command should default to the local directories, and 
> that debian packages should either not use it, use it with certain flags to 
> specify the "debian directories", or use a "pear-debian" wrapper that does 
> this.
> 
> also, how does pear handle dependencies between the two directories?  i.e. if 
> we have the debian-installed classes in one directory with package A, and 
> locally install package B which depends on A, will it be smart enough at 
> install time (and later run time) to use the package A from the debian dir, 
> or will it download/need a copy from the local dir?

Here are my tests with hacking pear to have two directories:
- /usr/share/php for debian-packaged pear modules
- /usr/local/share/php for locally installed pear modules

I study a little how pear is installed and a solution could be adding
this little patch for /usr/bin/pear file:

---8<---
28c28
< exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d memory_limit="-1" -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php -d "$@"
---
> exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d memory_limit="-1" -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php -d php_dir=/usr/local/share/php "$@"
---8<---

With this hack:

- we can "pear install" without modifying /usr/share/php
- we can also "pear update-channels" without modifying /usr/share/php
- *but* pear dependencies are not checked (except for pear installer)
  then "pear install" reinstall all dependencies by default. User can use
  "--nodeps" or "--register-only" options to avoid duplicated modules, but
  perhaps we don't care what user do in his /usr/local/share/php...
- we can "pear upgrade pear" with keeping /usr/local/share/php. Of course
  upgrading pear erases "/usr/bin/pear" file if use doesn't use "-R
  dir" option, but I think it's like local C-compilation with bad
  --prefix for example
- we should perhaps avoid to handle register/unregister in
  postinst/prerm for debian-package pear modules (a large
  majority of packages don't use that)
- we can list debian-packaged pear modules with command:
  "pear -d php_dir=/usr/share/php list". We can have a wrapper
  for that but I don't see real interest.


Thanks for your comments...


Regards,
-- 
Gregory Colpart <reg at evolix.fr>  GnuPG:1024D/C1027A0E
Evolix - Informatique et Logiciels Libres http://www.evolix.fr/



More information about the pkg-php-maint mailing list