Major API/ABI cleanup bringing performance improvements and fixes.

These are the core interfaces in the new API:

rpool - Interface to interact with the repository pool.
rindex - Interface to interact with repository indexes.
pkgdb - Interface to interact with local packages.
transaction - Interface to interact with a transaction.

This also brings new repository index format, making the index file
per architecture and being incompatible with previous versions.

The transaction frequency flush option has been removed, and due to
the nature of package states it was causing more harm than good.

More changes coming soon, but the API shall remain stable from now on.
This commit is contained in:
Juan RP
2012-11-30 07:11:51 +01:00
parent 16e18313da
commit 63c1883201
57 changed files with 1437 additions and 2640 deletions

View File

@@ -101,11 +101,10 @@ check_pkg_integrity(struct xbps_handle *xhp,
/* find real pkg by name */
opkgd = pkgd;
if (pkgd == NULL) {
opkgd = xbps_find_pkg_dict_installed(xhp, pkgname, false);
opkgd = xbps_pkgdb_get_pkg(xhp, pkgname);
if (opkgd == NULL) {
/* find virtual pkg by name */
opkgd = xbps_find_virtualpkg_dict_installed(xhp,
pkgname, false);
opkgd = xbps_pkgdb_get_virtualpkg(xhp, pkgname);
}
if (opkgd == NULL) {
printf("Package %s is not installed.\n", pkgname);
@@ -115,7 +114,7 @@ check_pkg_integrity(struct xbps_handle *xhp,
/*
* Check for props.plist metadata file.
*/
propsd = xbps_metadir_get_pkgd(xhp, pkgname);
propsd = xbps_pkgdb_get_pkg_metadata(xhp, pkgname);
if (propsd == NULL) {
printf("%s: unexistent metafile, converting to 0.18 "
"format...\n", pkgname);

View File

@@ -59,7 +59,7 @@ check_reqby_pkg_cb(struct xbps_handle *xhp,
* Internalize current pkg props dictionary from its
* installed metadata directory.
*/
curpkg_propsd = xbps_metadir_get_pkgd(xhp, curpkgn);
curpkg_propsd = xbps_pkgdb_get_pkg_metadata(xhp, curpkgn);
if (curpkg_propsd == NULL) {
xbps_error_printf("%s: missing %s metadata file!\n",
curpkgn, XBPS_PKGPROPS);
@@ -138,26 +138,24 @@ remove_stale_entries_in_reqby(struct xbps_handle *xhp, prop_dictionary_t pkgd)
char *str;
size_t i;
prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
again:
reqby = prop_dictionary_get(pkgd, "requiredby");
if (reqby == NULL || prop_array_count(reqby) == 0)
return;
prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
for (i = 0; i < prop_array_count(reqby); i++) {
prop_array_get_cstring(reqby, i, &str);
if ((pkgd = xbps_pkgdb_get_pkgd_by_pkgver(xhp, str)) != NULL)
if ((pkgd = xbps_pkgdb_get_pkg(xhp, str)) != NULL)
continue;
if (!xbps_remove_string_from_array(xhp, reqby, str))
fprintf(stderr, "%s: failed to remove %s from "
"requiredby!\n", pkgver, str);
else
printf("%s: removed stale entry in requiredby `%s'\n",
pkgver, str);
prop_array_remove(reqby, i);
printf("%s: removed stale entry in requiredby `%s'\n",
pkgver, str);
prop_dictionary_set(pkgd, "requiredby", reqby);
free(str);
goto again;
}
}

View File

@@ -48,30 +48,22 @@ int
check_pkg_rundeps(struct xbps_handle *xhp, const char *pkgname, void *arg)
{
prop_dictionary_t pkg_propsd = arg;
prop_object_t obj;
prop_object_iterator_t iter;
prop_array_t array;
size_t i;
const char *reqpkg;
bool test_broken = false;
if (!xbps_pkg_has_rundeps(pkg_propsd))
return 0;
iter = xbps_array_iter_from_dict(pkg_propsd, "run_depends");
if (iter == NULL)
return -1;
while ((obj = prop_object_iterator_next(iter))) {
reqpkg = prop_string_cstring_nocopy(obj);
if (reqpkg == NULL) {
prop_object_iterator_release(iter);
return -1;
}
if (xbps_check_is_installed_pkg_by_pattern(xhp, reqpkg) <= 0) {
array = prop_dictionary_get(pkg_propsd, "run_depends");
for (i = 0; i < prop_array_count(array); i++) {
prop_array_get_cstring_nocopy(array, i, &reqpkg);
if (xbps_pkg_is_installed(xhp, reqpkg) <= 0) {
xbps_error_printf("%s: dependency not satisfied: %s\n",
pkgname, reqpkg);
test_broken = true;
}
}
prop_object_iterator_release(iter);
return test_broken;
}