Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.15

Bug #10372 upgrade package, only try when needed
Submitted: 2007-03-14 14:27 UTC
From: tias Assigned: cellog
Status: Closed Package: PEAR (version 1.5.1)
PHP Version: Irrelevant OS:
Roadmaps: 1.5.2    
Subscription  


 [2007-03-14 14:27 UTC] tias (Tias Guns)
Description: ------------ Hello, When doing 'upgrade <package>' for an up-to-date package, pear returns some errors. Pear should detect that the package is already up-to-date and not try to upgrade it. Similar to the way upgrade-all does this. A patch can be found attached and on http://tias.ulyssis.org/patch/pear/Command_Install_1.5.1_upgrade.patch It puts the 'version checking' code of upgrade-all in a function, and makes 'upgrade' use it. Upgrade-all does now what it should: an upgrade of every installed 'channel/package'. Greetings, Tias Expected result: ---------------- ./pear upgrade PEAR pear/PEAR is already installed and is newer than detected release version 1.5.1 Cannot initialize 'PEAR', invalid or missing package file Package "PEAR" is not valid upgrade failed Actual result: -------------- ./pear upgrade PEAR Nothing to upgrade

Comments

 [2007-03-15 02:20 UTC] cellog (Greg Beaver)
your patch does not take into account options "force" "nodeps" or other options like "soft" Would you like to amend the patch, or should I?
 [2007-03-15 17:15 UTC] tias (Tias Guns)
I did not touch the actual installation code of doInstall(), and doUpgradeAll() calls doInstall() with the same options that it received, so all options are delegated to doInstall(), which handles them as they should be. I don't think the currently attached patch needs any modification. Ciao, Tias
 [2007-03-15 17:51 UTC] tias (Tias Guns)
Updated the patch a little bit: (twice). For finding the state, it now uses the packageInfo parameter 'release_state' which is always available.
 [2007-03-21 05:28 UTC] cellog (Greg Beaver)
with your patch, try this code: pear install DB pear upgrade --force DB As you can see, it fails. --force should force installation. This is the option that I am talking about, so if --force is set, you should not call the _filterUpgrade function. Would you like to amend the patch, or should I? Also, FYI, there is a stray isSet instead of isset (minor issue)
 [2007-03-21 13:32 UTC] tias (Tias Guns)
Ah, indeed, when the force option is provided a filter may not be used. The new patch fixes the isSet's too. g,T
 [2007-03-27 04:24 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. The patch is a significant improvement over previous patches, but fails to take into account three crucial and very common tasks: pear install package.xml pear install Package-1.2.3.tgz pear install http://example.com/Package-1.2.3.tgz I detected these oversights by running the unit tests for PEAR. I recommend that you do the same for future patches. The procedure is cd pear-core/tests pear run-tests -rq You can see the source of the failures in the .out files for failed tests (i.e. if test_whatever.phpt fails, its failure info is in test_whatever.out) FYI, it took me about 5 extra hours of work to get all of the critical bugs and BC breaks out of your patch. Please be very, very careful, it is really easy to break the installer. There are 686 unit tests to help prevent this from happening, and they really work. I'm going to attach a new patch to show the extent of changes that were needed to both the source and the unit tests both to keep the bug current as a kind of almost-ridiculous example of the kind of work that needs to go into a change of the magnitude you proposed. Thanks for the great initial work, and the fantastic idea, this will make the installer much easier to use
 [2007-03-27 04:26 UTC] cellog (Greg Beaver)
ok, it wouldn't let me add a patch (too big), you can see it at: http://news.php.net/php.pear.cvs/45468
 [2007-03-29 17:02 UTC] cellog (Greg Beaver)
the original patch does not take into account optional dependency groups, and is not fixed. The patch applied to CVS does not take into account the "install" command
 [2007-04-02 05:09 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.