From 0686fec8399e01adacd1633d6ad624ee2d5b6d9c Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Sun, 4 Nov 2007 20:53:34 +0100 Subject: Remove the newline automatically added by alpm_logaction. This way, _alpm_logaction behaves like _alpm_log, and gives more control. Signed-off-by: Chantry Xavier --- lib/libalpm/add.c | 26 +++++++++++++------------- lib/libalpm/trans.c | 2 +- lib/libalpm/util.c | 5 ++--- src/pacman/callback.c | 6 +++--- src/pacman/sync.c | 4 ++-- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index a76f0266..277293f6 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -348,7 +348,7 @@ static int extract_single_file(struct archive *archive, if(alpm_list_find_str(handle->noextract, entryname)) { _alpm_log(PM_LOG_DEBUG, "%s is in NoExtract, skipping extraction\n", entryname); - alpm_logaction("note: %s is in NoExtract, skipping extraction", + alpm_logaction("note: %s is in NoExtract, skipping extraction\n", entryname); archive_read_data_skip(archive); return(0); @@ -397,7 +397,7 @@ static int extract_single_file(struct archive *archive, "filesystem: %o package: %o\n"), entryname, lsbuf.st_mode & mask, entrymode & mask); alpm_logaction("warning: directory permissions differ on %s\n" - "filesystem: %o package: %o", entryname, lsbuf.st_mode & mask, + "filesystem: %o package: %o\n", entryname, lsbuf.st_mode & mask, entrymode & mask); } _alpm_log(PM_LOG_DEBUG, "extract: skipping dir extraction of %s\n", @@ -482,7 +482,7 @@ static int extract_single_file(struct archive *archive, } else if(ret != ARCHIVE_OK) { _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"), entryname, archive_error_string(archive)); - alpm_logaction("error: could not extract %s (%s)", + alpm_logaction("error: could not extract %s (%s)\n", entryname, archive_error_string(archive)); unlink(tempfile); FREE(hash_orig); @@ -532,19 +532,19 @@ static int extract_single_file(struct archive *archive, if(rename(filename, newpath)) { archive_entry_set_pathname(entry, filename); _alpm_log(PM_LOG_ERROR, _("could not rename %s (%s)\n"), filename, strerror(errno)); - alpm_logaction("error: could not rename %s (%s)", filename, strerror(errno)); + alpm_logaction("error: could not rename %s (%s)\n", filename, strerror(errno)); errors++; } else { /* copy the tempfile we extracted to the real path */ if(_alpm_copyfile(tempfile, filename)) { archive_entry_set_pathname(entry, filename); _alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), filename, strerror(errno)); - alpm_logaction("error: could not copy tempfile to %s (%s)", filename, strerror(errno)); + alpm_logaction("error: could not copy tempfile to %s (%s)\n", filename, strerror(errno)); errors++; } else { archive_entry_set_pathname(entry, filename); _alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath); - alpm_logaction("warning: %s saved as %s", filename, newpath); + alpm_logaction("warning: %s saved as %s\n", filename, newpath); } } } @@ -583,10 +583,10 @@ static int extract_single_file(struct archive *archive, snprintf(newpath, PATH_MAX, "%s.pacnew", filename); if(_alpm_copyfile(tempfile, newpath)) { _alpm_log(PM_LOG_ERROR, _("could not install %s as %s: %s\n"), filename, newpath, strerror(errno)); - alpm_logaction("error: could not install %s as %s: %s", filename, newpath, strerror(errno)); + alpm_logaction("error: could not install %s as %s: %s\n", filename, newpath, strerror(errno)); } else { _alpm_log(PM_LOG_WARNING, _("%s installed as %s\n"), filename, newpath); - alpm_logaction("warning: %s installed as %s", filename, newpath); + alpm_logaction("warning: %s installed as %s\n", filename, newpath); } } } @@ -603,7 +603,7 @@ static int extract_single_file(struct archive *archive, /* change the path to a .pacnew extension */ _alpm_log(PM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename); _alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew\n"), filename, filename); - alpm_logaction("warning: extracting %s as %s.pacnew", filename, filename); + alpm_logaction("warning: extracting %s as %s.pacnew\n", filename, filename); strncat(filename, ".pacnew", PATH_MAX - strlen(filename)); } else { _alpm_log(PM_LOG_DEBUG, "extracting %s\n", filename); @@ -626,7 +626,7 @@ static int extract_single_file(struct archive *archive, } else if(ret != ARCHIVE_OK) { _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"), entryname, archive_error_string(archive)); - alpm_logaction("error: could not extract %s (%s)", + alpm_logaction("error: could not extract %s (%s)\n", entryname, archive_error_string(archive)); return(1); } @@ -793,12 +793,12 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, if(is_upgrade) { _alpm_log(PM_LOG_ERROR, _("problem occurred while upgrading %s\n"), newpkg->name); - alpm_logaction("error: problem occurred while upgrading %s", + alpm_logaction("error: problem occurred while upgrading %s\n", newpkg->name); } else { _alpm_log(PM_LOG_ERROR, _("problem occurred while installing %s\n"), newpkg->name); - alpm_logaction("error: problem occurred while installing %s", + alpm_logaction("error: problem occurred while installing %s\n", newpkg->name); } } @@ -817,7 +817,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, if(_alpm_db_write(db, newpkg, INFRQ_ALL)) { _alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s\n"), alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); - alpm_logaction("error: could not update database entry %s-%s", + alpm_logaction("error: could not update database entry %s-%s\n", alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); RET_ERR(PM_ERR_DB_WRITE, -1); } diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index a5033dee..a5fba845 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -214,7 +214,7 @@ int SYMEXPORT alpm_trans_release() if(_alpm_lckrm()) { _alpm_log(PM_LOG_WARNING, _("could not remove lock file %s\n"), alpm_option_get_lockfile()); - alpm_logaction("warning: could not remove lock file %s", + alpm_logaction("warning: could not remove lock file %s\n", alpm_option_get_lockfile()); } diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 5df3a025..8ca6350b 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -485,7 +485,6 @@ int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *fmt, va_list tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min); ret = vfprintf(f, fmt, args); - fprintf(f, "\n"); fflush(f); } @@ -574,7 +573,7 @@ const char *_alpm_filecache_setup(void) /* cache directory does not exist.... try creating it */ _alpm_log(PM_LOG_WARNING, _("no %s cache exists, creating...\n"), cachedir); - alpm_logaction("warning: no %s cache exists, creating...", + alpm_logaction("warning: no %s cache exists, creating...\n", cachedir); if(_alpm_makepath(cachedir) == 0) { _alpm_log(PM_LOG_DEBUG, "using cachedir: %s\n", cachedir); @@ -593,7 +592,7 @@ const char *_alpm_filecache_setup(void) alpm_option_set_cachedirs(tmp); _alpm_log(PM_LOG_DEBUG, "using cachedir: %s", "/tmp/\n"); _alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead\n")); - alpm_logaction("warning: couldn't create package cache, using /tmp instead"); + alpm_logaction("warning: couldn't create package cache, using /tmp instead\n"); return(alpm_list_getdata(tmp)); } diff --git a/src/pacman/callback.c b/src/pacman/callback.c index a68b0a48..5160b3b3 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -193,7 +193,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) if(config->noprogressbar) { printf(_("done.\n")); } - snprintf(str, LOG_STR_LEN, "installed %s (%s)", + snprintf(str, LOG_STR_LEN, "installed %s (%s)\n", alpm_pkg_get_name(data1), alpm_pkg_get_version(data1)); alpm_logaction(str); @@ -207,7 +207,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) if(config->noprogressbar) { printf(_("done.\n")); } - snprintf(str, LOG_STR_LEN, "removed %s (%s)", + snprintf(str, LOG_STR_LEN, "removed %s (%s)\n", alpm_pkg_get_name(data1), alpm_pkg_get_version(data1)); alpm_logaction(str); @@ -221,7 +221,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) if(config->noprogressbar) { printf(_("done.\n")); } - snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)", + snprintf(str, LOG_STR_LEN, "upgraded %s (%s -> %s)\n", (char *)alpm_pkg_get_name(data1), (char *)alpm_pkg_get_version(data2), (char *)alpm_pkg_get_version(data1)); diff --git a/src/pacman/sync.c b/src/pacman/sync.c index eedea7d4..d0ab8938 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -411,7 +411,7 @@ int sync_trans(alpm_list_t *targets, int sync_only) if(config->op_s_sync) { /* grab a fresh package list */ printf(_(":: Synchronizing package databases...\n")); - alpm_logaction("synchronizing package lists"); + alpm_logaction("synchronizing package lists\n"); if(!sync_synctree(config->op_s_sync, sync_dbs)) { fprintf(stderr, _("error: failed to synchronize any databases\n")); retval = 1; @@ -426,7 +426,7 @@ int sync_trans(alpm_list_t *targets, int sync_only) alpm_list_t *pkgs, *i; printf(_(":: Starting full system upgrade...\n")); - alpm_logaction("starting full system upgrade"); + alpm_logaction("starting full system upgrade\n"); if(alpm_trans_sysupgrade() == -1) { fprintf(stderr, _("error: %s\n"), alpm_strerrorlast()); retval = 1; -- cgit v1.2.3-70-g09d2