[pacman-dev] [PATCH] Tidy up missing changelog error message
Removes a small TODO from the codebase Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> --- src/pacman/package.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/pacman/package.c b/src/pacman/package.c index 76e8e4f..6f4a195 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -245,8 +245,7 @@ void dump_pkg_changelog(pmpkg_t *pkg) void *fp = NULL; if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, "no changelog available for '%s'.\n", alpm_pkg_get_name(pkg)); return; } else { -- 1.5.5.1
On Sat, May 10, 2008 at 11:31 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
Removes a small TODO from the codebase
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> --- src/pacman/package.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/pacman/package.c b/src/pacman/package.c index 76e8e4f..6f4a195 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -245,8 +245,7 @@ void dump_pkg_changelog(pmpkg_t *pkg) void *fp = NULL;
if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, "no changelog available for '%s'.\n", Ooo, nice.
Any chance you want to fold this into a bigger patch, hopefully slightly tested, finding more of these types of things? This one wasn't alone. $ grep 'fprintf.*error' * | wc -l 41 Of course, this gives me second thoughts- we are using a libalpm defined logging constant in our front end application. should we be doing this?
alpm_pkg_get_name(pkg)); return; } else { -- 1.5.5.1
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://archlinux.org/mailman/listinfo/pacman-dev
Dan McGee wrote:
On Sat, May 10, 2008 at 11:31 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, "no changelog available for '%s'.\n",
Ooo, nice.
Any chance you want to fold this into a bigger patch, hopefully slightly tested, finding more of these types of things? This one wasn't alone.
$ grep 'fprintf.*error' * | wc -l 41
Sure, I was just picking out some small things to tidy up but they always turn out to be bigger that you expected!
Of course, this gives me second thoughts- we are using a libalpm defined logging constant in our front end application. should we be doing this?
Hmm.... It is a publicly available define so I guess it is alright. Alternatively, we essentially duplicate the define for use in the frontend. which seems wasteful.
Dan McGee wrote:
On Sat, May 10, 2008 at 11:31 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, "no changelog available for '%s'.\n",
Ooo, nice.
Any chance you want to fold this into a bigger patch, hopefully slightly tested, finding more of these types of things? This one wasn't alone.
Before, I continue on with this, does the patched version of the string above get flagged for translation? I ask because the only other use of the pm_fprintf function I found was in pacman/pacman.c. pm_fprintf(stderr, PM_LOG_ERROR, "Internal pacman error: Segmentation fault.\n" "Please submit a full bug report with --debug if appropriate.\n"); Now, I can't find those strings in the files in the po/ folder. These lines are in pacman-3.1.4 so should have been translated. Am I missing something obvious or should the strings be surrounded with "_( )"?
Allan McRae wrote:
Dan McGee wrote:
On Sat, May 10, 2008 at 11:31 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, "no changelog available for '%s'.\n",
Ooo, nice.
Any chance you want to fold this into a bigger patch, hopefully slightly tested, finding more of these types of things? This one wasn't alone.
Before, I continue on with this, does the patched version of the string above get flagged for translation? I ask because the only other use of the pm_fprintf function I found was in pacman/pacman.c.
pm_fprintf(stderr, PM_LOG_ERROR, "Internal pacman error: Segmentation fault.\n" "Please submit a full bug report with --debug if appropriate.\n");
Now, I can't find those strings in the files in the po/ folder. These lines are in pacman-3.1.4 so should have been translated. Am I missing something obvious or should the strings be surrounded with "_( )"?
Yes, _ is what indicates which strings can be translated : src/pacman/util.h:#define _(str) gettext(str) In the case of an error that is always displayed (not debug output), we want it to be translated. So we need to keep _ there indeed.
Xavier wrote:
Allan McRae wrote:
Dan McGee wrote:
On Sat, May 10, 2008 at 11:31 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - /* TODO after string freeze use pm_fprintf */ - fprintf(stderr, _("error: no changelog available for '%s'.\n"), + pm_fprintf(stderr, PM_LOG_ERROR, "no changelog available for '%s'.\n",
Ooo, nice.
Any chance you want to fold this into a bigger patch, hopefully slightly tested, finding more of these types of things? This one wasn't alone.
Before, I continue on with this, does the patched version of the string above get flagged for translation? I ask because the only other use of the pm_fprintf function I found was in pacman/pacman.c.
pm_fprintf(stderr, PM_LOG_ERROR, "Internal pacman error: Segmentation fault.\n" "Please submit a full bug report with --debug if appropriate.\n");
Now, I can't find those strings in the files in the po/ folder. These lines are in pacman-3.1.4 so should have been translated. Am I missing something obvious or should the strings be surrounded with "_( )"?
Yes, _ is what indicates which strings can be translated : src/pacman/util.h:#define _(str) gettext(str)
In the case of an error that is always displayed (not debug output), we want it to be translated. So we need to keep _ there indeed.
So just to clarify, was the "Internal pacman error..." message above not flagged for translation for a reason? Otherwise, I will fix this as I update all other fprintf lines. Allan
participants (3)
-
Allan McRae
-
Dan McGee
-
Xavier