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
+4 -12
View File
@@ -45,22 +45,14 @@ bool yesno(const char *, ...);
bool noyes(const char *, ...);
/* from fetch_cb.c */
void fetch_file_progress_cb(struct xbps_handle *,
struct xbps_fetch_cb_data *,
void *);
void fetch_file_progress_cb(struct xbps_fetch_cb_data *, void *);
/* from state_cb.c */
void state_cb(struct xbps_handle *,
struct xbps_state_cb_data *,
void *);
void state_cb(struct xbps_state_cb_data *, void *);
/* from unpack_cb.c */
void unpack_progress_cb_verbose(struct xbps_handle *,
struct xbps_unpack_cb_data *,
void *);
void unpack_progress_cb(struct xbps_handle *,
struct xbps_unpack_cb_data *,
void *);
void unpack_progress_cb_verbose(struct xbps_unpack_cb_data *, void *);
void unpack_progress_cb(struct xbps_unpack_cb_data *, void *);
/* From util.c */
void print_package_line(const char *, size_t, bool);
+1 -5
View File
@@ -150,15 +150,11 @@ stat_display(struct xbps_fetch_cb_data *xfpd, void *cbdata)
}
void
fetch_file_progress_cb(struct xbps_handle *xhp,
struct xbps_fetch_cb_data *xfpd,
void *cbdata)
fetch_file_progress_cb(struct xbps_fetch_cb_data *xfpd, void *cbdata)
{
struct xferstat *xfer = cbdata;
char size[8];
(void)xhp;
if (xfpd->cb_start) {
/* start transfer stats */
get_time(&xfer->start);
+8 -10
View File
@@ -31,9 +31,7 @@
#include "defs.h"
void
state_cb(struct xbps_handle *xhp,
struct xbps_state_cb_data *xscd,
void *cbdata)
state_cb(struct xbps_state_cb_data *xscd, void *cbdata)
{
prop_dictionary_t pkgd;
const char *version;
@@ -41,7 +39,7 @@ state_cb(struct xbps_handle *xhp,
(void)cbdata;
if (xhp->flags & XBPS_FLAG_SYSLOG) {
if (xscd->xhp->flags & XBPS_FLAG_SYSLOG) {
syslog_enabled = true;
openlog("xbps-install", LOG_CONS, LOG_USER);
}
@@ -88,7 +86,7 @@ state_cb(struct xbps_handle *xhp,
/* empty */
break;
case XBPS_STATE_UPDATE:
pkgd = xbps_find_pkg_dict_installed(xhp, xscd->arg0, false);
pkgd = xbps_pkgdb_get_pkg(xscd->xhp, xscd->arg0);
prop_dictionary_get_cstring_nocopy(pkgd, "version", &version);
printf("%s-%s: updating to %s ...\n", xscd->arg0,
version, xscd->arg1);
@@ -96,7 +94,7 @@ state_cb(struct xbps_handle *xhp,
/* success */
case XBPS_STATE_REMOVE_FILE:
case XBPS_STATE_REMOVE_FILE_OBSOLETE:
if (xhp->flags & XBPS_FLAG_VERBOSE)
if (xscd->xhp->flags & XBPS_FLAG_VERBOSE)
printf("%s\n", xscd->desc);
else {
printf("%s\n", xscd->desc);
@@ -109,7 +107,7 @@ state_cb(struct xbps_handle *xhp,
if (syslog_enabled)
syslog(LOG_NOTICE, "Installed `%s-%s' successfully "
"(rootdir: %s).", xscd->arg0, xscd->arg1,
xhp->rootdir);
xscd->xhp->rootdir);
break;
case XBPS_STATE_UPDATE_DONE:
printf("%s-%s: updated successfully.\n",
@@ -117,7 +115,7 @@ state_cb(struct xbps_handle *xhp,
if (syslog_enabled)
syslog(LOG_NOTICE, "Updated `%s' to `%s' successfully "
"(rootdir: %s).", xscd->arg0, xscd->arg1,
xhp->rootdir);
xscd->xhp->rootdir);
break;
case XBPS_STATE_REMOVE_DONE:
printf("%s-%s: removed successfully.\n",
@@ -125,7 +123,7 @@ state_cb(struct xbps_handle *xhp,
if (syslog_enabled)
syslog(LOG_NOTICE, "Removed `%s-%s' successfully "
"(rootdir: %s).", xscd->arg0, xscd->arg1,
xhp->rootdir);
xscd->xhp->rootdir);
break;
/* errors */
case XBPS_STATE_UNPACK_FAIL:
@@ -154,7 +152,7 @@ state_cb(struct xbps_handle *xhp,
syslog(LOG_ERR, "%s", xscd->desc);
break;
default:
xbps_dbg_printf(xhp,
xbps_dbg_printf(xscd->xhp,
"unknown state %d\n", xscd->state);
break;
}
+2 -8
View File
@@ -30,11 +30,8 @@
#include "defs.h"
void
unpack_progress_cb_verbose(struct xbps_handle *xhp,
struct xbps_unpack_cb_data *xpd,
void *cbdata)
unpack_progress_cb_verbose(struct xbps_unpack_cb_data *xpd, void *cbdata)
{
(void)xhp;
(void)cbdata;
if (xpd->entry == NULL || xpd->entry_total_count <= 0)
@@ -47,11 +44,8 @@ unpack_progress_cb_verbose(struct xbps_handle *xhp,
}
void
unpack_progress_cb(struct xbps_handle *xhp,
struct xbps_unpack_cb_data *xpd,
void *cbdata)
unpack_progress_cb(struct xbps_unpack_cb_data *xpd, void *cbdata)
{
(void)xhp;
(void)cbdata;
if (xpd->entry_total_count <= 0)