diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index 380d6446..96901d3c 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -97,7 +97,8 @@ main(int argc, char **argv) force_rm_with_deps = true; break; case 'f': - flags |= XBPS_FLAG_FORCE; + flags |= XBPS_FLAG_FORCE_CONFIGURE; + flags |= XBPS_FLAG_FORCE_REMOVE_FILES; break; case 'M': install_manual = true; diff --git a/include/xbps_api.h b/include/xbps_api.h index 523d7775..524c26fd 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -55,7 +55,7 @@ */ #define XBPS_PKGINDEX_VERSION "1.3" -#define XBPS_API_VERSION "20111124" +#define XBPS_API_VERSION "20111124-1" #define XBPS_VERSION "0.11.0" /** @@ -132,17 +132,26 @@ /** * @def XBPS_FLAG_VERBOSE - * Verbose flag used in xbps_unpack_binary_pkg() (for now). - * Must be set through the xbps_init::flags member. + * Verbose flag that can be used in the function callbacks to alter + * 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 - * Force flag used in xbps_configure_pkg() (for now). + * @def XBPS_FLAG_FORCE_CONFIGURE + * 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. */ -#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 diff --git a/lib/package_configure.c b/lib/package_configure.c index 662c8161..e915fa3d 100644 --- a/lib/package_configure.c +++ b/lib/package_configure.c @@ -42,11 +42,10 @@ * ran successful. * * @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 * state is XBPS_PKG_STATE_INSTALLED. */ - int xbps_configure_packages(void) { @@ -104,7 +103,7 @@ xbps_configure_pkg(const char *pkgname, } if (state == XBPS_PKG_STATE_INSTALLED) { - if ((xhp->flags & XBPS_FLAG_FORCE) == 0) + if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0) return 0; } else if (state != XBPS_PKG_STATE_UNPACKED) return EINVAL; diff --git a/lib/package_remove.c b/lib/package_remove.c index d222fdb7..57818fa3 100644 --- a/lib/package_remove.c +++ b/lib/package_remove.c @@ -43,8 +43,8 @@ * -# Its pre-remove target specified in the REMOVE script * will be executed. * -# Its files, dirs and links will be removed. Modified files (not - * matching its sha256 hash) are preserved, unless XBPS_FLAG_FORCE - * is set via xbps_init() in the flags member. + * matching its sha256 hash) are preserved, unless + * XBPS_FLAG_FORCE_REMOVE_FILES flag is set via xbps_init::flags member. * -# Its post-remove target specified in the REMOVE script * will be executed. * -# 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 * data type is specified on its edge, i.e string, array, integer, dictionary. */ - int xbps_remove_pkg_files(prop_dictionary_t dict, const char *key, @@ -139,7 +138,8 @@ xbps_remove_pkg_files(prop_dictionary_t dict, continue; } else if (rv == ERANGE) { rv = 0; - if ((xhp->flags & XBPS_FLAG_FORCE) == 0) { + if ((xhp->flags & + XBPS_FLAG_FORCE_REMOVE_FILES) == 0) { xbps_set_cb_state( XBPS_STATE_REMOVE_FILE_HASH_FAIL, 0, pkgname, version,