Re: Re: conflict with PEAR2 standards and PEAR 1
| From: | Greg Beaver | Date: | Tue, 26 May 2009 15:00:04 +0000 |
| Subject: | Re: Re: conflict with PEAR2 standards and PEAR 1 | ||
| References: | 1 2 3 4 | Groups: | php.pear.core |
| Request: | Send a blank email to pear-core+get-8441@lists.php.net to get a copy of this message | ||
Chuck Burgess wrote:
> I've done this sort of thing (changing php_dir) with almost every PEAR
> installation I've ever made. The key observation about doing this that I
> had to understand was that by making changes to *any* of the directory
> configs, I'd have to follow the change itself with a "pear upgrade --force"
> on every currently installed package, in order to make sure all files were
> placed where expected *and* to update all install-time replacement tasks
> that might be in the code of the already installed packages.
>
> In my mind, I've not yet made the leap to see how a preparatory step of
> "pear config-set php_dir /move/to/src" followed by "pear upgrade --force"
> on
> all PEAR1 packages would not solve this, at least for preparing your PEAR1
> installation to be absorbed by a PEAR2 installation. Maybe that's the wrong
> angle for me to be viewing this scene?
>
<snip>
> For my use case, which is usually test beds, I never want any overlap
> between the distinct PEAR1 installations. Therefore, I have each
> installation's *_dir settings separated very well from other installation's
> directories. I also rely on the "pear -c thisPear.conf" argument to point
> to a distinct config file for each installation, just to be sure I don't
> have any overlap.
>
Hi,
I don't see why for this use case you would need to do pear config-set
php_dir blah followed by pear install --force Package. Doesn't it work
better to use the config-create command, and then install each package
freshly with pear -c /path/to/created/config install Packagename? What
you are describing is installing discrete PEAR installations, not moving
an existing installation to another location (which, by the way, will be
handled in pyrus with a new command "deploy" whose purpose is to take an
existing PEAR installation and to move it to either a remote server or
another directory).
So, assuming my contention is valid and there isn't some other piece of
information that makes it necessary to change php_dir, let me describe
the difference in how this would work for you with pyrus (and some
pseudo-code):
PEAR:
download PEAR (usually combined with the next step)
install PEAR to /usr/local/lib/php
foreach (/path/to/testpath) {
pear config-create /path/to/testpath/config
pear -c /path/to/testpath/config install *
}
Pyrus:
download pyrus.phar
foreach (/path/to/testpath) {
php pyrus.phar /path/to/test/path install *
}
The key difference in thinking is that pyrus eliminates completely the
need to explicitly create a configuration file, to install PEAR, or to
use --force, or any of that nonsense. You simply tell Pyrus where you
want to put the install, and it does it.
For the use case of having a system PEAR install and a user install,
pyrus supports multiple levels simply through include_path. Thus, one
can instruct pyrus to process a local install simply by setting
include_path:
php -d "include_path=/home/username/localpear:/usr/local/lib/php"
pyrus.phar ...
By default, pyrus cascades through include_path (skipping ".").
However, you can also set up a default location via:
php pyrus.phar set my_pear_path /home/username/localpear:/usr/local/lib/php
and then
php pyrus.phar ...
will use the two locations for installation.
>> One question to consider is who will benefit by changing from php/ to
>> src/? The change will make it more difficult for existing users of PEAR
>> to upgrade to using Pyrus. Is there some huge group of people who are
>> avoiding PEAR because it installs into php/ that we will gain by
>> switching to src/?
>>
>> Greg
>>
>>
>
>
> Ok, stepping back from the original acute question, let me frame it this
> way... if we do this change of "php_dir sets to src/ rather than php/",
> then:
>
> - For an existing PEAR1 installation, it makes no difference, because
> php_dir is already set in that installation. Installing new packages is
> unaffected.
> - For a new PEAR1 installation, php_dir is set to src/ at the beginning.
> Installing new packages is unaffected.
> - For a new PEAR2 installation, php_dir is set to src/ anyway. Since
> php_dir is set, installing PEAR1 packages should be unaffected, right?
> Unless the PEAR1 package itself has hardcoded pathing to php/ rather than
> relying on @php_dir@ that gets replaced at install time. *Is this the
> true key core issue*?
> - In retrospect to my earlier question, is there even a possibility of
> "upgrading" a PEAR1 install to PEAR2?
>
Yes, because we can convert between registry formats in pyrus (the
command in question is "upgrade-registry"), but it is safest if the
php_dir directory is the same between the two. Why?
PEAR2 does not look for a PEAR1 configuration file, and because it is
possible to do things like specify a custom one, it is not possible to
assume anything about the PEAR installation. Pyrus looks for a PEAR1
registry in a directory ending with "php/" when upgrading currently
(yes, this can be changed easily but has the same issue). Thus, when
converting from a PEAR1 registry to a PEAR2 sqlite/xml registry, it will
successfully store the installed locations of all the files, but will
install all new packages into src/.
The problem has to do with packages that are designed for PEAR1. Pyrus
will never have the ability to run PEAR1 post-install scripts, because
they require PEAR components. Thus, there are still a few cases where
one will need a PEAR installation around. The same is true for custom
roles/tasks. These must be rewritten for Pyrus. So, for instance,
installing Chiara_PEAR_Server will require PEAR in order to run its
post-install script.
However, because Pyrus has the ability to install packages into a PEAR1
registry at the same time it installs into a PEAR2 registry, it is
possible to install a package with pyrus (and to get all the benefits of
cascading registry, safer dependency handling, better pre-download
dependency resolution, etc.), and then manage the post-install using the
PEAR installer.
The problem, as I see it, is that packages installed with Pyrus will go
into another directory (src) than what is specified in the PEAR config
file. This means ignoring the user's preferences, which is the
essential problem. Although we can't fix it for people installing into
their own directory names, the majority of users who would benefit from
this will be installing into the default locations, which always end in
"php"
Incidentally, the change to "php" will also simplify the code for
packaging, as we put everything into role/ (role="data" goes into data/,
role="test" goes into test/, etc.) except for role="php" which goes into
src.
Greg
P.S. the initial discussion was not with pear-group, but on pear-core,
so it is in the archives