Introduce XBPS_STATE_CONFIGURE_DONE and use it in xbps-reconfigure(8).

This commit is contained in:
Juan RP 2013-03-07 09:24:04 +01:00
parent 37263d63c9
commit 90b6803825
4 changed files with 16 additions and 3 deletions

View File

@ -79,6 +79,7 @@ state_cb(struct xbps_state_cb_data *xscd, void *cbdata)
case XBPS_STATE_XBPS_UPDATE:
case XBPS_STATE_REGISTER:
case XBPS_STATE_UNREGISTER:
case XBPS_STATE_CONFIGURE_DONE:
/* empty */
break;
case XBPS_STATE_UNPACK:

View File

@ -69,6 +69,12 @@ state_cb(struct xbps_state_cb_data *xscd, void *cbd)
if (syslog_enabled)
syslog(LOG_NOTICE, "%s: configuring ...", xscd->arg);
break;
case XBPS_STATE_CONFIGURE_DONE:
printf("%s: configured successfully.\n", xscd->arg);
if (syslog_enabled)
syslog(LOG_NOTICE,
"%s: configured successfully.", xscd->arg);
break;
/* errors */
case XBPS_STATE_CONFIGURE_FAIL:
xbps_error_printf("%s\n", xscd->desc);

View File

@ -48,7 +48,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.7"
#define XBPS_API_VERSION "20130305"
#define XBPS_API_VERSION "20130307"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@ -231,6 +231,7 @@ extern "C" {
* - XBPS_STATE_UPDATE_DONE: a package has been updated successfully.
* - XBPS_STATE_UNPACK: a package is being unpacked.
* - XBPS_STATE_CONFIGURE: a package is being configured.
* - XBPS_STATE_CONFIGURE_DONE: a package has been configured successfully.
* - XBPS_STATE_CONFIG_FILE: a package configuration file is being processed.
* - XBPS_STATE_REGISTER: a package is being registered.
* - XBPS_STATE_UNREGISTER: a package is being unregistered.
@ -292,7 +293,8 @@ typedef enum xbps_state {
XBPS_STATE_REGISTER_FAIL,
XBPS_STATE_UNREGISTER_FAIL,
XBPS_STATE_REPOSYNC_FAIL,
XBPS_STATE_XBPS_UPDATE
XBPS_STATE_XBPS_UPDATE,
XBPS_STATE_CONFIGURE_DONE
} xbps_state_t;
/**

View File

@ -72,7 +72,7 @@ xbps_configure_packages(struct xbps_handle *xhp, bool flush)
}
prop_object_iterator_release(iter);
if (flush)
if ((rv == 0) && flush)
rv = xbps_pkgdb_update(xhp, true);
return rv;
@ -152,6 +152,7 @@ xbps_configure_pkg(struct xbps_handle *xhp,
xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE_FAIL, rv,
pkgver, "%s: [configure] failed to set state to installed: %s",
pkgver, strerror(rv));
return rv;
}
if (flush) {
if ((rv = xbps_pkgdb_update(xhp, true)) != 0) {
@ -162,5 +163,8 @@ xbps_configure_pkg(struct xbps_handle *xhp,
}
prop_object_release(pkgmetad);
if (rv == 0)
xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE_DONE, 0, pkgver, NULL);
return rv;
}