libxbps: cache regpkgdb just when it's needed not via xbps_init().
This commit is contained in:
parent
8fd5253e31
commit
b232ca1815
@ -177,17 +177,6 @@ xbps_init(struct xbps_handle *xh)
|
|||||||
xbps_dbg_printf("fetch-cacheconn=%u\n", cc);
|
xbps_dbg_printf("fetch-cacheconn=%u\n", cc);
|
||||||
xbps_dbg_printf("fetch-cacheconn-host=%u\n", cch);
|
xbps_dbg_printf("fetch-cacheconn-host=%u\n", cch);
|
||||||
xbps_dbg_printf("syslog=%u\n", xhp->syslog_enabled);
|
xbps_dbg_printf("syslog=%u\n", xhp->syslog_enabled);
|
||||||
/*
|
|
||||||
* Initialize regpkgdb dictionary.
|
|
||||||
*/
|
|
||||||
if ((rv = xbps_regpkgdb_dictionary_init(xhp)) != 0) {
|
|
||||||
if (rv != ENOENT) {
|
|
||||||
xbps_dbg_printf("%s: couldn't initialize "
|
|
||||||
"regpkgdb: %s\n", strerror(rv));
|
|
||||||
xbps_end(xh);
|
|
||||||
return EINVAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,11 @@ xbps_configure_packages(void)
|
|||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
xhp = xbps_handle_get();
|
xhp = xbps_handle_get();
|
||||||
|
if ((rv = xbps_regpkgdb_dictionary_init(xhp)) != 0) {
|
||||||
|
xbps_dbg_printf("%s: couldn't initialize "
|
||||||
|
"regpkgdb: %s\n", strerror(rv));
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
||||||
if (iter == NULL)
|
if (iter == NULL)
|
||||||
return errno;
|
return errno;
|
||||||
|
@ -182,6 +182,11 @@ xbps_find_pkg_orphans(prop_array_t orphans_user)
|
|||||||
* in which packages were installed.
|
* in which packages were installed.
|
||||||
*/
|
*/
|
||||||
od.orphans_user = orphans_user;
|
od.orphans_user = orphans_user;
|
||||||
|
if ((rv = xbps_regpkgdb_dictionary_init(xhp)) != 0) {
|
||||||
|
xbps_dbg_printf("%s: couldn't initialize "
|
||||||
|
"regpkgdb: %s\n", strerror(rv));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
rv = xbps_callback_array_iter_reverse_in_dict(xhp->regpkgdb_dictionary,
|
rv = xbps_callback_array_iter_reverse_in_dict(xhp->regpkgdb_dictionary,
|
||||||
"packages", find_orphan_pkg, &od);
|
"packages", find_orphan_pkg, &od);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
@ -108,6 +108,11 @@ xbps_purge_packages(void)
|
|||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
xhp = xbps_handle_get();
|
xhp = xbps_handle_get();
|
||||||
|
if ((rv = xbps_regpkgdb_dictionary_init(xhp)) != 0) {
|
||||||
|
xbps_dbg_printf("%s: couldn't initialize "
|
||||||
|
"regpkgdb: %s\n", strerror(rv));
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
||||||
if (iter == NULL)
|
if (iter == NULL)
|
||||||
return errno;
|
return errno;
|
||||||
|
@ -320,12 +320,19 @@ find_pkgd_installed(const char *str, bool bypattern, bool virtual)
|
|||||||
struct xbps_handle *xhp;
|
struct xbps_handle *xhp;
|
||||||
prop_dictionary_t pkgd, rpkgd = NULL;
|
prop_dictionary_t pkgd, rpkgd = NULL;
|
||||||
pkg_state_t state = 0;
|
pkg_state_t state = 0;
|
||||||
|
int rv;
|
||||||
|
|
||||||
assert(str != NULL);
|
assert(str != NULL);
|
||||||
|
|
||||||
xhp = xbps_handle_get();
|
xhp = xbps_handle_get();
|
||||||
if (xhp->regpkgdb_dictionary == NULL)
|
if ((rv = xbps_regpkgdb_dictionary_init(xhp)) != 0) {
|
||||||
return NULL;
|
if (rv != ENOENT) {
|
||||||
|
xbps_dbg_printf("%s: couldn't initialize "
|
||||||
|
"regpkgdb: %s\n", strerror(rv));
|
||||||
|
return NULL;
|
||||||
|
} else if (rv == ENOENT)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* try normal pkg */
|
/* try normal pkg */
|
||||||
if (virtual == false) {
|
if (virtual == false) {
|
||||||
|
@ -188,9 +188,11 @@ xbps_transaction_update_packages(void)
|
|||||||
bool newpkg_found = false;
|
bool newpkg_found = false;
|
||||||
|
|
||||||
xhp = xbps_handle_get();
|
xhp = xbps_handle_get();
|
||||||
if (xhp->regpkgdb_dictionary == NULL)
|
if ((rv = xbps_regpkgdb_dictionary_init(xhp)) != 0) {
|
||||||
return ENOENT;
|
xbps_dbg_printf("%s: couldn't initialize "
|
||||||
|
"regpkgdb: %s\n", strerror(rv));
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
||||||
if (iter == NULL)
|
if (iter == NULL)
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user