From c91050fc35a401824bdcf84c4bee50c9aa4dcfda Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 10 Oct 2013 10:43:01 +0200 Subject: [PATCH] xbps-rindex(8): added -v --verbose option (mainly for -r mode). --- NEWS | 4 +++- bin/xbps-rindex/main.c | 10 ++++++++-- bin/xbps-rindex/remove-obsoletes.c | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 63214d55..f927cb0b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ xbps-0.27 (???): + * xbps-rindex(8): added -v --verbose option. + * xbps-rindex(8): -c --clean mode has been removed. Generating a local repository is almost as fast as cleaning up the repository data. @@ -8,7 +10,7 @@ xbps-0.27 (???): * Support for RSA signed repositories. A repository can be signed with your preferred RSA key (any ssh key works) as follows: - $ xbps-rindex -s --signedby "foobar " --privkey /priv/key /path/to/repo + $ xbps-rindex --sign --signedby "foobar " --privkey /priv/key /path/to/repo Public keys must be imported before using a remote signed repository thru the xbps-rkeys(8) utility: diff --git a/bin/xbps-rindex/main.c b/bin/xbps-rindex/main.c index 02819ecf..516f3abd 100644 --- a/bin/xbps-rindex/main.c +++ b/bin/xbps-rindex/main.c @@ -39,6 +39,7 @@ usage(bool fail) "OPTIONS\n" " -f --force Force mode to overwrite entry in add mode\n" " -h --help Show help usage\n" + " -v --verbose Verbose messages\n" " -V --version Show XBPS version\n" " --privkey Path to the private key for signing\n" " --signedby Signature details, i.e \"name \"\n\n" @@ -52,13 +53,14 @@ usage(bool fail) int main(int argc, char **argv) { - const char *shortopts = "afhrV"; + const char *shortopts = "afhrVv"; struct option longopts[] = { { "add", no_argument, NULL, 'a' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "remove-obsoletes", no_argument, NULL, 'r' }, { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, { "privkey", required_argument, NULL, 0}, { "signedby", required_argument, NULL, 1}, { "sign", no_argument, NULL, 's'}, @@ -66,7 +68,7 @@ main(int argc, char **argv) }; struct xbps_handle xh; const char *privkey = NULL, *signedby = NULL; - int rv, c; + int rv, c, flags = 0; bool add_mode, rm_mode, sign_mode, force; add_mode = rm_mode = sign_mode = force = false; @@ -94,6 +96,9 @@ main(int argc, char **argv) case 's': sign_mode = true; break; + case 'v': + flags |= XBPS_FLAG_VERBOSE; + break; case 'V': printf("%s\n", XBPS_RELVER); exit(EXIT_SUCCESS); @@ -111,6 +116,7 @@ main(int argc, char **argv) /* initialize libxbps */ memset(&xh, 0, sizeof(xh)); + xh.flags = flags; if ((rv = xbps_init(&xh)) != 0) { fprintf(stderr, "failed to initialize libxbps: %s\n", strerror(rv)); diff --git a/bin/xbps-rindex/remove-obsoletes.c b/bin/xbps-rindex/remove-obsoletes.c index 29b69bbb..264fde8b 100644 --- a/bin/xbps-rindex/remove-obsoletes.c +++ b/bin/xbps-rindex/remove-obsoletes.c @@ -83,7 +83,8 @@ cleaner_cb(struct xbps_handle *xhp, xbps_object_t obj, const char *key _unused, xbps_object_release(pkgd); return 0; } - printf("checking %s (%s)\n", pkgver, binpkg); + if (xhp->flags & XBPS_FLAG_VERBOSE) + printf("checking %s (%s)\n", pkgver, binpkg); /* * If binpkg is not registered in index, remove binpkg. */