Add the concept of purging a package, such as with dpkg.

By default a package when is removed, its configuration files
and metadata files won't be removed unless the package is purged.

While here add two targets for xbps-bin:

 * purge [<pkgname>|<all>], passing the "all" string (case insensitive)
   will purge all packages that are in this state (XBPS_PKG_STATE_CONFIG_FILES).

 * reconfigure [<pkgname>|<all>], reconfigures a package or "all"
   if package hasn't been configured. Passing -f reconfigures it again
   even if it's state is ok.

--HG--
extra : convert_revision : bd2d3913ca087a0565b05fa9ee3f9b6d5e3cb934
This commit is contained in:
Juan RP 2009-08-13 16:46:20 +02:00
parent 09cede6d8a
commit 0d04547576
10 changed files with 389 additions and 195 deletions

View file

@ -192,6 +192,7 @@ xbps_find_pkg_from_plist(const char *plist, const char *pkgname)
prop_dictionary_t
xbps_find_pkg_installed_from_plist(const char *pkgname)
{
pkg_state_t state = 0;
prop_dictionary_t pkgd;
if (regpkgdb_initialized == false)
@ -201,7 +202,16 @@ xbps_find_pkg_installed_from_plist(const char *pkgname)
if (pkgd == NULL)
return NULL;
return prop_dictionary_copy(pkgd);
if (xbps_get_pkg_state_installed(pkgname, &state) != 0)
return NULL;
switch (state) {
case XBPS_PKG_STATE_INSTALLED:
case XBPS_PKG_STATE_UNPACKED:
return prop_dictionary_copy(pkgd);
default:
return NULL;
}
}
prop_dictionary_t