mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
dload: rename payload->filename to payload->remote_name
This is a far more accurate description of what this is, since it's more than likely not really a filename at all, but the name after a final slash on a URL. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
eae363c96f
commit
43940f591e
@ -101,10 +101,10 @@ static int curl_progress(void *file, double dltotal, double dlnow,
|
||||
/* initialize the progress bar here to avoid displaying it when
|
||||
* a repo is up to date and nothing gets downloaded */
|
||||
if(DOUBLE_EQ(prevprogress, 0)) {
|
||||
payload->handle->dlcb(payload->filename, 0, (long)dltotal);
|
||||
payload->handle->dlcb(payload->remote_name, 0, (long)dltotal);
|
||||
}
|
||||
|
||||
payload->handle->dlcb(payload->filename, (long)current_size, (long)total_size);
|
||||
payload->handle->dlcb(payload->remote_name, (long)current_size, (long)total_size);
|
||||
|
||||
prevprogress = current_size;
|
||||
|
||||
@ -196,17 +196,17 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
alpm_handle_t *handle = payload->handle;
|
||||
handle->pm_errno = 0;
|
||||
|
||||
if(!payload->filename) {
|
||||
payload->filename = get_filename(payload->fileurl);
|
||||
if(!payload->remote_name) {
|
||||
payload->remote_name = get_filename(payload->fileurl);
|
||||
}
|
||||
if(!payload->filename || curl_gethost(payload->fileurl, hostname) != 0) {
|
||||
if(!payload->remote_name || curl_gethost(payload->fileurl, hostname) != 0) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
|
||||
RET_ERR(handle, ALPM_ERR_SERVER_BAD_URL, -1);
|
||||
}
|
||||
|
||||
if(strlen(payload->filename) > 0 && strcmp(payload->filename, ".sig") != 0) {
|
||||
destfile = get_fullpath(localpath, payload->filename, "");
|
||||
tempfile = get_fullpath(localpath, payload->filename, ".part");
|
||||
if(strlen(payload->remote_name) > 0 && strcmp(payload->remote_name, ".sig") != 0) {
|
||||
destfile = get_fullpath(localpath, payload->remote_name, "");
|
||||
tempfile = get_fullpath(localpath, payload->remote_name, ".part");
|
||||
if(!destfile || !tempfile) {
|
||||
goto cleanup;
|
||||
}
|
||||
@ -230,7 +230,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
}
|
||||
/* localf now points to our alpmtmp.XXXXXX */
|
||||
STRDUP(tempfile, randpath, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
payload->filename = strrchr(randpath, '/') + 1;
|
||||
payload->remote_name = strrchr(randpath, '/') + 1;
|
||||
}
|
||||
|
||||
error_buffer[0] = '\0';
|
||||
@ -322,10 +322,10 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
if(!payload->errors_ok) {
|
||||
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
||||
payload->filename, hostname, error_buffer);
|
||||
payload->remote_name, hostname, error_buffer);
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "failed retrieving file '%s' from %s : %s\n",
|
||||
payload->filename, hostname, error_buffer);
|
||||
payload->remote_name, hostname, error_buffer);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
@ -352,7 +352,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
!DOUBLE_EQ(bytes_dl, remote_size)) {
|
||||
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"),
|
||||
payload->filename, (intmax_t)bytes_dl, (intmax_t)remote_size);
|
||||
payload->remote_name, (intmax_t)bytes_dl, (intmax_t)remote_size);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
struct dload_payload {
|
||||
alpm_handle_t *handle;
|
||||
const char *filename;
|
||||
const char *remote_name;
|
||||
char *cd_filename;
|
||||
char *fileurl;
|
||||
double initial_size;
|
||||
|
@ -810,7 +810,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||
struct dload_payload *dpayload;
|
||||
|
||||
CALLOC(dpayload, 1, sizeof(*dpayload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
STRDUP(dpayload->filename, delta->delta, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
STRDUP(dpayload->remote_name, delta->delta, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
dpayload->max_size = delta->download_size;
|
||||
|
||||
files = alpm_list_add(files, dpayload);
|
||||
@ -824,7 +824,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||
|
||||
ASSERT(spkg->filename != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1));
|
||||
CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
STRDUP(payload->filename, spkg->filename, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
STRDUP(payload->remote_name, spkg->filename, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
payload->max_size = alpm_pkg_get_size(spkg);
|
||||
|
||||
files = alpm_list_add(files, payload);
|
||||
@ -844,9 +844,9 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||
size_t len;
|
||||
|
||||
/* print server + filename into a buffer */
|
||||
len = strlen(server_url) + strlen(payload->filename) + 2;
|
||||
len = strlen(server_url) + strlen(payload->remote_name) + 2;
|
||||
CALLOC(payload->fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(payload->fileurl, len, "%s/%s", server_url, payload->filename);
|
||||
snprintf(payload->fileurl, len, "%s/%s", server_url, payload->remote_name);
|
||||
payload->handle = handle;
|
||||
payload->allow_resume = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user