libxbps: print in verbose mode what pkgs are added to the transaction.

Useful to know why a transaction cannot be completed when there are
unresolved reverse dependencies.

Requested by @chris2.
This commit is contained in:
Juan RP 2015-09-02 18:56:20 +02:00
parent 0f2543a650
commit 8081751f86
6 changed files with 16 additions and 8 deletions

View File

@ -65,6 +65,10 @@ state_cb(const struct xbps_state_cb_data *xscd, void *cbdata _unused)
case XBPS_STATE_REPOSYNC:
printf("[*] Updating `%s' ...\n", xscd->arg);
break;
case XBPS_STATE_TRANS_ADDPKG:
if (xscd->xhp->flags & XBPS_FLAG_VERBOSE)
printf("%s\n", xscd->desc);
break;
case XBPS_STATE_VERIFY:
printf("%s\n", xscd->desc);
break;

View File

@ -327,7 +327,8 @@ typedef enum xbps_state {
XBPS_STATE_SHOW_REMOVE_MSG,
XBPS_STATE_UNPACK_FILE_PRESERVED,
XBPS_STATE_PKGDB,
XBPS_STATE_PKGDB_DONE
XBPS_STATE_PKGDB_DONE,
XBPS_STATE_TRANS_ADDPKG
} xbps_state_t;
/**

View File

@ -129,7 +129,7 @@ bool HIDDEN xbps_transaction_shlibs(struct xbps_handle *, xbps_array_t,
xbps_array_t);
int HIDDEN xbps_transaction_init(struct xbps_handle *);
int HIDDEN xbps_transaction_store(struct xbps_handle *, xbps_array_t,
xbps_dictionary_t, bool);
xbps_dictionary_t, const char *, bool);
char HIDDEN *xbps_get_remote_repo_string(const char *);
int HIDDEN xbps_repo_sync(struct xbps_handle *, const char *);
int HIDDEN xbps_file_hash_check_dictionary(struct xbps_handle *,

View File

@ -330,7 +330,7 @@ find_repo_deps(struct xbps_handle *xhp,
* Package is on repo, add it into the transaction dictionary.
*/
xbps_dictionary_set_cstring_nocopy(curpkgd, "transaction", reason);
rv = xbps_transaction_store(xhp, unsorted, curpkgd, true);
rv = xbps_transaction_store(xhp, unsorted, curpkgd, reason, true);
if (rv != 0) {
xbps_dbg_printf(xhp, "xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
break;
@ -359,7 +359,7 @@ find_repo_deps(struct xbps_handle *xhp,
* Package is on repo, add it into the transaction dictionary.
*/
xbps_dictionary_set_cstring_nocopy(curpkgd, "transaction", reason);
rv = xbps_transaction_store(xhp, unsorted, curpkgd, true);
rv = xbps_transaction_store(xhp, unsorted, curpkgd, reason, true);
if (rv != 0) {
xbps_dbg_printf(xhp, "xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
break;

View File

@ -216,7 +216,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool reinstall,
free(pkgname);
return EINVAL;
}
if ((rv = xbps_transaction_store(xhp, pkgs, pkg_repod, false)) != 0) {
if ((rv = xbps_transaction_store(xhp, pkgs, pkg_repod, reason, false)) != 0) {
free(pkgname);
return rv;
}
@ -342,7 +342,7 @@ xbps_transaction_remove_pkg(struct xbps_handle *xhp,
obj = xbps_array_get(orphans, i);
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
xbps_dictionary_set_cstring_nocopy(obj, "transaction", "remove");
if ((rv = xbps_transaction_store(xhp, pkgs, obj, false)) != 0)
if ((rv = xbps_transaction_store(xhp, pkgs, obj, "remove", false)) != 0)
return EINVAL;
xbps_dbg_printf(xhp, "%s: added into transaction (remove).\n", pkgver);
}
@ -354,7 +354,7 @@ rmpkg:
*/
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
xbps_dictionary_set_cstring_nocopy(pkgd, "transaction", "remove");
if ((rv = xbps_transaction_store(xhp, pkgs, pkgd, false)) != 0)
if ((rv = xbps_transaction_store(xhp, pkgs, pkgd, "remove", false)) != 0)
return EINVAL;
xbps_dbg_printf(xhp, "%s: added into transaction (remove).\n", pkgver);
return rv;

View File

@ -32,7 +32,7 @@
int HIDDEN
xbps_transaction_store(struct xbps_handle *xhp, xbps_array_t pkgs,
xbps_dictionary_t pkgd, bool autoinst)
xbps_dictionary_t pkgd, const char *tract, bool autoinst)
{
xbps_array_t replaces;
const char *pkgver, *repo;
@ -70,6 +70,9 @@ xbps_transaction_store(struct xbps_handle *xhp, xbps_array_t pkgs,
if (!xbps_array_add(pkgs, pkgd))
return EINVAL;
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_ADDPKG, 0, pkgver,
"Found %s (%s) in repository %s", pkgver, tract, repo);
xbps_dbg_printf(xhp, "Added `%s' into the dependency list (%s)\n",
pkgver, repo);