summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-11-03 04:56:02 +0100
committerAaron Griffin <aaron@archlinux.org>2006-11-03 04:56:02 +0100
commit9b4aabdb0f0906f9cc2f38954d048d5e917db093 (patch)
tree11b7ed31ef8728f85f800fd0daa4bafc0c532324 /src
parentfbf1aa653984be4a15714a0efe3acf756daf2d57 (diff)
downloadpacman-9b4aabdb0f0906f9cc2f38954d048d5e917db093.tar.gz
pacman-9b4aabdb0f0906f9cc2f38954d048d5e917db093.tar.xz
* 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)
Diffstat (limited to 'src')
-rw-r--r--src/pacman/log.c25
-rw-r--r--src/pacman/pacman.c1
-rw-r--r--src/pacman/sync.c4
3 files changed, 19 insertions, 11 deletions
diff --git a/src/pacman/log.c b/src/pacman/log.c
index 17d6965a..67b69324 100644
--- a/src/pacman/log.c
+++ b/src/pacman/log.c
@@ -75,16 +75,21 @@ void cb_log(unsigned short level, char *msg)
}
#ifdef PACMAN_DEBUG
- time_t t;
- struct tm *tmp;
- char timestr[10] = {0};
-
- t = time(NULL);
- tmp = localtime(&t);
- strftime(timestr, 9, "%H:%M:%S", tmp);
- timestr[8] = '\0';
-
- MSG(NL, "[%s] %s: %s\n", timestr, str, msg);
+ /* If debug is on, we'll timestamp the output */
+ if(config->debug&PM_LOG_DEBUG) {
+ time_t t;
+ struct tm *tmp;
+ char timestr[10] = {0};
+
+ t = time(NULL);
+ tmp = localtime(&t);
+ strftime(timestr, 9, "%H:%M:%S", tmp);
+ timestr[8] = '\0';
+
+ MSG(NL, "[%s] %s: %s\n", timestr, str, msg);
+ } else {
+ MSG(NL, "%s: %s\n", str, msg);
+ }
#else
MSG(NL, "%s: %s\n", str, msg);
#endif
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index d35c8be0..9259cf9d 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -455,6 +455,7 @@ int main(int argc, char *argv[])
/* init config data */
config = config_new();
config->op = PM_OP_MAIN;
+ config->debug |= PM_LOG_ERROR;
config->debug |= PM_LOG_WARNING;
/* disable progressbar if the output is redirected */
if(!isatty(1)) {
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 1d1ea29d..113e1675 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -175,6 +175,7 @@ static int sync_synctree(int level, list_t *syncs)
}
} else if(ret == 1) {
MSG(NL, _(" %s is up to date\n"), sync->treename);
+ success++;
} else {
success++;
}
@@ -376,7 +377,8 @@ int pacman_sync(list_t *targets)
/* grab a fresh package list */
MSG(NL, _(":: Synchronizing package databases...\n"));
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);
}
}