On Tue, 2011-05-24 at 13:56 +0200, Denys Vlasenko wrote:
> >> >>> Suggestions?
> >> >>
> >> >> I propose to add abrt-action-save-package-data call to reporters.
> >> >>
> >> >
> >> > - ok, Nikola is working on adding this to bz plugin
> >>
> >> Yep, working on it. Denys, Jiri, do you want to simple call
> >> SavePackageDescriptionToDebugDump or split that giant function into
> >> a small separate functions and be able call those small functions? Do you
> >> want to store it into dump dir?
> >
> > I think it woulr be cleaner if abrt-action-bugzilla knows nothing about
> > packages and rpm db.
> >
> > How about this patch? -
>
> + test -f component || abrt-action-save-package-data
>
> I like your idea, but _abrt-action-save-package-data_ doesn't save only
> component, but even _package_. If missing even _package_ name we should
> at least try to run abrt-action-save-package-data also.
>
> Add line?
> + test -f package || abrt-action-save-package-data
Depends on what do you mean. If you want to say "run
abrt-action-save-package-data if either component or package is
missing", then:
test -f component -a -f package || abrt-action-save-package-data
However, bz reporter must have component, but package is optional.
FILENAME_PACKAGE is used in only one place, here:
const char *comment = get_problem_item_content_or_NULL(problem_data,
FILENAME_COMMENT);
if (comment && comment[0])
{
const char *package = get_problem_item_content_or_NULL(problem_data,
FILENAME_PACKAGE);
const char *release = get_problem_item_content_or_NULL(problem_data,
FILENAME_OS_RELEASE);
const char *arch = get_problem_item_content_or_NULL(problem_data,
FILENAME_ARCHITECTURE);
char *full_dsc = xasprintf("Package: %s\n"
"Architecture: %s\n"
"OS Release: %s\n"
"\n"
"Comment\n"
"-----\n"
"%s\n",
package, arch, release, comment
);
log(_("Adding new comment to bug %d"), bz->bi_id);
/* unused code, enable it when gui/cli will be ready
int is_priv = is_private && string_to_bool(is_private);
const char *is_private = get_problem_item_content_or_NULL(problem_data,
"is_private");
*/
rhbz_add_comment(client, bz->bi_id, full_dsc, 0);
free(full_dsc);
}
Therefore, as opposed to missing component being fatal,
it will work without package - will just print "(null)" there.
--
vda