[abrt] added abrt-cli manpage, fixed weird number formatting when showing di size

Jiří Moskovčák jmoskovc at fedoraproject.org
Thu Dec 8 12:27:45 UTC 2011


commit b60efb70c9a2c42b00fab6688b6554a48a3f1602
Author: Jiri <moskovcak at gmail.com>
Date:   Thu Dec 8 13:27:46 2011 +0100

    added abrt-cli manpage, fixed weird number formatting when showing di size

 ...-install-debuginfo-do-not-use-scientific-.patch |   33 +++
 ...abrt-cli-add-man-page.-Closes-rhbz-747624.patch |  256 ++++++++++++++++++++
 abrt.spec                                          |   18 +-
 3 files changed, 300 insertions(+), 7 deletions(-)
---
diff --git a/0007-abrt-action-install-debuginfo-do-not-use-scientific-.patch b/0007-abrt-action-install-debuginfo-do-not-use-scientific-.patch
new file mode 100644
index 0000000..49f8228
--- /dev/null
+++ b/0007-abrt-action-install-debuginfo-do-not-use-scientific-.patch
@@ -0,0 +1,33 @@
+From 8f6d5316e9d1555f8b33aeef97053f04d3903759 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <dvlasenk at redhat.com>
+Date: Wed, 7 Dec 2011 18:08:06 +0100
+Subject: [PATCH 7/8] abrt-action-install-debuginfo: do not use scientific
+ notation for sizes
+
+"Downloading 5.1e+02Mb, installed size: 2.1e+03Mb" looks weird...
+
+Signed-off-by: Denys Vlasenko <dvlasenk at redhat.com>
+---
+ src/plugins/abrt-action-install-debuginfo.in |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/plugins/abrt-action-install-debuginfo.in b/src/plugins/abrt-action-install-debuginfo.in
+index f6d0001..7c19331 100644
+--- a/src/plugins/abrt-action-install-debuginfo.in
++++ b/src/plugins/abrt-action-install-debuginfo.in
+@@ -288,9 +288,9 @@ class DebugInfoDownload(YumBase):
+ 	    print _("Can't find packages for {0} debuginfo files").format(len(not_found))
+ 	if verbose != 0 or total_pkgs != 0:
+ 	    print _("Packages to download: {0}").format(total_pkgs)
+-	    question = _("Downloading {0:.2}Mb, installed size: {1:.2}Mb. Continue?").format(
+-	                 todownload_size / (1024**2),
+-	                 installed_size / (1024**2)
++	    question = _("Downloading {0:.2f}Mb, installed size: {1:.2f}Mb. Continue?").format(
++	                 todownload_size / (1024*1024),
++	                 installed_size / (1024*1024)
+ 	                )
+ 	    if noninteractive == False and not reportclient.ask_yes_no(question):
+ 	        print _("Download cancelled by user")
+-- 
+1.7.7.3
+
diff --git a/0008-abrt-cli-add-man-page.-Closes-rhbz-747624.patch b/0008-abrt-cli-add-man-page.-Closes-rhbz-747624.patch
new file mode 100644
index 0000000..0e238ea
--- /dev/null
+++ b/0008-abrt-cli-add-man-page.-Closes-rhbz-747624.patch
@@ -0,0 +1,256 @@
+From 383a8c804e0a492e8261309bbd0e9d3502ec6604 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <dvlasenk at redhat.com>
+Date: Wed, 7 Dec 2011 23:14:46 +0100
+Subject: [PATCH 8/8] abrt-cli: add man page. Closes rhbz#747624
+
+This also regularizes help text a bit, and trims code
+by about 150 bytes
+
+Signed-off-by: Denys Vlasenko <dvlasenk at redhat.com>
+---
+ abrt.spec.in       |    3 +--
+ doc/Makefile.am    |    1 +
+ doc/abrt-cli.txt   |   31 +++++++++++++++++++++++++++++++
+ src/cli/abrt-cli.c |   10 +++++-----
+ src/cli/list.c     |   19 ++++++++++---------
+ src/cli/report.c   |   16 +++++++---------
+ src/cli/rm.c       |   10 +++++++---
+ 7 files changed, 62 insertions(+), 28 deletions(-)
+ create mode 100644 doc/abrt-cli.txt
+
+diff --git a/abrt.spec.in b/abrt.spec.in
+index a5e78a1..7847ac0 100644
+--- a/abrt.spec.in
++++ b/abrt.spec.in
+@@ -497,8 +497,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+ %files cli
+ %defattr(-,root,root,-)
+ %{_bindir}/abrt-cli
+-# provide asap
+-#% {_mandir}/man1/report-cli.1.gz
++%{_mandir}/man1/abrt-cli.1.gz
+ 
+ %files desktop
+ %defattr(-,root,root,-)
+diff --git a/doc/Makefile.am b/doc/Makefile.am
+index 65a8142..5025f93 100644
+--- a/doc/Makefile.am
++++ b/doc/Makefile.am
+@@ -11,6 +11,7 @@ MAN1_TXT += abrt-action-list-dsos.txt
+ MAN1_TXT += abrt-retrace-client.txt
+ MAN1_TXT += abrt-handle-upload.txt
+ MAN1_TXT += abrt-server.txt
++MAN1_TXT += abrt-cli.txt
+ MAN1_TXT += abrt-action-save-package-data.txt
+ MAN1_TXT += abrt-install-ccpp-hook.txt
+ 
+diff --git a/doc/abrt-cli.txt b/doc/abrt-cli.txt
+new file mode 100644
+index 0000000..9680ad6
+--- /dev/null
++++ b/doc/abrt-cli.txt
+@@ -0,0 +1,31 @@
++abrt-cli(1)
++===========
++
++NAME
++----
++abrt-cli - List, remove, print, analyze, report problems
++
++SYNOPSIS
++--------
++'abrt-cli' list   [-vdf] [DIR]...
++
++'abrt-cli' rm     [-v]   DIR...
++
++'abrt-cli' report [-v]   DIR...
++
++'abrt-cli' info   [-vd]  DIR...
++
++OPTIONS
++-------
++-v,--verbose::
++   Be more verbose. Can be given multiple times.
++
++-d,--detailed::
++   Show detailed report
++
++-f,--full::
++   List even reported problems
++
++AUTHORS
++-------
++* ABRT team
+diff --git a/src/cli/abrt-cli.c b/src/cli/abrt-cli.c
+index 2ea5276..fdd3173 100644
+--- a/src/cli/abrt-cli.c
++++ b/src/cli/abrt-cli.c
+@@ -138,14 +138,14 @@ int main(int argc, const char **argv)
+     argc--;
+ 
+     const char *abrt_cli_usage_string = _(
+-        "Usage: abrt-cli [--version] COMMAND [ARGS]"
++        "Usage: abrt-cli [--version] COMMAND [DIR]..."
+         );
+ 
+     const struct cmd_struct commands[] = {
+-        {"list", cmd_list, _("List not yet reported problems")},
+-        {"rm", cmd_rm, _("Remove files from problem directory")},
+-        {"report", cmd_report, _("Analyze and report problem data in problem directory")},
+-        {"info", cmd_info, _("Print information about DUMP_DIR")},
++        {"list", cmd_list, _("List not yet reported problems [in DIRs]")},
++        {"rm", cmd_rm, _("Remove problem directory DIR")},
++        {"report", cmd_report, _("Analyze and report problem data in DIR")},
++        {"info", cmd_info, _("Print information about DIR")},
+         {NULL, NULL, NULL}
+     };
+ 
+diff --git a/src/cli/list.c b/src/cli/list.c
+index a9b700c..565a36f 100644
+--- a/src/cli/list.c
++++ b/src/cli/list.c
+@@ -87,7 +87,7 @@ static void print_crash_list(vector_of_problem_data_t *crash_list, int include_r
+ int cmd_list(int argc, const char **argv)
+ {
+     const char *program_usage_string = _(
+-        "& list [options] [<dump-dir>]..."
++        "& list [options] [DIR]..."
+         );
+ 
+     static int opt_full, opt_detailed;
+@@ -101,11 +101,11 @@ int cmd_list(int argc, const char **argv)
+     };
+ 
+     parse_opts(argc, (char **)argv, program_options, program_usage_string);
++    argv += optind;
+ 
+     GList *D_list = NULL;
+-    if (optind < argc)
+-        while (optind < argc)
+-            D_list = g_list_append(D_list, xstrdup(argv[optind++]));
++    while (*argv)
++        D_list = g_list_append(D_list, xstrdup(*argv++));
+     if (!D_list)
+     {
+         load_abrt_conf();
+@@ -130,7 +130,7 @@ int cmd_list(int argc, const char **argv)
+ int cmd_info(int argc, const char **argv)
+ {
+     const char *program_usage_string = _(
+-        "& info [options] [<dump-dir>]..."
++        "& info [options] DIR..."
+         );
+ 
+     static int opt_detailed;
+@@ -143,14 +143,15 @@ int cmd_info(int argc, const char **argv)
+     };
+ 
+     parse_opts(argc, (char **)argv, program_options, program_usage_string);
++    argv += optind;
+ 
+-    if (optind == argc)
++    if (!argv[0])
+         show_usage_and_die(program_usage_string, program_options);
+ 
+     int errs = 0;
+-    while (argv[optind])
++    while (*argv)
+     {
+-        const char *dump_dir = argv[optind++];
++        const char *dump_dir = *argv++;
+         problem_data_t *problem = fill_crash_info(dump_dir);
+         if (!problem)
+         {
+@@ -161,7 +162,7 @@ int cmd_info(int argc, const char **argv)
+ 
+         print_crash(problem, opt_detailed);
+         free_problem_data(problem);
+-        if (optind - argc)
++        if (*argv)
+             printf("\n");
+     }
+ 
+diff --git a/src/cli/report.c b/src/cli/report.c
+index 1e6c5ce..e20bb96 100644
+--- a/src/cli/report.c
++++ b/src/cli/report.c
+@@ -25,7 +25,7 @@
+ int cmd_report(int argc, const char **argv)
+ {
+     const char *program_usage_string = _(
+-        "& report [options] [<dump-dir>]..."
++        "& report [options] DIR..."
+         );
+ 
+     struct options program_options[] = {
+@@ -34,6 +34,10 @@ int cmd_report(int argc, const char **argv)
+     };
+ 
+     parse_opts(argc, (char **)argv, program_options, program_usage_string);
++    argv += optind;
++
++    if (!argv[0])
++        show_usage_and_die(program_usage_string, program_options);
+ 
+     load_abrt_conf();
+     char *home = getenv("HOME");
+@@ -43,12 +47,9 @@ int cmd_report(int argc, const char **argv)
+     D_list = g_list_append(D_list, xstrdup(g_settings_dump_location));
+     free_abrt_conf_data();
+ 
+-    if (!argv[optind])
+-        show_usage_and_die(program_usage_string, program_options);
+-
+-    while (1)
++    while (*argv)
+     {
+-        const char *dir_name = argv[optind++];
++        const char *dir_name = *argv++;
+ 
+         vector_of_problem_data_t *ci = NULL;
+         if (*dir_name == '@')
+@@ -73,9 +74,6 @@ int cmd_report(int argc, const char **argv)
+         free_vector_of_problem_data(ci);
+         if (status)
+             exit(status);
+-
+-        if (!argv[optind])
+-            break;
+     }
+ 
+     return 0;
+diff --git a/src/cli/rm.c b/src/cli/rm.c
+index 4a95d93..8f185a4 100644
+--- a/src/cli/rm.c
++++ b/src/cli/rm.c
+@@ -28,7 +28,7 @@
+ int cmd_rm(int argc, const char **argv)
+ {
+     const char *program_usage_string = _(
+-        "& rm [options] [<dump-dir>]..."
++        "& rm [options] DIR..."
+         );
+ 
+     struct options program_options[] = {
+@@ -37,12 +37,16 @@ int cmd_rm(int argc, const char **argv)
+     };
+ 
+     parse_opts(argc, (char **)argv, program_options, program_usage_string);
++    argv += optind;
++
++    if (!argv[0])
++        show_usage_and_die(program_usage_string, program_options);
+ 
+     int errs = 0;
+-    while (argv[optind])
++    while (*argv)
+     {
+         int status;
+-        const char *rm_dir = argv[optind++];
++        const char *rm_dir = *argv++;
+         status = delete_dump_dir_possibly_using_abrtd(rm_dir);
+         if (!status)
+             log("rm '%s'", rm_dir);
+-- 
+1.7.7.3
+
diff --git a/abrt.spec b/abrt.spec
index 6f689bc..30497fb 100644
--- a/abrt.spec
+++ b/abrt.spec
@@ -24,11 +24,14 @@ Source: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
 Source1: abrt1_to_abrt2
 Patch0: blacklist.patch
 Patch1: abrt_disable_gpgcheck.diff
-Patch3: 0002-disabled-reporting-to-kerneloops.org.patch
-Patch4: 0003-abrtd-fix-potential-problem-with-exitcode-check-on-p.patch
-Patch5: 0004-abrtd-always-explain-why-we-delete-corrupted-dir.-Cl.patch
-Patch6: 0005-more-glib2.31-fixes.patch
-Patch7: 0006-missed-one-more-deprecated-g_io_channel_read.patch
+Patch2: 0002-disabled-reporting-to-kerneloops.org.patch
+Patch3: 0003-abrtd-fix-potential-problem-with-exitcode-check-on-p.patch
+Patch4: 0004-abrtd-always-explain-why-we-delete-corrupted-dir.-Cl.patch
+Patch5: 0005-more-glib2.31-fixes.patch
+Patch6: 0006-missed-one-more-deprecated-g_io_channel_read.patch
+Patch7: 0007-abrt-action-install-debuginfo-do-not-use-scientific-.patch
+Patch8: 0008-abrt-cli-add-man-page.-Closes-rhbz-747624.patch
+
 BuildRequires: dbus-devel
 BuildRequires: gtk2-devel
 BuildRequires: rpm-devel >= 4.6
@@ -190,11 +193,13 @@ Virtual package to make easy default installation on desktop environments.
 %patch0 -p1 -b .blacklist
 # general
 %patch1 -p1 -b .gpg
+%patch2 -p1
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 %build
 autoconf
@@ -518,8 +523,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %files cli
 %defattr(-,root,root,-)
 %{_bindir}/abrt-cli
-# provide asap
-#% {_mandir}/man1/report-cli.1.gz
+%{_mandir}/man1/abrt-cli.1.gz
 
 %files desktop
 %defattr(-,root,root,-)


More information about the scm-commits mailing list