[pacman-dev] [PATCH v2] Give a "success!" message on database check
'pacman -Dk' prints a "success!" message if there were no errors. It is possible to suppress the output using the '-q / --quiet' flag. This implements the feature discussed at https://bugs.archlinux.org/task/50087 Signed-off-by: Patrick Eigensatz <patrick.eigensatz@gmail.com> --- doc/pacman.8.txt | 6 +++++- src/pacman/database.c | 4 ++++ src/pacman/pacman.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 2bafa41..0522981 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -456,7 +456,7 @@ Database Options (apply to '-D')[[QO]] package installed even when it was initially installed as a dependency of another package. -*-k \--check*:: +*-k, \--check*:: Check the local package database is internally consistent. This will check all required files are present and that installed packages have the required dependencies, do not conflict and that multiple packages @@ -464,6 +464,10 @@ Database Options (apply to '-D')[[QO]] a check on the sync databases to ensure all specified dependencies are available. +*-q, \--quiet*:: + Apply to '-q' or '--quiet' to suppress the message that the + database check was successful and no errors have been found. + File Options (apply to '-F')[[FO]] ---------------------------------- *-y, --refresh*:: diff --git a/src/pacman/database.c b/src/pacman/database.c index 0197903..3990ea2 100644 --- a/src/pacman/database.c +++ b/src/pacman/database.c @@ -286,6 +286,10 @@ int pacman_database(alpm_list_t *targets) } else { ret = check_db_sync(); } + + if(ret == 0 && !config->quiet) { + printf(_("No database errors have been found!\n")); + } } if(config->flags & (ALPM_TRANS_FLAG_ALLDEPS | ALPM_TRANS_FLAG_ALLEXPLICIT)) { diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index be52d1b..3881829 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -171,6 +171,7 @@ static void usage(int op, const char * const myname) addlist(_(" --asdeps mark packages as non-explicitly installed\n")); addlist(_(" --asexplicit mark packages as explicitly installed\n")); addlist(_(" -k, --check test local database for validity (-kk for sync databases)\n")); + addlist(_(" -q, --quiet Suppress the success message of the validity check\n")); } else if(op == PM_OP_DEPTEST) { printf("%s: %s {-T --deptest} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg); printf("%s:\n", str_opt); @@ -466,6 +467,10 @@ static int parsearg_database(int opt) case 'k': (config->op_q_check)++; break; + case OP_QUIET: + case 'q': + config->quiet = 1; + break; default: return 1; } -- 2.10.0
On 08/10/16 05:45, Patrick Eigensatz wrote:
'pacman -Dk' prints a "success!" message if there were no errors. It is possible to suppress the output using the '-q / --quiet' flag.
This implements the feature discussed at https://bugs.archlinux.org/task/50087
Was there a difference between this patch and the one sent a week earlier? A
Yes, I was asked to add the -q / --quiet flag to the documentation (manpage, --about output) as well. Patch v2 includes those changes. Allan McRae <allan@archlinux.org> schrieb am So., 9. Okt. 2016, 15:15: On 08/10/16 05:45, Patrick Eigensatz wrote:
'pacman -Dk' prints a "success!" message if there were no errors.
It is possible to suppress the output using the '-q / --quiet' flag.
This implements the feature discussed at https://bugs.archlinux.org/task/50087
Was there a difference between this patch and the one sent a week earlier? A
On 10/10/16 00:53, Patrick Eigensatz wrote:
Yes, I was asked to add the -q / --quiet flag to the documentation (manpage, --about output) as well. Patch v2 includes those changes.
I was asking about the two different emails that were sent with "Patch v2". A
Ah yes there were 2 mails "patch v2", I forgot about the 1st one. No, there are no differences but I used git's --in-reply-to flag and changed the subject as well - therefore I wasn't sure whether the mail was sent/and linked correctly and whether someone could read it because I didn't receive an answer. (I'm not blaming anyone!) Allan McRae <allan@archlinux.org> schrieb am So., 9. Okt. 2016, 23:44:
On 10/10/16 00:53, Patrick Eigensatz wrote:
Yes, I was asked to add the -q / --quiet flag to the documentation (manpage, --about output) as well. Patch v2 includes those changes.
I was asking about the two different emails that were sent with "Patch v2".
A
On 08/10/16 05:45, Patrick Eigensatz wrote:
'pacman -Dk' prints a "success!" message if there were no errors. It is possible to suppress the output using the '-q / --quiet' flag.
This implements the feature discussed at https://bugs.archlinux.org/task/50087
Signed-off-by: Patrick Eigensatz <patrick.eigensatz@gmail.com> ---
OK - I changed the description of -q a bit to not just include database checks. I have committed a second patch to allow -q suppress success output of --asdeps and --asexplicit. A
I saw you updated the git repo, thank you :) However looking again at it I noticed a mistake in the documentation: +*-q, \--quiet*:: + Apply to '-q' or '--quiet' to suppress messages on successful + completion of database operations. It should obviously say: "Apply to '-k' or --check'" and not "Apply to '-q' or '--quiet'" I will write a patch for this as soon as possible. Patrick Allan McRae <allan@archlinux.org> schrieb am Fr., 2. Dez. 2016, 07:01: On 08/10/16 05:45, Patrick Eigensatz wrote:
'pacman -Dk' prints a "success!" message if there were no errors. It is possible to suppress the output using the '-q / --quiet' flag.
This implements the feature discussed at https://bugs.archlinux.org/task/50087
Signed-off-by: Patrick Eigensatz <patrick.eigensatz@gmail.com> ---
OK - I changed the description of -q a bit to not just include database checks. I have committed a second patch to allow -q suppress success output of --asdeps and --asexplicit. A
On 09/12/16 03:52, Patrick Eigensatz wrote:
I saw you updated the git repo, thank you :)
However looking again at it I noticed a mistake in the documentation:
+*-q, \--quiet*::
+ Apply to '-q' or '--quiet' to suppress messages on successful + completion of database operations.
It should obviously say:
"Apply to '-k' or --check'"
and not
"Apply to '-q' or '--quiet'"
It should not even say that. It is a general flag for -D operations. Not need to provide a patch. A
participants (2)
-
Allan McRae
-
Patrick Eigensatz