Show a proper error message if download of a binpkg fails in a transaction.

This commit is contained in:
Juan RP 2012-05-06 09:09:09 +02:00
parent 8c8f6d32f1
commit 8a4b143bf3
2 changed files with 6 additions and 4 deletions

View File

@ -56,7 +56,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.4" #define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120412" #define XBPS_API_VERSION "20120506"
#define XBPS_VERSION "0.16" #define XBPS_VERSION "0.16"
/** /**

View File

@ -111,7 +111,7 @@ download_binpkgs(struct xbps_handle *xhp, prop_object_iterator_t iter)
{ {
prop_object_t obj; prop_object_t obj;
const char *pkgver, *repoloc, *filen, *trans; const char *pkgver, *repoloc, *filen, *trans;
const char *pkgname, *version; const char *pkgname, *version, *fetchstr;
char *binfile; char *binfile;
int rv = 0; int rv = 0;
@ -163,11 +163,13 @@ download_binpkgs(struct xbps_handle *xhp, prop_object_iterator_t iter)
*/ */
rv = xbps_fetch_file(binfile, xhp->cachedir, false, NULL); rv = xbps_fetch_file(binfile, xhp->cachedir, false, NULL);
if (rv == -1) { if (rv == -1) {
fetchstr = xbps_fetch_error_string();
xbps_set_cb_state(XBPS_STATE_DOWNLOAD_FAIL, xbps_set_cb_state(XBPS_STATE_DOWNLOAD_FAIL,
errno, pkgname, version, fetchLastErrCode != 0 ? fetchLastErrCode : errno,
pkgname, version,
"%s: [trans] failed to download binary package " "%s: [trans] failed to download binary package "
"`%s' from `%s': %s", pkgver, filen, repoloc, "`%s' from `%s': %s", pkgver, filen, repoloc,
strerror(errno)); fetchstr ? fetchstr : strerror(errno));
free(binfile); free(binfile);
break; break;
} }