summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-03-16 14:09:01 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-03-16 14:09:01 +0100
commit86b8a3c9544baebcfd8925ef232eda1966afc5e2 (patch)
tree497eaffbf35d4c44acba323113c091a4d06b0c98
parentbeff4a6d529c6950d923c3638bc30fc54f39906d (diff)
downloadabrt-86b8a3c9544baebcfd8925ef232eda1966afc5e2.tar.gz
abrt-86b8a3c9544baebcfd8925ef232eda1966afc5e2.tar.xz
abrt-86b8a3c9544baebcfd8925ef232eda1966afc5e2.zip
better messages in abrt-action-install-debuginfo and bugzilla description
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--src/lib/make_descr.c40
-rwxr-xr-xsrc/plugins/abrt-action-install-debuginfo.py10
2 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index 1ebdfc4d..08c9bca2 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -117,6 +117,7 @@ char* make_description_mailx(crash_data_t *crash_data)
char* make_description_bz(crash_data_t *crash_data)
{
struct strbuf *buf_dsc = strbuf_new();
+ struct strbuf *buf_big_dsc = strbuf_new();
struct strbuf *buf_long_dsc = strbuf_new();
GHashTableIter iter;
@@ -126,6 +127,7 @@ char* make_description_bz(crash_data_t *crash_data)
while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))
{
struct stat statbuf;
+ int stat_err = 0;
unsigned flags = value->flags;
const char *content = value->content;
if (flags & CD_FLAG_TXT)
@@ -153,7 +155,6 @@ char* make_description_bz(crash_data_t *crash_data)
/* Not one-liner */
if (buf_long_dsc->len != 0)
strbuf_append_char(buf_long_dsc, '\n');
-
strbuf_append_str(buf_long_dsc, tmp);
}
else
@@ -164,7 +165,7 @@ char* make_description_bz(crash_data_t *crash_data)
else
{
statbuf.st_size = strlen(content);
- goto add_attachment_info;
+ goto add_big_file_info;
}
}
if (flags & CD_FLAG_BIN)
@@ -172,28 +173,27 @@ char* make_description_bz(crash_data_t *crash_data)
/* In many cases, it is useful to know how big binary files are
* (for example, helps with diagnosing bug upload problems)
*/
- if (stat(content, &statbuf) != 0)
- statbuf.st_size = (off_t) -1;
-
- add_attachment_info: ;
- char *descr;
- if (statbuf.st_size >= 0)
- descr = xasprintf("%s, %llu bytes", name, (long long)statbuf.st_size);
- else
- descr = xstrdup(name);
- bool was_multiline = 0;
- char *tmp = NULL;
- add_content(&was_multiline, &tmp, "Attached file", descr);
- free(descr);
- strbuf_append_str(buf_dsc, tmp);
- free(tmp);
+ stat_err = stat(content, &statbuf);
+ add_big_file_info:
+ strbuf_append_strf(buf_big_dsc,
+ (stat_err ? "%s file: %s\n" : "%s file: %s, %llu bytes\n"),
+ ((flags & CD_FLAG_BIN) ? "Binary" : "Text"),
+ name,
+ (long long)statbuf.st_size
+ );
}
}
- /* One-liners go first, then multi-line items */
- if (buf_dsc->len != 0 && buf_long_dsc->len != 0)
- strbuf_append_char(buf_dsc, '\n');
+ /* One-liners go first, then big files, then multi-line items */
+ if (buf_dsc->len != 0 && (buf_big_dsc->len != 0 || buf_long_dsc->len != 0))
+ strbuf_append_char(buf_dsc, '\n'); /* add empty line */
+
+ if (buf_big_dsc->len != 0 && buf_long_dsc->len != 0)
+ strbuf_append_char(buf_big_dsc, '\n'); /* add empty line */
+ char *big_dsc = strbuf_free_nobuf(buf_big_dsc);
+ strbuf_append_str(buf_dsc, big_dsc);
+ free(big_dsc);
char *long_dsc = strbuf_free_nobuf(buf_long_dsc);
strbuf_append_str(buf_dsc, long_dsc);
diff --git a/src/plugins/abrt-action-install-debuginfo.py b/src/plugins/abrt-action-install-debuginfo.py
index 2fc9af8c..6eaaae8a 100755
--- a/src/plugins/abrt-action-install-debuginfo.py
+++ b/src/plugins/abrt-action-install-debuginfo.py
@@ -239,7 +239,7 @@ class DebugInfoDownload(YumBase):
if verbose != 0 or len(not_found) != 0:
print _("Can't find packages for %u debuginfo files") % len(not_found)
if verbose != 0 or total_pkgs != 0:
- print _("Found %u packages to download") % total_pkgs
+ print _("Packages to download: %u") % total_pkgs
print _("Downloading %.2fMb, installed size: %.2fMb") % (
todownload_size / (1024**2),
installed_size / (1024**2)
@@ -302,7 +302,7 @@ def log2(message):
print "LOG2:", message
#eu_unstrip_OUT=`eu-unstrip "--core=$core" -n 2>eu_unstrip.ERR`
-def extract_info_from_core(corefile):
+def extract_info_from_core(coredump_name):
"""
Extracts builds with filenames,
Returns a list of tuples (build_id, filename)
@@ -313,8 +313,8 @@ def extract_info_from_core(corefile):
#SEP = 3
EXECUTABLE = 4
- print _("Analyzing corefile '%s'") % corefile
- eu_unstrip_OUT = Popen(["eu-unstrip","--core=%s" % corefile, "-n"], stdout=PIPE, bufsize=-1).communicate()[0]
+ print _("Analyzing coredump '%s'") % coredump_name
+ eu_unstrip_OUT = Popen(["eu-unstrip","--core=%s" % coredump_name, "-n"], stdout=PIPE, bufsize=-1).communicate()[0]
# parse eu_unstrip_OUT and return the list of build_ids
# eu_unstrip_OUT = ("0x7f42362ca000+0x204000 c4d35d993598a6242f7525d024b5ec3becf5b447@0x7f42362ca1a0 /usr/lib64/libcanberra-gtk.so.0 - libcanberra-gtk.so.0\n"
@@ -333,7 +333,7 @@ def extract_info_from_core(corefile):
#print eu_unstrip_OUT
# we failed to get build ids from the core -> die
if not eu_unstrip_OUT:
- print "Can't get build ids from %s" % corefile
+ print "Can't get build ids from %s" % coredump_name
return RETURN_FAILURE
lines = eu_unstrip_OUT.split('\n')