Fix #28 (Verification fails due to missing signature).
This commit is contained in:
parent
5eea259c13
commit
e9bc52a01b
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
|||||||
xbps-0.30 (??):
|
xbps-0.30 (??):
|
||||||
|
|
||||||
|
* Fixed issue #28: https://github.com/voidlinux/xbps/issues/28
|
||||||
|
|
||||||
* When reinstalling a package (or downgrading) also check for obsolete
|
* When reinstalling a package (or downgrading) also check for obsolete
|
||||||
files and remove them if it's needed.
|
files and remove them if it's needed.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2009-2013 Juan Romero Pardines.
|
* Copyright (c) 2009-2014 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -125,7 +125,7 @@ download_binpkgs(struct xbps_handle *xhp, xbps_object_iterator_t iter)
|
|||||||
{
|
{
|
||||||
xbps_object_t obj;
|
xbps_object_t obj;
|
||||||
const char *pkgver, *arch, *fetchstr, *repoloc, *trans;
|
const char *pkgver, *arch, *fetchstr, *repoloc, *trans;
|
||||||
char *binfile, *sigfile;
|
char *file, *sigfile;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
while ((obj = xbps_object_iterator_next(iter)) != NULL) {
|
while ((obj = xbps_object_iterator_next(iter)) != NULL) {
|
||||||
@ -134,57 +134,55 @@ download_binpkgs(struct xbps_handle *xhp, xbps_object_iterator_t iter)
|
|||||||
(strcmp(trans, "configure") == 0))
|
(strcmp(trans, "configure") == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
xbps_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
|
||||||
xbps_dictionary_get_cstring_nocopy(obj, "repository", &repoloc);
|
xbps_dictionary_get_cstring_nocopy(obj, "repository", &repoloc);
|
||||||
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
if (!xbps_repository_is_remote(repoloc))
|
||||||
|
continue;
|
||||||
|
|
||||||
binfile = xbps_repository_pkg_path(xhp, obj);
|
xbps_dictionary_get_cstring_nocopy(obj, "pkgver", &pkgver);
|
||||||
if (binfile == NULL) {
|
xbps_dictionary_get_cstring_nocopy(obj, "architecture", &arch);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Download binary package.
|
||||||
|
*/
|
||||||
|
if ((file = xbps_repository_pkg_path(xhp, obj)) == NULL) {
|
||||||
rv = EINVAL;
|
rv = EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
if (access(file, R_OK) == -1) {
|
||||||
* If binary package is in cachedir or in a local repository, continue.
|
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD, 0, pkgver,
|
||||||
*/
|
"Downloading `%s' package (from `%s')...", pkgver, repoloc);
|
||||||
if (access(binfile, R_OK) == 0) {
|
if (xbps_fetch_file(xhp, file, NULL) == -1) {
|
||||||
free(binfile);
|
fetchstr = xbps_fetch_error_string();
|
||||||
continue;
|
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD_FAIL,
|
||||||
}
|
fetchLastErrCode != 0 ? fetchLastErrCode : errno,
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD, 0, pkgver,
|
pkgver, "[trans] failed to download `%s' package from `%s': %s",
|
||||||
"Downloading `%s' package (from `%s')...", pkgver, repoloc);
|
pkgver, repoloc, fetchstr ? fetchstr : strerror(errno));
|
||||||
/*
|
free(file);
|
||||||
* Fetch binary package.
|
break;
|
||||||
*/
|
}
|
||||||
rv = xbps_fetch_file(xhp, binfile, NULL);
|
|
||||||
if (rv == -1) {
|
|
||||||
fetchstr = xbps_fetch_error_string();
|
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD_FAIL,
|
|
||||||
fetchLastErrCode != 0 ? fetchLastErrCode : errno,
|
|
||||||
pkgver, "[trans] failed to download `%s' package from `%s': %s",
|
|
||||||
pkgver, repoloc, fetchstr ? fetchstr : strerror(errno));
|
|
||||||
free(binfile);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Fetch package signature.
|
* Download binary package signature.
|
||||||
*/
|
*/
|
||||||
sigfile = xbps_xasprintf("%s.sig", binfile);
|
sigfile = xbps_xasprintf("%s.sig", file);
|
||||||
free(binfile);
|
free(file);
|
||||||
|
if (access(sigfile, R_OK) == -1) {
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD, 0, pkgver,
|
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD, 0, pkgver,
|
||||||
"Downloading `%s' signature (from `%s')...", pkgver, repoloc);
|
"Downloading `%s' signature (from `%s')...", pkgver, repoloc);
|
||||||
rv = xbps_fetch_file(xhp, sigfile, NULL);
|
file = xbps_xasprintf("%s/%s.%s.xbps.sig", repoloc, pkgver, arch);
|
||||||
if (rv == -1) {
|
if (xbps_fetch_file(xhp, file, NULL) == -1) {
|
||||||
fetchstr = xbps_fetch_error_string();
|
fetchstr = xbps_fetch_error_string();
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD_FAIL,
|
xbps_set_cb_state(xhp, XBPS_STATE_DOWNLOAD_FAIL,
|
||||||
fetchLastErrCode != 0 ? fetchLastErrCode : errno,
|
fetchLastErrCode != 0 ? fetchLastErrCode : errno,
|
||||||
pkgver, "[trans] failed to download `%s' signature from `%s': %s",
|
pkgver, "[trans] failed to download `%s' signature from `%s': %s",
|
||||||
pkgver, repoloc, fetchstr ? fetchstr : strerror(errno));
|
pkgver, repoloc, fetchstr ? fetchstr : strerror(errno));
|
||||||
free(sigfile);
|
free(sigfile);
|
||||||
break;
|
free(file);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rv = 0;
|
|
||||||
free(sigfile);
|
free(sigfile);
|
||||||
|
free(file);
|
||||||
}
|
}
|
||||||
xbps_object_iterator_reset(iter);
|
xbps_object_iterator_reset(iter);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user