mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-06 19:38:03 -05:00
* Modified some error output and logging
* Changed the initial log mask (added PM_LOG_ERROR) * Fixed -Syu so it now works if any databases were downloaded (it was working like a -Su)
This commit is contained in:
parent
fbf1aa6539
commit
9b4aabdb0f
@ -22,7 +22,7 @@
|
|||||||
#define _ALPM_ERROR_H
|
#define _ALPM_ERROR_H
|
||||||
|
|
||||||
#define RET_ERR(err, ret) do { pm_errno = (err); \
|
#define RET_ERR(err, ret) do { pm_errno = (err); \
|
||||||
_alpm_log(PM_LOG_ERROR, _("returning error %d: %s\n"), err, alpm_strerror(err)); \
|
_alpm_log(PM_LOG_DEBUG, _("returning error %d: %s\n"), err, alpm_strerror(err)); \
|
||||||
return(ret); } while(0)
|
return(ret); } while(0)
|
||||||
|
|
||||||
#endif /* _ALPM_ERROR_H */
|
#endif /* _ALPM_ERROR_H */
|
||||||
|
@ -181,9 +181,8 @@ int _alpm_downloadfiles_forreal(pmlist_t *servers, const char *localpath,
|
|||||||
dlf = fetchXGet(server->s_url, &ust, (handle->nopassiveftp ? "" : "p"));
|
dlf = fetchXGet(server->s_url, &ust, (handle->nopassiveftp ? "" : "p"));
|
||||||
}
|
}
|
||||||
if(fetchLastErrCode != 0 || dlf == NULL) {
|
if(fetchLastErrCode != 0 || dlf == NULL) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from '%s://%s%s', %d : %s"), fn,
|
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s://%s: %s"), fn,
|
||||||
server->s_url->scheme, server->s_url->host, server->s_url->doc, fetchLastErrCode,
|
server->s_url->scheme, server->s_url->host, fetchLastErrString);
|
||||||
fetchLastErrString);
|
|
||||||
if(localf != NULL) {
|
if(localf != NULL) {
|
||||||
fclose(localf);
|
fclose(localf);
|
||||||
}
|
}
|
||||||
|
@ -75,16 +75,21 @@ void cb_log(unsigned short level, char *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PACMAN_DEBUG
|
#ifdef PACMAN_DEBUG
|
||||||
time_t t;
|
/* If debug is on, we'll timestamp the output */
|
||||||
struct tm *tmp;
|
if(config->debug&PM_LOG_DEBUG) {
|
||||||
char timestr[10] = {0};
|
time_t t;
|
||||||
|
struct tm *tmp;
|
||||||
|
char timestr[10] = {0};
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
tmp = localtime(&t);
|
tmp = localtime(&t);
|
||||||
strftime(timestr, 9, "%H:%M:%S", tmp);
|
strftime(timestr, 9, "%H:%M:%S", tmp);
|
||||||
timestr[8] = '\0';
|
timestr[8] = '\0';
|
||||||
|
|
||||||
MSG(NL, "[%s] %s: %s\n", timestr, str, msg);
|
MSG(NL, "[%s] %s: %s\n", timestr, str, msg);
|
||||||
|
} else {
|
||||||
|
MSG(NL, "%s: %s\n", str, msg);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
MSG(NL, "%s: %s\n", str, msg);
|
MSG(NL, "%s: %s\n", str, msg);
|
||||||
#endif
|
#endif
|
||||||
|
@ -455,6 +455,7 @@ int main(int argc, char *argv[])
|
|||||||
/* init config data */
|
/* init config data */
|
||||||
config = config_new();
|
config = config_new();
|
||||||
config->op = PM_OP_MAIN;
|
config->op = PM_OP_MAIN;
|
||||||
|
config->debug |= PM_LOG_ERROR;
|
||||||
config->debug |= PM_LOG_WARNING;
|
config->debug |= PM_LOG_WARNING;
|
||||||
/* disable progressbar if the output is redirected */
|
/* disable progressbar if the output is redirected */
|
||||||
if(!isatty(1)) {
|
if(!isatty(1)) {
|
||||||
|
@ -175,6 +175,7 @@ static int sync_synctree(int level, list_t *syncs)
|
|||||||
}
|
}
|
||||||
} else if(ret == 1) {
|
} else if(ret == 1) {
|
||||||
MSG(NL, _(" %s is up to date\n"), sync->treename);
|
MSG(NL, _(" %s is up to date\n"), sync->treename);
|
||||||
|
success++;
|
||||||
} else {
|
} else {
|
||||||
success++;
|
success++;
|
||||||
}
|
}
|
||||||
@ -376,7 +377,8 @@ int pacman_sync(list_t *targets)
|
|||||||
/* grab a fresh package list */
|
/* grab a fresh package list */
|
||||||
MSG(NL, _(":: Synchronizing package databases...\n"));
|
MSG(NL, _(":: Synchronizing package databases...\n"));
|
||||||
alpm_logaction(_("synchronizing package lists"));
|
alpm_logaction(_("synchronizing package lists"));
|
||||||
if(sync_synctree(config->op_s_sync, pmc_syncs)) {
|
if(!sync_synctree(config->op_s_sync, pmc_syncs)) {
|
||||||
|
ERR(NL, _("failed to synchronize any databases"));
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user