Re: Re: Conditional package dependencies?

From: Date: Mon, 11 Jun 2007 18:07:59 +0000
Subject: Re: Re: Conditional package dependencies?
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-47011@lists.php.net to get a copy of this message
Olivier Guilyardi wrote: > Hi Greg, > > Greg Beaver wrote: > >> Mark Wiesemann wrote: >> > > >>> To keep it short: Is there a way to define a conditional dependency that >>> requires the new driver if PHP 5 is used, and that defines only an >>> optional dependency if PHP 4 is used? >>> >> There is one possibility that may be a bit onerous. Basically, your >> only hope is to take advantage of the new pre-download PHP dependency >> resolution in PEAR 1.6.0. >> > > Okay, so we need to require PEAR >= 1.6.0 > > >> What you could do is have the 1.0.x versions of SQLQuery driver simply >> be a wrapper for the default php 4 driver, and 1.1.x versions of >> SQLQuery driver be the php 5 driver. However, for this to work, you'd >> need the API to be BC between 1.1.x and 1.0.x. If the php4/php5 >> machinations are all under the hood, this solution would actually work >> and satisfy PEAR's API BC requirements >> > > If I understand correctly you mean that: > > - SDG_DS_SQLQuery 1.0.x wouldn't provide any file by its own but depend on: > - PHP4 > - SDG_DS_DBQuery (the old DB-based driver) > - SDG_DS_MDB2 (the old MDB2-based driver) > > - SDG_DS_SQLQuery 1.1.x would provide the new driver's files and depend on: > - PHP5 > > - Structures_DataGrid would depend on: > - SDG_DS_SQLQuery >= 1.0 > > Then the pear installer would download the 1.0.x version if it detects PHP4, and > the 1.1.x or later version otherwise. Is this right? > > It seems to me like it wouldn't create any maintaining overhead.. That seems to > be the perfect solution :) Hi Olivier, This is indeed the solution I'm talking about. Be forewarned that this will result in some really long version numbers like 1.0.48 and 1.1.94 if you do a lot of releases :). However, you would need to make sure that code written to use SDG_DS_SQLQuery 1.0.x will continue to work *unaltered* if the user upgrades the underlying PHP installation to version 5.x from 4.x. Otherwise the code is by definition not BC. This means that, for instance, if the 4.x returns PEAR_Error objects, you need to have a flag in SDG_DS_SQLQuery that enables exceptions, but returns PEAR_Error by default (try/catch internal magic can perform this task quite easily) Greg

« previous php.pear.dev (#47011) next »