Re: subpackages and bundles
| From: | Justin Patrin | Date: | Fri, 04 Jun 2004 00:44:29 +0000 |
| Subject: | Re: subpackages and bundles | ||
| References: | 1 | Groups: | php.pear.core |
| Request: | Send a blank email to pear-core+get-364@lists.php.net to get a copy of this message | ||
Greg Beaver wrote:
Hi, While working on the channels implementation, there have been a number of skirmishes about whether incorporation of packages into larger packages would result in too much bloat (see Flexy/Savant debate). This gives me an idea of how to implement subpackages and also the bundle idea that has been mentioned by a number of developers. First of all, there are 2 different kinds of sub-packages: - sub-packages recognized by the primary package and needed for operation - sub-packages that are not essential to the primary package, but must be uninstalled when the primary package is uninstalled, or upgraded with the primary package. For instance, Console_Getopt is a sub-package of PEAR. It is required for PEAR to operate, but also stands alone as a separate package. It happens to require PEAR.php for errors, but is not a direct subpackage like HTML_QuickForm_Controller is of HTML_QuickForm, as it does not extend the functionality of PEAR. Recently, the BC break in Console_Getopt caused all kinds of problems with upgrading in earlier PEAR versions because people upgraded PEAR and did not upgrade Console_Getopt, causing all kinds of problems. Even now, this sequence: $ pear upgrade PEAR Error: requires Console_Getopt >= 1.2 $ pear upgrade Console_Getopt PEAR is kind of annoying. Console_Getopt should always be upgraded if a higher version is required by PEAR, it is not really separate from PEAR. An even better example is PEAR_ErrorStack. The release cycle for PEAR_ErrorStack should be separate from the PEAR core, but it is not really separate from the PEAR package, it is a sub-package that must be installed with PEAR, but can be upgraded separately (if the deps on PEAR allow it to be upgraded). These issues can be solved using bundles. package-level bundles would be defined in package.xml for a package <bundles> <bundle type="default"> <!-- default install on "pear install/upgrade PEAR" --> <subpackage type="pkg">Console_Getopt</subpackage> <subpackage type="pkg">PEAR_ErrorStack</subpackage> <bundle> <bundle type="custom" name="minimal"> <subpackage type="pkg">Console_Getopt</subpackage> <bundle> <bundles> The deps section would have: <deps> <dep type="pkg" rel="ge" version="1.2">Console_Getopt</dep> <dep type="pkg" rel="has" optional="yes">PEAR_ErrorStack</dep> </dep> bundles could be specified using a path separator like: pear install PEAR/minimal (unless someone has a better idea) The second kind of subpackage is exemplified by HTML_QuickForm_Controller. HTML_QuickForm does not care whether or not it is installed or doesn't exist, but HTML_QuickForm_Controller must be uninstalled with HTML_QuickForm, or may need upgrading. $ pear uninstall HTML_QuickForm HTML_QuickForm_Controller depends on HTML_QuickForm, failed. $ pear uninstall HTML_QuickForm HTML_QuickForm_Controller This kind of child->parent relationship could be noted in the package.xml as well: <package version="1.1"> <name channel="pear" parent="HTML_QuickForm">HTML_QuickForm_Controller</name> This would instruct the installer to uninstall HTML_QuickForm_Controller if passed the --subpackages switch $ pear uninstall --subpackages HTML_QuickForm uninstall of HTML_QuickForm_Controller OK uninstall of HTML_QuickForm OK I think these two solutions: 1) package-level bundles for top-down subpackages 2) parent specification for bottom-up subpackages will solve the subpackage dilemma and allow supreme modularization of packages. All drivers for DB/MDB could become separate subpackages that could also be specified as bundles, templates like Flexy could split off the compilation code to allow a minimal Savant-like configuration, and application support would not be far off, especially since the bundle attribute could specify packages from other channels as part of the bundle. Once bundles/subpackages are in place, the only thing missing for true app support is some kind of customizable task support, in order to do things like initialize databases, set up writable data locations, and configure application frontends like web interfaces and so on. :) GregSounds great to me. :-) -- paperCrane <Justin Patrin>