#25080 [Opn->Csd]: packages with optional dependencies can't be uninstalled
| From: | cellog@php.net | Date: | Wed, 13 Aug 2003 21:16:34 +0000 |
| Subject: | #25080 [Opn->Csd]: packages with optional dependencies can't be uninstalled | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19693@lists.php.net to get a copy of this message | ||
ID: 25080
Updated by: cellog@php.net
Reported By: cellog@php.net
-Status: Open
+Status: Closed
Bug Type: PEAR related
Operating System: na
PHP Version: Irrelevant
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Forgot this additional patch to Installer.php
Index: pear/PEAR/Installer.php
===================================================================
RCS file: /repository/php-src/pear/PEAR/Installer.php,v
retrieving revision 1.95
diff -u -r1.95 Installer.php
--- pear/PEAR/Installer.php 5 Aug 2003 14:31:15 -0000 1.95
+++ pear/PEAR/Installer.php 13 Aug 2003 21:15:46 -0000
@@ -774,11 +774,18 @@
$this->installroot = '';
}
$this->registry = &new PEAR_Registry($php_dir);
+ $filelist = $this->registry->packageInfo($package,
'filelist');
+ if ($filelist == null) {
+ return $this->raiseError("$package not installed");
+ }
if (empty($options['nodeps'])) {
$depchecker = &new PEAR_Dependency($this->registry);
- $error = $depchecker->checkPackageUninstall($errors,
$package);
+ $error = $depchecker->checkPackageUninstall($errors,
$warning, $package);
if ($error) {
return $this->raiseError($errors . 'uninstall
failed');
+ }
+ if ($warning) {
+ $this->log(0, $warning);
}
}
// Delete the files
Previous Comments:
------------------------------------------------------------------------
[2003-08-13 16:14:07] cellog@php.net
Description:
------------
if a package has an optional dependency, it can't be uninstalled if the
optional dependency is installed. This patch fixes that
Index: pear/PEAR/Dependency.php
===================================================================
RCS file: /repository/php-src/pear/PEAR/Dependency.php,v
retrieving revision 1.23
diff -u -r1.23 Dependency.php
--- pear/PEAR/Dependency.php 3 Aug 2003 13:44:36 -0000 1.23
+++ pear/PEAR/Dependency.php 13 Aug 2003 21:13:31 -0000
@@ -151,11 +151,12 @@
* Check package dependencies on uninstall
*
* @param string $error The resultant error string
+ * @param string $warning The resultant warning string
* @param string $name Name of the package to test
*
* @return bool true if there were errors
*/
- function checkPackageUninstall(&$error, $package)
+ function checkPackageUninstall(&$error, &$warning, $package)
{
$error = null;
$packages = $this->registry->listPackages();
@@ -169,7 +170,11 @@
}
foreach ($deps as $dep) {
if ($dep['type'] == 'pkg' &&
strcasecmp($dep['name'],
$package) == 0) {
- $error .= "Package '$pkg' depends on
'$package'\n";
+ if (isset($dep['optional']) && $dep['optional'] ==
'yes') {
+ $warning .= "\nWarning: Package '$pkg'
optionally depends on '$package'";
+ } else {
+ $error .= "Package '$pkg' depends on
'$package'\n";
+ }
}
}
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25080&edit=1