Make it possible to overwrite the "automatic-install" pkg object via xbps_init().
Two new booleans were added to struct xbps_handle: install_reason_{auto,manual}. The backend is able to force auto or manual installation for a package (and dependencies that were installed/updated) by setting to true any of those booleans. Bump XBPS_RELVER.
This commit is contained in:
parent
2c644c6587
commit
8191a1511c
@ -53,7 +53,7 @@
|
||||
* @def XBPS_RELVER
|
||||
* Current library release date.
|
||||
*/
|
||||
#define XBPS_RELVER "20110224"
|
||||
#define XBPS_RELVER "20110225"
|
||||
|
||||
/**
|
||||
* @def XBPS_META_PATH
|
||||
@ -193,6 +193,23 @@ struct xbps_handle {
|
||||
* Set to true to enable debugging messages to stderr.
|
||||
*/
|
||||
bool with_debug;
|
||||
/**
|
||||
* @var install_reason_auto
|
||||
*
|
||||
* Set to true to make installed or updated target package
|
||||
* (and its dependencies) marked with automatic installation,
|
||||
* thus it will be found as orphan if no packages are depending
|
||||
* on it.
|
||||
*/
|
||||
bool install_reason_auto;
|
||||
/**
|
||||
* @var install_reason_manual
|
||||
*
|
||||
* Set to true to make installed or updated target package
|
||||
* (and its dependencies) marked with manual installation, thus
|
||||
* it will never will be found as orphan.
|
||||
*/
|
||||
bool install_reason_manual;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,6 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
const char *pkgname, *version, *desc, *pkgver;
|
||||
char *plist;
|
||||
int rv = 0;
|
||||
bool autoinst = false;
|
||||
|
||||
xhp = xbps_handle_get();
|
||||
plist = xbps_xasprintf("%s/%s/%s", xhp->rootdir,
|
||||
@ -93,14 +92,15 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic)
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (!prop_dictionary_get_bool(pkgd,
|
||||
"automatic-install", &autoinst)) {
|
||||
if (!prop_dictionary_set_bool(pkgd,
|
||||
"automatic-install", automatic)) {
|
||||
prop_object_release(pkgd);
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (xhp->install_reason_auto)
|
||||
automatic = true;
|
||||
else if (xhp->install_reason_manual)
|
||||
automatic = false;
|
||||
if (!prop_dictionary_set_bool(pkgd, "automatic-install",
|
||||
automatic)) {
|
||||
prop_object_release(pkgd);
|
||||
rv = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (provides) {
|
||||
if (!prop_dictionary_set(pkgd, "provides", provides)) {
|
||||
|
Loading…
Reference in New Issue
Block a user