Split XBPS_FLAG_FORCE into CONFIGURE and REMOVE_FILES, bump XBPS_API_VERSION.

This commit is contained in:
Juan RP 2011-11-24 11:50:53 +01:00
parent ab36420439
commit ab17573692
4 changed files with 24 additions and 15 deletions

View File

@ -97,7 +97,8 @@ main(int argc, char **argv)
force_rm_with_deps = true; force_rm_with_deps = true;
break; break;
case 'f': case 'f':
flags |= XBPS_FLAG_FORCE; flags |= XBPS_FLAG_FORCE_CONFIGURE;
flags |= XBPS_FLAG_FORCE_REMOVE_FILES;
break; break;
case 'M': case 'M':
install_manual = true; install_manual = true;

View File

@ -55,7 +55,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.3" #define XBPS_PKGINDEX_VERSION "1.3"
#define XBPS_API_VERSION "20111124" #define XBPS_API_VERSION "20111124-1"
#define XBPS_VERSION "0.11.0" #define XBPS_VERSION "0.11.0"
/** /**
@ -132,17 +132,26 @@
/** /**
* @def XBPS_FLAG_VERBOSE * @def XBPS_FLAG_VERBOSE
* Verbose flag used in xbps_unpack_binary_pkg() (for now). * Verbose flag that can be used in the function callbacks to alter
* Must be set through the xbps_init::flags member. * its behaviour. Must be set through the xbps_init::flags member.
*/ */
#define XBPS_FLAG_VERBOSE 0x00000001 #define XBPS_FLAG_VERBOSE 0x00000001
/** /**
* @def XBPS_FLAG_FORCE * @def XBPS_FLAG_FORCE_CONFIGURE
* Force flag used in xbps_configure_pkg() (for now). * Force flag used in xbps_configure_pkg(), if set the package(s)
* will be reconfigured even if its state is XBPS_PKG_STATE_INSTALLED.
* Must be set through the xbps_init::flags member. * Must be set through the xbps_init::flags member.
*/ */
#define XBPS_FLAG_FORCE 0x00000002 #define XBPS_FLAG_FORCE_CONFIGURE 0x00000002
/**
* @def XBPS_FLAG_FORCE_REMOVE_FILES
* Force flag used in xbps_remove_pkg_files(), if set the package
* files will be removed even if its SHA256 hash don't match.
* Must be set through the xbps_init::flags member.
*/
#define XBPS_FLAG_FORCE_REMOVE_FILES 0x00000004
__BEGIN_DECLS __BEGIN_DECLS

View File

@ -42,11 +42,10 @@
* ran successful. * ran successful.
* *
* @note * @note
* If the \a XBPS_FLAG_FORCE is set through xbps_init() in the flags * If the \a XBPS_FLAG_FORCE_CONFIGURE is set through xbps_init() in the flags
* member, the package (or packages) will be reconfigured even if its * member, the package (or packages) will be reconfigured even if its
* state is XBPS_PKG_STATE_INSTALLED. * state is XBPS_PKG_STATE_INSTALLED.
*/ */
int int
xbps_configure_packages(void) xbps_configure_packages(void)
{ {
@ -104,7 +103,7 @@ xbps_configure_pkg(const char *pkgname,
} }
if (state == XBPS_PKG_STATE_INSTALLED) { if (state == XBPS_PKG_STATE_INSTALLED) {
if ((xhp->flags & XBPS_FLAG_FORCE) == 0) if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0)
return 0; return 0;
} else if (state != XBPS_PKG_STATE_UNPACKED) } else if (state != XBPS_PKG_STATE_UNPACKED)
return EINVAL; return EINVAL;

View File

@ -43,8 +43,8 @@
* -# Its <b>pre-remove</b> target specified in the REMOVE script * -# Its <b>pre-remove</b> target specified in the REMOVE script
* will be executed. * will be executed.
* -# Its files, dirs and links will be removed. Modified files (not * -# Its files, dirs and links will be removed. Modified files (not
* matching its sha256 hash) are preserved, unless XBPS_FLAG_FORCE * matching its sha256 hash) are preserved, unless
* is set via xbps_init() in the flags member. * XBPS_FLAG_FORCE_REMOVE_FILES flag is set via xbps_init::flags member.
* -# Its <b>post-remove</b> target specified in the REMOVE script * -# Its <b>post-remove</b> target specified in the REMOVE script
* will be executed. * will be executed.
* -# Its requiredby objects will be removed from the installed packages * -# Its requiredby objects will be removed from the installed packages
@ -69,7 +69,6 @@
* Text inside of white boxes are the key associated with the object, its * Text inside of white boxes are the key associated with the object, its
* data type is specified on its edge, i.e string, array, integer, dictionary. * data type is specified on its edge, i.e string, array, integer, dictionary.
*/ */
int int
xbps_remove_pkg_files(prop_dictionary_t dict, xbps_remove_pkg_files(prop_dictionary_t dict,
const char *key, const char *key,
@ -139,7 +138,8 @@ xbps_remove_pkg_files(prop_dictionary_t dict,
continue; continue;
} else if (rv == ERANGE) { } else if (rv == ERANGE) {
rv = 0; rv = 0;
if ((xhp->flags & XBPS_FLAG_FORCE) == 0) { if ((xhp->flags &
XBPS_FLAG_FORCE_REMOVE_FILES) == 0) {
xbps_set_cb_state( xbps_set_cb_state(
XBPS_STATE_REMOVE_FILE_HASH_FAIL, XBPS_STATE_REMOVE_FILE_HASH_FAIL,
0, pkgname, version, 0, pkgname, version,