xbps: add 4 patches from git to improve debugging and 1 bugfix.

This commit is contained in:
Juan RP 2014-03-14 12:06:04 +01:00
parent 55f20082cf
commit 4dd3eb3d71
6 changed files with 210 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 62888d310396476b54b46689da48477501490033 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 20:35:26 +0100
Subject: [PATCH 1/4] xbps_transaction_commit: add some debugging in error
paths.
---
lib/transaction_commit.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c
index dee8876..ef6b0ce 100644
--- lib/transaction_commit.c
+++ lib/transaction_commit.c
@@ -256,7 +256,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
rv = xbps_remove_pkg(xhp, pkgver, update);
if (rv != 0) {
xbps_dbg_printf(xhp, "[trans] failed to "
- "remove %s\n", pkgver);
+ "remove %s: %s\n", pkgver, strerror(rv));
goto out;
}
continue;
@@ -266,9 +266,11 @@ xbps_transaction_commit(struct xbps_handle *xhp)
* Reconfigure pending package.
*/
rv = xbps_configure_pkg(xhp, pkgver, false, false);
- if (rv != 0)
+ if (rv != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to "
+ "configure %s: %s\n", pkgver, strerror(rv));
goto out;
-
+ }
continue;
} else if (strcmp(tract, "update") == 0) {
--
1.9.0

View File

@ -0,0 +1,61 @@
From 67b5ba0dc33b5fce23202cb4c2ec6a786734c269 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 20:49:54 +0100
Subject: [PATCH 2/4] xbps_transaction_commit: add some more debugging.
---
lib/transaction_commit.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c
index ef6b0ce..4d67676 100644
--- lib/transaction_commit.c
+++ lib/transaction_commit.c
@@ -229,14 +229,20 @@ xbps_transaction_commit(struct xbps_handle *xhp)
* Download binary packages (if they come from a remote repository).
*/
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_DOWNLOAD, 0, NULL, NULL);
- if ((rv = download_binpkgs(xhp, iter)) != 0)
+ if ((rv = download_binpkgs(xhp, iter)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to download binpkgs: "
+ "%s\n", strerror(rv));
goto out;
+ }
/*
* Check binary package integrity.
*/
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_VERIFY, 0, NULL, NULL);
- if ((rv = check_binpkgs(xhp, iter)) != 0)
+ if ((rv = check_binpkgs(xhp, iter)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to check binpkgs: "
+ "%s\n", strerror(rv));
goto out;
+ }
/*
* Install, update, configure or remove packages as specified
* in the transaction dictionary.
@@ -297,13 +303,19 @@ xbps_transaction_commit(struct xbps_handle *xhp)
/*
* Unpack binary package.
*/
- if ((rv = xbps_unpack_binary_pkg(xhp, obj)) != 0)
+ if ((rv = xbps_unpack_binary_pkg(xhp, obj)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to unpack "
+ "%s: %s\n", pkgver, strerror(rv));
goto out;
+ }
/*
* Register package.
*/
- if ((rv = xbps_register_pkg(xhp, obj)) != 0)
+ if ((rv = xbps_register_pkg(xhp, obj)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to register "
+ "%s: %s\n", pkgver, strerror(rv));
goto out;
+ }
}
/* if there are no packages to install or update we are done */
if (!xbps_dictionary_get(xhp->transd, "total-update-pkgs") &&
--
1.9.0

View File

@ -0,0 +1,32 @@
From 56786ed31545f04f14174694d1ea2ca96539c55d Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 21:07:44 +0100
Subject: [PATCH 3/4] xbps_remove_pkg: misc debugging tweaks.
---
lib/package_remove.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/package_remove.c b/lib/package_remove.c
index 27d1078..1dcf750 100644
--- lib/package_remove.c
+++ lib/package_remove.c
@@ -231,13 +231,12 @@ xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update)
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
- xbps_dbg_printf(xhp, "attempting to remove %s state %d\n", pkgver, state);
-
if ((rv = xbps_pkg_state_installed(xhp, pkgname, &state)) != 0) {
- xbps_dbg_printf(xhp, "cannot find %s in pkgdb: %s\n",
+ xbps_dbg_printf(xhp, "[remove] cannot find %s in pkgdb: %s\n",
pkgver, strerror(rv));
goto out;
}
+ xbps_dbg_printf(xhp, "attempting to remove %s state %d\n", pkgver, state);
if (!update)
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE, 0, pkgver, NULL);
--
1.9.0

View File

@ -0,0 +1,76 @@
From cbbdc4c8bc41e3ec9efffd6db58eea03753bb9e4 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 21:28:31 +0100
Subject: [PATCH 4/4] xbps_configure_pkg: try to use pkgname if possible to
configure a pkg.
In pwwka's case for some reason the transaction was trying to configure
'man-pages-3.62_1' while in pkgdb there was only 'man-pages-3.55_1'.
By using the pkgname the pkg stored in pkgdb will be configured, without
caring what version it is.
---
lib/package_configure.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/package_configure.c b/lib/package_configure.c
index 9eba42c..8608e79 100644
--- lib/package_configure.c
+++ lib/package_configure.c
@@ -87,13 +87,25 @@ xbps_configure_pkg(struct xbps_handle *xhp,
assert(pkgver != NULL);
- pkgd = xbps_pkgdb_get_pkg(xhp, pkgver);
- if (pkgd == NULL)
+ if ((pkgname = xbps_pkg_name(pkgver)) == NULL) {
+ xbps_dbg_printf(xhp, "[configure] cannot guess "
+ "pkgname for %s\n", pkgver);
+ /* assume pkgver == pkgname */
+ pkgname = strdup(pkgver);
+ assert(pkgname);
+ }
+ pkgd = xbps_pkgdb_get_pkg(xhp, pkgname);
+ if (pkgd == NULL) {
+ free(pkgname);
+ xbps_dbg_printf(xhp, "[configure] cannot find %s (%s) "
+ "in pkgdb\n", pkgname, pkgver);
return ENOENT;
+ }
rv = xbps_pkg_state_dictionary(pkgd, &state);
xbps_dbg_printf(xhp, "%s: state %d rv %d\n", pkgver, state, rv);
if (rv != 0) {
+ free(pkgname);
xbps_dbg_printf(xhp, "%s: [configure] failed to get "
"pkg state: %s\n", pkgver, strerror(rv));
return EINVAL;
@@ -101,19 +113,18 @@ xbps_configure_pkg(struct xbps_handle *xhp,
if (check_state) {
if (state == XBPS_PKG_STATE_INSTALLED) {
- if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0)
+ if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0) {
+ free(pkgname);
return 0;
- } else if (state != XBPS_PKG_STATE_UNPACKED)
+ }
+ } else if (state != XBPS_PKG_STATE_UNPACKED) {
+ free(pkgname);
return EINVAL;
+ }
}
xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE, 0, pkgver, NULL);
- /* internalize pkg dictionary from metadir */
- pkgname = xbps_pkg_name(pkgver);
- if (pkgname == NULL) /* assume pkgname */
- pkgname = strdup(pkgver);
-
plist = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname);
free(pkgname);
--
1.9.0

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.33
revision=2
revision=3
bootstrap=yes
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"