From 842c4422eda231892d4bce75d8e315eb652533b6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 17 Oct 2011 08:28:57 -0500 Subject: Table display: print message with warning: prefix Use the normal error functions here rather than a bare fprintf(). Signed-off-by: Dan McGee --- src/pacman/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 24ac782b..60e2914d 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -585,7 +585,8 @@ int table_display(const char *title, const alpm_list_t *header, totalwidth = table_calc_widths(header, rows, totalcols, &widths); /* return -1 if terminal is not wide enough */ if(totalwidth > getcols()) { - fprintf(stderr, _("insufficient columns available for table display\n")); + pm_fprintf(stderr, ALPM_LOG_WARNING, + _("insufficient columns available for table display\n")); return -1; } if(!totalwidth || !widths) { -- cgit v1.2.3-70-g09d2 From bac670ddc9a9dcad2f0665f9f77d04b6736c6db4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 17 Oct 2011 09:38:35 -0500 Subject: Show an error message on failed remote key lookup The absolutely terrible part about this is the failure on GPGME's part to distinguish between "key not found" and "keyserver timeout". Instead, it returns the same silly GPG_ERR_EOF in both cases (why isn't GPG_ERR_TIMEOUT being used?), leaving us helpless to tell them apart. Spit out a generic enough error message that covers both cases; unfortunately we can't provide much guidance to the user because we aren't sure what actually happened. Signed-off-by: Dan McGee --- lib/libalpm/signing.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index bdaa83ad..92f34b56 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -797,8 +797,8 @@ int _alpm_process_siglist(alpm_handle_t *handle, const char *identifier, fetch_key.fingerprint, fetch_key.uid); } } else { - _alpm_log(handle, ALPM_LOG_DEBUG, - "key could not be looked up remotely\n"); + _alpm_log(handle, ALPM_LOG_ERROR, + _("key \"%s\" could not be looked up remotely\n"), name); } gpgme_key_unref(fetch_key.data); } -- cgit v1.2.3-70-g09d2 From 4bada454643e6d91f0b53415bc8d135bc7f578b5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 17 Oct 2011 09:42:46 -0500 Subject: pacman-key: add a default keyserver timeout value on --init The default is supposidely 30 seconds from the gpg manpage, but that sure wasn't what I was seeing- it was somewhere closer to two minutes of silence. Add a more reasonable 10 second timeout value which should be good enough for any keyserver that doesn't totally stink at it's job. Signed-off-by: Dan McGee --- scripts/pacman-key.sh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in index 558d6158..ee43dde1 100644 --- a/scripts/pacman-key.sh.in +++ b/scripts/pacman-key.sh.in @@ -166,6 +166,7 @@ initialize() { add_gpg_conf_option "$conffile" 'lock-never' keyserv=${KEYSERVER:-$DEFAULT_KEYSERVER} add_gpg_conf_option "$conffile" 'keyserver' "$keyserv" + add_gpg_conf_option "$conffile" 'keyserver-options' 'timeout=10' # set up a private signing key (if none available) if [[ $(secret_keys_available) -lt 1 ]]; then -- cgit v1.2.3-70-g09d2 From 45f86ca1ca712857e6f84288cf818ce5707fc345 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 21 Oct 2011 10:38:02 -0500 Subject: Use stderr as output stream for pm_printf() This matches what we now do in our backend callback function- all debug/info/warning/error/etc. messages should be on stderr. These are all the messages with a "warning:" or other type prefix, so does not affect general pacman output. This should fix the output confusion noted in FS#26555. Signed-off-by: Dan McGee --- src/pacman/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pacman/util.c b/src/pacman/util.c index 60e2914d..1ca9b4d6 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1417,7 +1417,7 @@ int pm_printf(alpm_loglevel_t level, const char *format, ...) /* print the message using va_arg list */ va_start(args, format); - ret = pm_vfprintf(stdout, level, format, args); + ret = pm_vfprintf(stderr, level, format, args); va_end(args); return ret; -- cgit v1.2.3-70-g09d2 From 9e9ecf218344cea86d6b8c6cf7cd246bcfcca98b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 21 Oct 2011 10:44:19 -0500 Subject: Remove pm_fprintf() in favor of pm_printf() Now that pm_printf() always prints to stderr, we don't need this second function that was always used with stderr as the first argument. Thus, this patch removes the function and makes the following sed replacement: sed -i -e 's#pm_fprintf(stderr, #pm_printf(#g' src/pacman/*.c Signed-off-by: Dan McGee --- src/pacman/conf.c | 2 +- src/pacman/package.c | 4 ++-- src/pacman/query.c | 28 ++++++++++++++-------------- src/pacman/remove.c | 10 +++++----- src/pacman/sync.c | 32 ++++++++++++++++---------------- src/pacman/upgrade.c | 6 +++--- src/pacman/util.c | 23 +++++------------------ src/pacman/util.h | 2 +- 8 files changed, 47 insertions(+), 60 deletions(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index fe2ebb3e..a4d115dd 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -45,7 +45,7 @@ config_t *config_new(void) { config_t *newconfig = calloc(1, sizeof(config_t)); if(!newconfig) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(config_t)); return NULL; diff --git a/src/pacman/package.c b/src/pacman/package.c index 6a312f9a..e5558df3 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -186,7 +186,7 @@ static const char *get_backup_file_status(const char *root, char *md5sum = alpm_compute_md5sum(path); if(md5sum == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("could not calculate checksums for %s\n"), path); return NULL; } @@ -268,7 +268,7 @@ void dump_pkg_changelog(alpm_pkg_t *pkg) void *fp = NULL; if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("no changelog available for '%s'.\n"), + pm_printf(ALPM_LOG_ERROR, _("no changelog available for '%s'.\n"), alpm_pkg_get_name(pkg)); return; } else { diff --git a/src/pacman/query.c b/src/pacman/query.c index 1098b853..ab19bab2 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -118,7 +118,7 @@ static int query_fileowner(alpm_list_t *targets) /* This code is here for safety only */ if(targets == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("no file was specified for --owns\n")); + pm_printf(ALPM_LOG_ERROR, _("no file was specified for --owns\n")); return 1; } @@ -129,7 +129,7 @@ static int query_fileowner(alpm_list_t *targets) rootlen = strlen(root); if(rootlen + 1 > PATH_MAX) { /* we are in trouble here */ - pm_fprintf(stderr, ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, ""); + pm_printf(ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, ""); return 1; } strcpy(path, root); @@ -149,14 +149,14 @@ static int query_fileowner(alpm_list_t *targets) /* if it is not a path but a program name, then check in PATH */ if(strchr(filename, '/') == NULL) { if(search_path(&filename, &buf) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to find '%s' in PATH: %s\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to find '%s' in PATH: %s\n"), filename, strerror(errno)); ret++; free(filename); continue; } } else { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to read file '%s': %s\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to read file '%s': %s\n"), filename, strerror(errno)); ret++; free(filename); @@ -165,7 +165,7 @@ static int query_fileowner(alpm_list_t *targets) } if(S_ISDIR(buf.st_mode)) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("cannot determine ownership of directory '%s'\n"), filename); ret++; free(filename); @@ -181,7 +181,7 @@ static int query_fileowner(alpm_list_t *targets) rpath = resolve_path(dname); if(!rpath) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), + pm_printf(ALPM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), filename, strerror(errno)); free(filename); free(dname); @@ -215,7 +215,7 @@ static int query_fileowner(alpm_list_t *targets) } if(rootlen + 1 + strlen(pkgfile) > PATH_MAX) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, pkgfile); + pm_printf(ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, pkgfile); } /* concatenate our file and the root path */ strcpy(path + rootlen, pkgfile); @@ -232,7 +232,7 @@ static int query_fileowner(alpm_list_t *targets) } } if(!found) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("No package owns %s\n"), filename); + pm_printf(ALPM_LOG_ERROR, _("No package owns %s\n"), filename); ret++; } free(filename); @@ -334,7 +334,7 @@ static int query_group(alpm_list_t *targets) } } } else { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("group '%s' was not found\n"), grpname); + pm_printf(ALPM_LOG_ERROR, _("group '%s' was not found\n"), grpname); ret++; } } @@ -416,7 +416,7 @@ static int check(alpm_pkg_t *pkg) rootlen = strlen(root); if(rootlen + 1 > PATH_MAX) { /* we are in trouble here */ - pm_fprintf(stderr, ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, ""); + pm_printf(ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, ""); return 1; } strcpy(f, root); @@ -429,7 +429,7 @@ static int check(alpm_pkg_t *pkg) const char *path = file->name; if(rootlen + 1 + strlen(path) > PATH_MAX) { - pm_fprintf(stderr, ALPM_LOG_WARNING, _("path too long: %s%s\n"), root, path); + pm_printf(ALPM_LOG_WARNING, _("path too long: %s%s\n"), root, path); continue; } strcpy(f + rootlen, path); @@ -563,16 +563,16 @@ int pacman_query(alpm_list_t *targets) if(pkg == NULL) { switch(alpm_errno(config->handle)) { case ALPM_ERR_PKG_NOT_FOUND: - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("package '%s' was not found\n"), strname); if(!config->op_q_isfile && access(strname, R_OK) == 0) { - pm_fprintf(stderr, ALPM_LOG_WARNING, + pm_printf(ALPM_LOG_WARNING, _("'%s' is a file, you might want to use %s.\n"), strname, "-p/--file"); } break; default: - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("could not load package '%s': %s\n"), strname, alpm_strerror(alpm_errno(config->handle))); break; diff --git a/src/pacman/remove.c b/src/pacman/remove.c index 3fc8279c..1cdf5d36 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -39,7 +39,7 @@ static int remove_target(const char *target) if((pkg = alpm_db_get_pkg(db_local, target)) != NULL) { if(alpm_remove_pkg(config->handle, pkg) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(alpm_errno(config->handle))); return -1; } @@ -50,13 +50,13 @@ static int remove_target(const char *target) /* fallback to group */ alpm_group_t *grp = alpm_db_readgroup(db_local, target); if(grp == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': target not found\n", target); + pm_printf(ALPM_LOG_ERROR, "'%s': target not found\n", target); return -1; } for(p = grp->packages; p; p = alpm_list_next(p)) { pkg = alpm_list_getdata(p); if(alpm_remove_pkg(config->handle, pkg) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(alpm_errno(config->handle))); return -1; } @@ -105,7 +105,7 @@ int pacman_remove(alpm_list_t *targets) /* Step 2: prepare the transaction based on its type, targets and flags */ if(alpm_trans_prepare(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), alpm_strerror(err)); switch(err) { case ALPM_ERR_PKG_INVALID_ARCH: @@ -166,7 +166,7 @@ int pacman_remove(alpm_list_t *targets) } if(alpm_trans_commit(config->handle, &data) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(alpm_errno(config->handle))); retval = 1; } diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 5d6dcb99..2773708c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -47,7 +47,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) dir = opendir(dbpath); if(dir == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("could not access database directory\n")); + pm_printf(ALPM_LOG_ERROR, _("could not access database directory\n")); return 1; } @@ -82,7 +82,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) len = strlen(path); if(S_ISDIR(buf.st_mode) || strcmp(path + len - 3, ".db") != 0) { if(rmrf(path)) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("could not remove %s\n"), path); closedir(dir); return 1; @@ -108,7 +108,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) } if(rmrf(path)) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("could not remove %s\n"), path); closedir(dir); return 1; @@ -188,7 +188,7 @@ static int sync_cleancache(int level) struct dirent *ent; if(dir == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("could not access cache directory %s\n"), cachedir); ret++; continue; @@ -292,7 +292,7 @@ static int sync_synctree(int level, alpm_list_t *syncs) ret = alpm_db_update((level < 2 ? 0 : 1), db); if(ret < 0) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to update %s (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"), alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle))); } else if(ret == 1) { printf(_(" %s is up to date\n"), alpm_db_get_name(db)); @@ -307,7 +307,7 @@ static int sync_synctree(int level, alpm_list_t *syncs) * expected */ if(!success) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to synchronize any databases\n")); + pm_printf(ALPM_LOG_ERROR, _("failed to synchronize any databases\n")); trans_init_error(); } return (success > 0); @@ -482,12 +482,12 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) } if(!founddb) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("repository '%s' does not exist\n"), repo); ret++; } if(!foundpkg) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("package '%s' was not found\n"), target); ret++; } @@ -527,7 +527,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) } if(db == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("repository \"%s\" was not found.\n"),repo); alpm_list_free(ls); return 1; @@ -607,7 +607,7 @@ static int process_pkg(alpm_pkg_t *pkg) pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg)); return 0; } else { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg), + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg), alpm_strerror(err)); return 1; } @@ -624,7 +624,7 @@ static int process_group(alpm_list_t *dbs, const char *group) int count = alpm_list_count(pkgs); if(!count) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("target not found: %s\n"), group); + pm_printf(ALPM_LOG_ERROR, _("target not found: %s\n"), group); return 1; } @@ -705,7 +705,7 @@ static int process_target(const char *target) dbname = targstring; db = get_db(dbname); if(!db) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("database not found: %s\n"), + pm_printf(ALPM_LOG_ERROR, _("database not found: %s\n"), dbname); ret = 1; goto cleanup; @@ -721,7 +721,7 @@ static int process_target(const char *target) cleanup: free(targstring); if(ret && access(target, R_OK) == 0) { - pm_fprintf(stderr, ALPM_LOG_WARNING, + pm_printf(ALPM_LOG_WARNING, _("'%s' is a file, did you mean %s instead of %s?\n"), target, "-U/--upgrade", "-S/--sync"); } @@ -750,7 +750,7 @@ static int sync_trans(alpm_list_t *targets) printf(_(":: Starting full system upgrade...\n")); alpm_logaction(config->handle, "starting full system upgrade\n"); if(alpm_sync_sysupgrade(config->handle, config->op_s_upgrade >= 2) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle))); + pm_printf(ALPM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle))); trans_release(); return 1; } @@ -767,7 +767,7 @@ int sync_prepare_execute(void) /* Step 2: "compute" the transaction based on targets and flags */ if(alpm_trans_prepare(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), alpm_strerror(err)); switch(err) { case ALPM_ERR_PKG_INVALID_ARCH: @@ -836,7 +836,7 @@ int sync_prepare_execute(void) if(alpm_trans_commit(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(err)); switch(err) { case ALPM_ERR_FILE_CONFLICTS: diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index 3d4e34c1..880aa4c6 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -55,7 +55,7 @@ int pacman_upgrade(alpm_list_t *targets) if(strstr(i->data, "://")) { char *str = alpm_fetch_pkgurl(config->handle, i->data); if(str == NULL) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", (char *)i->data, alpm_strerror(alpm_errno(config->handle))); return 1; } else { @@ -77,13 +77,13 @@ int pacman_upgrade(alpm_list_t *targets) alpm_pkg_t *pkg; if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", targ, alpm_strerror(alpm_errno(config->handle))); trans_release(); return 1; } if(alpm_add_pkg(config->handle, pkg) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", + pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", targ, alpm_strerror(alpm_errno(config->handle))); alpm_pkg_free(pkg); trans_release(); diff --git a/src/pacman/util.c b/src/pacman/util.c index 1ca9b4d6..1b0625ea 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -66,7 +66,7 @@ int trans_init(alpm_transflag_t flags, int check_valid) void trans_init_error(void) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"), alpm_strerror(err)); if(err == ALPM_ERR_HANDLE_LOCK) { fprintf(stderr, _(" if you're sure a package manager is not already\n" @@ -78,7 +78,7 @@ void trans_init_error(void) int trans_release(void) { if(alpm_trans_release(config->handle) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to release transaction (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to release transaction (%s)\n"), alpm_strerror(alpm_errno(config->handle))); return -1; } @@ -585,7 +585,7 @@ int table_display(const char *title, const alpm_list_t *header, totalwidth = table_calc_widths(header, rows, totalcols, &widths); /* return -1 if terminal is not wide enough */ if(totalwidth > getcols()) { - pm_fprintf(stderr, ALPM_LOG_WARNING, + pm_printf(ALPM_LOG_WARNING, _("insufficient columns available for table display\n")); return -1; } @@ -743,7 +743,7 @@ void signature_display(const char *title, alpm_siglist_t *siglist) ret = pm_asprintf(&sigline, _("%s, %s from \"%s\""), status, validity, name); if(ret == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to allocate string\n")); + pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n")); continue; } indentprint(sigline, len); @@ -1423,19 +1423,6 @@ int pm_printf(alpm_loglevel_t level, const char *format, ...) return ret; } -int pm_fprintf(FILE *stream, alpm_loglevel_t level, const char *format, ...) -{ - int ret; - va_list args; - - /* print the message using va_arg list */ - va_start(args, format); - ret = pm_vfprintf(stream, level, format, args); - va_end(args); - - return ret; -} - int pm_asprintf(char **string, const char *format, ...) { int ret = 0; @@ -1444,7 +1431,7 @@ int pm_asprintf(char **string, const char *format, ...) /* print the message using va_arg list */ va_start(args, format); if(vasprintf(string, format, args) == -1) { - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to allocate string\n")); + pm_printf(ALPM_LOG_ERROR, _("failed to allocate string\n")); ret = -1; } va_end(args); diff --git a/src/pacman/util.h b/src/pacman/util.h index dc6995ca..6ec962ff 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -75,8 +75,8 @@ int select_question(int count); int multiselect_question(char *array, int count); int yesno(char *fmt, ...); int noyes(char *fmt, ...); + int pm_printf(alpm_loglevel_t level, const char *format, ...) __attribute__((format(printf,2,3))); -int pm_fprintf(FILE *stream, alpm_loglevel_t level, const char *format, ...) __attribute__((format(printf,3,4))); int pm_asprintf(char **string, const char *format, ...); int pm_vfprintf(FILE *stream, alpm_loglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0))); int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0))); -- cgit v1.2.3-70-g09d2 From 20a47aba8ec859e920bf965ab7da74c26a44339d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 21 Oct 2011 10:51:49 -0500 Subject: Remove remaining usages of fprintf() from frontend These can either be replaced with pm_printf() if they are error related, or in the fprintf(stdout, ...) case a bare printf() will do. Signed-off-by: Dan McGee --- src/pacman/package.c | 4 ++-- src/pacman/util.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pacman/package.c b/src/pacman/package.c index e5558df3..12f555a1 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -252,9 +252,9 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet) for(i = 0; i < pkgfiles->count; i++) { const alpm_file_t *file = pkgfiles->files + i; if(!quiet) { - fprintf(stdout, "%s %s%s\n", pkgname, root, file->name); + printf("%s %s%s\n", pkgname, root, file->name); } else { - fprintf(stdout, "%s%s\n", root, file->name); + printf("%s%s\n", root, file->name); } } diff --git a/src/pacman/util.c b/src/pacman/util.c index 1b0625ea..b9ee8c9c 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1158,14 +1158,15 @@ static int parseindex(char *s, int *val, int min, int max) int n = strtol(s, &endptr, 10); if(*endptr == '\0') { if(n < min || n > max) { - fprintf(stderr, _("Invalid value: %d is not between %d and %d\n"), + pm_printf(ALPM_LOG_ERROR, + _("invalid value: %d is not between %d and %d\n"), n, min, max); return -1; } *val = n; return 0; } else { - fprintf(stderr, _("Invalid number: %s\n"), s); + pm_printf(ALPM_LOG_ERROR, _("invalid number: %s\n"), s); return -1; } } -- cgit v1.2.3-70-g09d2 From d6e3446e70bcda9c0f28d80110d588106daa4b5c Mon Sep 17 00:00:00 2001 From: lolilolicon Date: Thu, 20 Oct 2011 11:35:00 +0800 Subject: bacman: pkgrel does not have to be an integer pkgrel, as with pkgver, simply mustn't contain hyphens. Signed-off-by: lolilolicon Signed-off-by: Dan McGee --- contrib/bacman.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/bacman.in b/contrib/bacman.in index 96360911..c55d7161 100755 --- a/contrib/bacman.in +++ b/contrib/bacman.in @@ -93,7 +93,7 @@ pkg_dest="${PKGDEST:-$PWD}" pkg_pkger=${PACKAGER:-'Unknown Packager'} pkg_name="$1" -pkg_dir=("$pac_db/$pkg_name"-+([^-])-+([0-9])) +pkg_dir=("$pac_db/$pkg_name"-+([^-])-+([^-])) pkg_namver=("${pkg_dir[@]##*/}") # -- cgit v1.2.3-70-g09d2