* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2016-03-28 4:53 Mike Frysinger
0 siblings, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2016-03-28 4:53 UTC (permalink / raw
To: gentoo-commits
commit: d81fc0710ae12ce026053163370ab3dac5c1b1a5
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 28 03:53:50 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 03:53:50 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d81fc071
usage: add an extended text section
Many applets now are so complicated that a single line of text isn't
sufficient to describe all of its capabilities/nuances. Allow them
to pass in an arbitrary string of data to contain examples.
main.c | 13 ++++++++-----
man/qatom.1 | 4 ++--
man/qcache.1 | 4 ++--
man/qcheck.1 | 4 ++--
man/qdepends.1 | 4 ++--
man/qfile.1 | 4 ++--
man/qgrep.1 | 4 ++--
man/qlist.1 | 4 ++--
man/qlop.1 | 2 +-
man/qmerge.1 | 4 ++--
man/qpkg.1 | 4 ++--
man/qsearch.1 | 4 ++--
man/qsize.1 | 4 ++--
man/qtbz2.1 | 4 ++--
man/quse.1 | 4 ++--
man/qxpak.1 | 4 ++--
q.c | 2 +-
qatom.c | 2 +-
qcache.c | 2 +-
qcheck.c | 2 +-
qdepends.c | 2 +-
qfile.c | 2 +-
qglsa.c | 2 +-
qgrep.c | 2 +-
qlist.c | 2 +-
qlop.c | 9 ++++++++-
qmerge.c | 2 +-
qpkg.c | 2 +-
qsearch.c | 2 +-
qsize.c | 2 +-
qtbz2.c | 2 +-
quse.c | 2 +-
qxpak.c | 2 +-
template.c | 2 +-
34 files changed, 62 insertions(+), 52 deletions(-)
diff --git a/main.c b/main.c
index 0834756..a50b451 100644
--- a/main.c
+++ b/main.c
@@ -115,7 +115,7 @@ void no_colors(void)
/* display usage and exit */
static void usage(int status, const char *flags, struct option const opts[],
- const char * const help[], int blabber)
+ const char * const help[], const char *desc, int blabber)
{
const char opt_arg[] = "[arg]";
const char a_arg[] = "<arg>";
@@ -136,10 +136,13 @@ static void usage(int status, const char *flags, struct option const opts[],
DKBLUE, applets[i].opts, NORM,
RED, NORM, _(applets[i].desc));
} else if (blabber > 0) {
- printf("%sUsage:%s %s%s%s <opts> %s%s%s %s:%s %s\n", GREEN, NORM,
- YELLOW, applets[blabber].name, NORM,
- DKBLUE, applets[blabber].opts, NORM,
- RED, NORM, _(applets[blabber].desc));
+ printf("%sUsage:%s %s%s%s [opts] %s%s%s %s:%s %s\n",
+ GREEN, NORM,
+ YELLOW, applets[blabber].name, NORM,
+ DKBLUE, applets[blabber].opts, NORM,
+ RED, NORM, _(applets[blabber].desc));
+ if (desc)
+ printf("\n%s\n", desc);
}
if (module_name != NULL)
printf("%sLoaded module:%s\n%s%8s%s %s<args>%s\n", GREEN, NORM, YELLOW, module_name, NORM, DKBLUE, NORM);
diff --git a/man/qatom.1 b/man/qatom.1
index 42991a5..4a30343 100644
--- a/man/qatom.1
+++ b/man/qatom.1
@@ -1,9 +1,9 @@
-.TH qatom "1" "Feb 2016" "Gentoo Foundation" "qatom"
+.TH qatom "1" "Mar 2016" "Gentoo Foundation" "qatom"
.SH NAME
qatom \- split atom strings
.SH SYNOPSIS
.B qatom
-\fI<opts> <pkg>\fR
+\fI[opts] <pkg>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qcache.1 b/man/qcache.1
index 1f46e4b..81ae2fa 100644
--- a/man/qcache.1
+++ b/man/qcache.1
@@ -1,9 +1,9 @@
-.TH qcache "1" "Mar 2014" "Gentoo Foundation" "qcache"
+.TH qcache "1" "Mar 2016" "Gentoo Foundation" "qcache"
.SH NAME
qcache \- search the metadata cache
.SH SYNOPSIS
.B qcache
-\fI<opts> <action> <args>\fR
+\fI[opts] <action> <args>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qcheck.1 b/man/qcheck.1
index b686662..ed90c86 100644
--- a/man/qcheck.1
+++ b/man/qcheck.1
@@ -1,9 +1,9 @@
-.TH qcheck "1" "Feb 2016" "Gentoo Foundation" "qcheck"
+.TH qcheck "1" "Mar 2016" "Gentoo Foundation" "qcheck"
.SH NAME
qcheck \- verify integrity of installed packages
.SH SYNOPSIS
.B qcheck
-\fI<opts> <pkgname>\fR
+\fI[opts] <pkgname>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qdepends.1 b/man/qdepends.1
index 3b316a0..a0cac5b 100644
--- a/man/qdepends.1
+++ b/man/qdepends.1
@@ -1,9 +1,9 @@
-.TH qdepends "1" "Mar 2014" "Gentoo Foundation" "qdepends"
+.TH qdepends "1" "Mar 2016" "Gentoo Foundation" "qdepends"
.SH NAME
qdepends \- show dependency info
.SH SYNOPSIS
.B qdepends
-\fI<opts> <pkgname>\fR
+\fI[opts] <pkgname>\fR
.SH DESCRIPTION
The qdepends applet has a couple different modes. Normally it is geared towards
answering the queries "what does package X depend on" and "what packages depend
diff --git a/man/qfile.1 b/man/qfile.1
index 54823cd..e57e8e3 100644
--- a/man/qfile.1
+++ b/man/qfile.1
@@ -1,9 +1,9 @@
-.TH qfile "1" "Feb 2016" "Gentoo Foundation" "qfile"
+.TH qfile "1" "Mar 2016" "Gentoo Foundation" "qfile"
.SH NAME
qfile \- list all pkgs owning files
.SH SYNOPSIS
.B qfile
-\fI<opts> <filename>\fR
+\fI[opts] <filename>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qgrep.1 b/man/qgrep.1
index 1ff4797..e31e45a 100644
--- a/man/qgrep.1
+++ b/man/qgrep.1
@@ -1,9 +1,9 @@
-.TH qgrep "1" "Mar 2014" "Gentoo Foundation" "qgrep"
+.TH qgrep "1" "Mar 2016" "Gentoo Foundation" "qgrep"
.SH NAME
qgrep \- grep in ebuilds
.SH SYNOPSIS
.B qgrep
-\fI<opts> <misc args>\fR
+\fI[opts] <misc args>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qlist.1 b/man/qlist.1
index eedc2cd..05e9326 100644
--- a/man/qlist.1
+++ b/man/qlist.1
@@ -1,9 +1,9 @@
-.TH qlist "1" "Feb 2016" "Gentoo Foundation" "qlist"
+.TH qlist "1" "Mar 2016" "Gentoo Foundation" "qlist"
.SH NAME
qlist \- list files owned by pkgname
.SH SYNOPSIS
.B qlist
-\fI<opts> <pkgname>\fR
+\fI[opts] <pkgname>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qlop.1 b/man/qlop.1
index 77cf5ef..f8f0cdd 100644
--- a/man/qlop.1
+++ b/man/qlop.1
@@ -3,7 +3,7 @@
qlop \- emerge log analyzer
.SH SYNOPSIS
.B qlop
-\fI<opts> <pkgname>\fR
+\fI[opts] <pkgname>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qmerge.1 b/man/qmerge.1
index df928f1..f3d80db 100644
--- a/man/qmerge.1
+++ b/man/qmerge.1
@@ -1,9 +1,9 @@
-.TH qmerge "1" "Feb 2016" "Gentoo Foundation" "qmerge"
+.TH qmerge "1" "Mar 2016" "Gentoo Foundation" "qmerge"
.SH NAME
qmerge \- fetch and merge binary package
.SH SYNOPSIS
.B qmerge
-\fI<opts> <pkgnames>\fR
+\fI[opts] <pkgnames>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qpkg.1 b/man/qpkg.1
index ac99736..8bb098a 100644
--- a/man/qpkg.1
+++ b/man/qpkg.1
@@ -1,9 +1,9 @@
-.TH qpkg "1" "Mar 2014" "Gentoo Foundation" "qpkg"
+.TH qpkg "1" "Mar 2016" "Gentoo Foundation" "qpkg"
.SH NAME
qpkg \- manipulate Gentoo binpkgs
.SH SYNOPSIS
.B qpkg
-\fI<opts> <misc args>\fR
+\fI[opts] <misc args>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qsearch.1 b/man/qsearch.1
index 7d88c50..5f888ba 100644
--- a/man/qsearch.1
+++ b/man/qsearch.1
@@ -1,9 +1,9 @@
-.TH qsearch "1" "Mar 2014" "Gentoo Foundation" "qsearch"
+.TH qsearch "1" "Mar 2016" "Gentoo Foundation" "qsearch"
.SH NAME
qsearch \- search pkgname/desc
.SH SYNOPSIS
.B qsearch
-\fI<opts> <regex>\fR
+\fI[opts] <regex>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qsize.1 b/man/qsize.1
index af32869..aa613f8 100644
--- a/man/qsize.1
+++ b/man/qsize.1
@@ -1,9 +1,9 @@
-.TH qsize "1" "Feb 2016" "Gentoo Foundation" "qsize"
+.TH qsize "1" "Mar 2016" "Gentoo Foundation" "qsize"
.SH NAME
qsize \- calculate size usage
.SH SYNOPSIS
.B qsize
-\fI<opts> <pkgname>\fR
+\fI[opts] <pkgname>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qtbz2.1 b/man/qtbz2.1
index 2ecd77f..b22c70c 100644
--- a/man/qtbz2.1
+++ b/man/qtbz2.1
@@ -1,9 +1,9 @@
-.TH qtbz2 "1" "Mar 2014" "Gentoo Foundation" "qtbz2"
+.TH qtbz2 "1" "Mar 2016" "Gentoo Foundation" "qtbz2"
.SH NAME
qtbz2 \- manipulate tbz2 packages
.SH SYNOPSIS
.B qtbz2
-\fI<opts> <misc args>\fR
+\fI[opts] <misc args>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/quse.1 b/man/quse.1
index 78f4b5c..e1e6db9 100644
--- a/man/quse.1
+++ b/man/quse.1
@@ -1,9 +1,9 @@
-.TH quse "1" "Mar 2014" "Gentoo Foundation" "quse"
+.TH quse "1" "Mar 2016" "Gentoo Foundation" "quse"
.SH NAME
quse \- find pkgs using useflags
.SH SYNOPSIS
.B quse
-\fI<opts> <useflag>\fR
+\fI[opts] <useflag>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/man/qxpak.1 b/man/qxpak.1
index 733cad2..dbf36f6 100644
--- a/man/qxpak.1
+++ b/man/qxpak.1
@@ -1,9 +1,9 @@
-.TH qxpak "1" "Mar 2014" "Gentoo Foundation" "qxpak"
+.TH qxpak "1" "Mar 2016" "Gentoo Foundation" "qxpak"
.SH NAME
qxpak \- manipulate xpak archives
.SH SYNOPSIS
.B qxpak
-\fI<opts> <misc args>\fR
+\fI[opts] <misc args>\fR
.SH DESCRIPTION
.SH OPTIONS
diff --git a/q.c b/q.c
index 1475f99..6ee9aef 100644
--- a/q.c
+++ b/q.c
@@ -21,7 +21,7 @@ static const char * const q_opts_help[] = {
"Module path",
COMMON_OPTS_HELP
};
-#define q_usage(ret) usage(ret, Q_FLAGS, q_long_opts, q_opts_help, lookup_applet_idx("q"))
+#define q_usage(ret) usage(ret, Q_FLAGS, q_long_opts, q_opts_help, NULL, lookup_applet_idx("q"))
static APPLET lookup_applet(const char *applet)
{
diff --git a/qatom.c b/qatom.c
index acf9fd6..8cdffb1 100644
--- a/qatom.c
+++ b/qatom.c
@@ -21,7 +21,7 @@ static const char * const qatom_opts_help[] = {
"Compare two atoms",
COMMON_OPTS_HELP
};
-#define qatom_usage(ret) usage(ret, QATOM_FLAGS, qatom_long_opts, qatom_opts_help, lookup_applet_idx("qatom"))
+#define qatom_usage(ret) usage(ret, QATOM_FLAGS, qatom_long_opts, qatom_opts_help, NULL, lookup_applet_idx("qatom"))
/* Run printf on an atom! The format field takes the form:
* %{keyword}: Always display the field that matches "keyword"
diff --git a/qcache.c b/qcache.c
index 759e50a..222c8ae 100644
--- a/qcache.c
+++ b/qcache.c
@@ -44,7 +44,7 @@ static const char * const qcache_opts_help[] = {
"list packages that aren't keyworded on a given arch.",
COMMON_OPTS_HELP
};
-#define qcache_usage(ret) usage(ret, QCACHE_FLAGS, qcache_long_opts, qcache_opts_help, lookup_applet_idx("qcache"))
+#define qcache_usage(ret) usage(ret, QCACHE_FLAGS, qcache_long_opts, qcache_opts_help, NULL, lookup_applet_idx("qcache"))
/********************************************************************/
/* Structs */
diff --git a/qcheck.c b/qcheck.c
index 7f8031e..79f52a9 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -31,7 +31,7 @@ static const char * const qcheck_opts_help[] = {
"Undo prelink when calculating checksums",
COMMON_OPTS_HELP
};
-#define qcheck_usage(ret) usage(ret, QCHECK_FLAGS, qcheck_long_opts, qcheck_opts_help, lookup_applet_idx("qcheck"))
+#define qcheck_usage(ret) usage(ret, QCHECK_FLAGS, qcheck_long_opts, qcheck_opts_help, NULL, lookup_applet_idx("qcheck"))
#define qcprintf(fmt, args...) do { if (!state->bad_only) printf(_(fmt), ## args); } while (0)
diff --git a/qdepends.c b/qdepends.c
index f5867f8..7337c61 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -31,7 +31,7 @@ static const char * const qdepends_opts_help[] = {
"Pretty format specified depend strings",
COMMON_OPTS_HELP
};
-#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends"))
+#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, NULL, lookup_applet_idx("qdepends"))
static char qdep_name_only = 0;
diff --git a/qfile.c b/qfile.c
index 2848129..c6c3664 100644
--- a/qfile.c
+++ b/qfile.c
@@ -27,7 +27,7 @@ static const char * const qfile_opts_help[] = {
"Exact match (used with --exclude)",
COMMON_OPTS_HELP
};
-#define qfile_usage(ret) usage(ret, QFILE_FLAGS, qfile_long_opts, qfile_opts_help, lookup_applet_idx("qfile"))
+#define qfile_usage(ret) usage(ret, QFILE_FLAGS, qfile_long_opts, qfile_opts_help, NULL, lookup_applet_idx("qfile"))
#define qfile_is_prefix(path, prefix, prefix_length) \
(!prefix_length \
diff --git a/qglsa.c b/qglsa.c
index 885ce1e..6670093 100644
--- a/qglsa.c
+++ b/qglsa.c
@@ -27,7 +27,7 @@ static const char * const qglsa_opts_help[] = {
"Mark specified GLSAs as fixed",
COMMON_OPTS_HELP
};
-#define qglsa_usage(ret) usage(ret, QGLSA_FLAGS, qglsa_long_opts, qglsa_opts_help, lookup_applet_idx("qglsa"))
+#define qglsa_usage(ret) usage(ret, QGLSA_FLAGS, qglsa_long_opts, qglsa_opts_help, NULL, lookup_applet_idx("qglsa"))
typedef enum {
GLSA_FUNKYTOWN, GLSA_LIST, GLSA_DUMP, GLSA_TEST, GLSA_FIX, GLSA_INJECT
diff --git a/qgrep.c b/qgrep.c
index 7551ebb..73556ee 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -46,7 +46,7 @@ static const char * const qgrep_opts_help[] = {
"Print <arg> lines of trailing context",
COMMON_OPTS_HELP
};
-#define qgrep_usage(ret) usage(ret, QGREP_FLAGS, qgrep_long_opts, qgrep_opts_help, lookup_applet_idx("qgrep"))
+#define qgrep_usage(ret) usage(ret, QGREP_FLAGS, qgrep_long_opts, qgrep_opts_help, NULL, lookup_applet_idx("qgrep"))
char qgrep_name_match(const char*, const int, depend_atom**);
char qgrep_name_match(const char* name, const int argc, depend_atom** argv)
diff --git a/qlist.c b/qlist.c
index cd52bf0..a5b17af 100644
--- a/qlist.c
+++ b/qlist.c
@@ -40,7 +40,7 @@ static const char * const qlist_opts_help[] = {
/* "query filename for pkgname", */
COMMON_OPTS_HELP
};
-#define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, lookup_applet_idx("qlist"))
+#define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, NULL, lookup_applet_idx("qlist"))
static char *grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx)
{
diff --git a/qlop.c b/qlop.c
index 0da636a..30e9f2f 100644
--- a/qlop.c
+++ b/qlop.c
@@ -35,7 +35,14 @@ static const char * const qlop_opts_help[] = {
"Read emerge logfile instead of $EMERGE_LOG_DIR/" QLOP_DEFAULT_LOGFILE,
COMMON_OPTS_HELP
};
-#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop"))
+static const char qlop_desc[] =
+ "The --date option can take a few forms:\n"
+ " -d '# <day|week|month|year>[s] [ago]' (e.g. '3 days ago')\n"
+ "Or using strptime(3) formats:\n"
+ " -d '2015-12-25' (detected as %F)\n"
+ " -d '1459101740' (detected as %s)\n"
+ " -d '%d.%m.%Y|25.12.2015' (format is specified)";
+#define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, qlop_desc, lookup_applet_idx("qlop"))
#define QLOP_LIST 0x01
#define QLOP_UNLIST 0x02
diff --git a/qmerge.c b/qmerge.c
index 297f939..b734a87 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -62,7 +62,7 @@ static const char * const qmerge_opts_help[] = {
"Run shell funcs with `set -x`",
COMMON_OPTS_HELP
};
-#define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge"))
+#define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, NULL, lookup_applet_idx("qmerge"))
char search_pkgs = 0;
char interactive = 1;
diff --git a/qpkg.c b/qpkg.c
index 996efcd..2cc658e 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -25,7 +25,7 @@ static const char * const qpkg_opts_help[] = {
"alternate package directory",
COMMON_OPTS_HELP
};
-#define qpkg_usage(ret) usage(ret, QPKG_FLAGS, qpkg_long_opts, qpkg_opts_help, lookup_applet_idx("qpkg"))
+#define qpkg_usage(ret) usage(ret, QPKG_FLAGS, qpkg_long_opts, qpkg_opts_help, NULL, lookup_applet_idx("qpkg"))
extern char pretend;
diff --git a/qsearch.c b/qsearch.c
index 2ba2d39..e23642b 100644
--- a/qsearch.c
+++ b/qsearch.c
@@ -29,7 +29,7 @@ static const char * const qsearch_opts_help[] = {
"Show homepage info",
COMMON_OPTS_HELP
};
-#define qsearch_usage(ret) usage(ret, QSEARCH_FLAGS, qsearch_long_opts, qsearch_opts_help, lookup_applet_idx("qsearch"))
+#define qsearch_usage(ret) usage(ret, QSEARCH_FLAGS, qsearch_long_opts, qsearch_opts_help, NULL, lookup_applet_idx("qsearch"))
#define LAST_BUF_SIZE 256
diff --git a/qsize.c b/qsize.c
index db00247..376a772 100644
--- a/qsize.c
+++ b/qsize.c
@@ -29,7 +29,7 @@ static const char * const qsize_opts_help[] = {
"Ignore regexp string",
COMMON_OPTS_HELP
};
-#define qsize_usage(ret) usage(ret, QSIZE_FLAGS, qsize_long_opts, qsize_opts_help, lookup_applet_idx("qsize"))
+#define qsize_usage(ret) usage(ret, QSIZE_FLAGS, qsize_long_opts, qsize_opts_help, NULL, lookup_applet_idx("qsize"))
struct qsize_opt_state {
array_t *atoms;
diff --git a/qtbz2.c b/qtbz2.c
index da2e9ab..6e6fff6 100644
--- a/qtbz2.c
+++ b/qtbz2.c
@@ -45,7 +45,7 @@ static const char * const qtbz2_opts_help[] = {
"Write files to stdout",
COMMON_OPTS_HELP
};
-#define qtbz2_usage(ret) usage(ret, QTBZ2_FLAGS, qtbz2_long_opts, qtbz2_opts_help, lookup_applet_idx("qtbz2"))
+#define qtbz2_usage(ret) usage(ret, QTBZ2_FLAGS, qtbz2_long_opts, qtbz2_opts_help, NULL, lookup_applet_idx("qtbz2"))
static char tbz2_stdout = 0;
diff --git a/quse.c b/quse.c
index 59db37a..81d99d8 100644
--- a/quse.c
+++ b/quse.c
@@ -34,7 +34,7 @@ static const char * const quse_opts_help[] = {
"Only show package name",
COMMON_OPTS_HELP
};
-#define quse_usage(ret) usage(ret, QUSE_FLAGS, quse_long_opts, quse_opts_help, lookup_applet_idx("quse"))
+#define quse_usage(ret) usage(ret, QUSE_FLAGS, quse_long_opts, quse_opts_help, NULL, lookup_applet_idx("quse"))
char quse_name_only = 0;
diff --git a/qxpak.c b/qxpak.c
index fb19ef9..baceda9 100644
--- a/qxpak.c
+++ b/qxpak.c
@@ -45,7 +45,7 @@ static const char * const qxpak_opts_help[] = {
"Write files to stdout",
COMMON_OPTS_HELP
};
-#define qxpak_usage(ret) usage(ret, QXPAK_FLAGS, qxpak_long_opts, qxpak_opts_help, lookup_applet_idx("qxpak"))
+#define qxpak_usage(ret) usage(ret, QXPAK_FLAGS, qxpak_long_opts, qxpak_opts_help, NULL, lookup_applet_idx("qxpak"))
typedef struct {
int dir_fd;
diff --git a/template.c b/template.c
index d4b9e98..877a187 100644
--- a/template.c
+++ b/template.c
@@ -15,7 +15,7 @@ static struct option const qtemp_long_opts[] = {
static const char * const qtemp_opts_help[] = {
COMMON_OPTS_HELP
};
-#define qtemp_usage(ret) usage(ret, QTEMP_FLAGS, qtemp_long_opts, qtemp_opts_help, lookup_applet_idx("qtemp"))
+#define qtemp_usage(ret) usage(ret, QTEMP_FLAGS, qtemp_long_opts, qtemp_opts_help, NULL, lookup_applet_idx("qtemp"))
int qtemp_main(int argc, char **argv)
{
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-02-28 19:28 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-02-28 19:28 UTC (permalink / raw
To: gentoo-commits
commit: 951a8711a59b1a7d49125f5f5214ff1ae9e50074
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 28 19:27:12 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Feb 28 19:27:12 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=951a8711
qfile: drop non-functional --exact option
Bug: https://bugs.gentoo.org/678632
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qfile.1 | 3 ---
qfile.c | 11 ++---------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/man/qfile.1 b/man/qfile.1
index c7f7054..6bf07c0 100644
--- a/man/qfile.1
+++ b/man/qfile.1
@@ -27,9 +27,6 @@ List orphan files.
\fB\-x\fR \fI<arg>\fR, \fB\-\-exclude\fR \fI<arg>\fR
Don't look in package <arg> (used with --orphans).
.TP
-\fB\-e\fR, \fB\-\-exact\fR
-Exact match (used with --exclude).
-.TP
\fB\-\-root\fR \fI<arg>\fR
Set the ROOT env var.
.TP
diff --git a/qfile.c b/qfile.c
index 285277b..6e1cb0a 100644
--- a/qfile.c
+++ b/qfile.c
@@ -8,14 +8,13 @@
#ifdef APPLET_qfile
-#define QFILE_FLAGS "beoRx:S" COMMON_FLAGS
+#define QFILE_FLAGS "boRx:S" COMMON_FLAGS
static struct option const qfile_long_opts[] = {
{"slots", no_argument, NULL, 'S'},
{"root-prefix", no_argument, NULL, 'R'},
{"basename", no_argument, NULL, 'b'},
{"orphans", no_argument, NULL, 'o'},
{"exclude", a_argument, NULL, 'x'},
- {"exact", no_argument, NULL, 'e'},
COMMON_LONG_OPTS
};
static const char * const qfile_opts_help[] = {
@@ -24,7 +23,6 @@ static const char * const qfile_opts_help[] = {
"Match any component of the path",
"List orphan files",
"Don't look in package <arg> (used with --orphans)",
- "Exact match (used with --exclude)",
COMMON_OPTS_HELP
};
#define qfile_usage(ret) usage(ret, QFILE_FLAGS, qfile_long_opts, qfile_opts_help, NULL, lookup_applet_idx("qfile"))
@@ -56,7 +54,6 @@ struct qfile_opt_state {
depend_atom *exclude_atom;
bool slotted;
bool basename;
- bool exact;
bool orphans;
bool assume_root_prefix;
};
@@ -224,7 +221,7 @@ static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
} else
slot[0] = '\0';
printf("%s%s/%s%s%s%s", BOLD, atom->CATEGORY, BLUE,
- (state->exact ? pkg_ctx->name : atom->PN),
+ (verbose ? pkg_ctx->name : atom->PN),
slot, NORM);
if (quiet)
puts("");
@@ -402,7 +399,6 @@ int qfile_main(int argc, char **argv)
.buflen = _Q_PATH_MAX,
.slotted = false,
.basename = false,
- .exact = false,
.orphans = false,
.assume_root_prefix = false,
};
@@ -414,7 +410,6 @@ int qfile_main(int argc, char **argv)
COMMON_GETOPTS_CASES(qfile)
case 'S': state.slotted = true; break;
case 'b': state.basename = true; break;
- case 'e': state.exact = true; break;
case 'o': state.orphans = true; break;
case 'R': state.assume_root_prefix = true; break;
case 'x':
@@ -429,8 +424,6 @@ int qfile_main(int argc, char **argv)
break;
}
}
- if (!state.exact && verbose)
- state.exact = true;
if (argc == optind)
qfile_usage(EXIT_FAILURE);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-04-28 8:52 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-04-28 8:52 UTC (permalink / raw
To: gentoo-commits
commit: 92192efb2f621ad13a412d659bb682989a301acc
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 28 08:50:43 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Apr 28 08:50:43 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=92192efb
qgrep: use colours for atom printing, and support -R/--repo
use same colour scheme as with qlist, qdepends, etc.
support printing repo for ebuilds mode
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qgrep.1 | 3 +++
qgrep.c | 43 ++++++++++++++++++++++++++-----------------
2 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/man/qgrep.1 b/man/qgrep.1
index 347c88c..34fe54d 100644
--- a/man/qgrep.1
+++ b/man/qgrep.1
@@ -50,6 +50,9 @@ Search in eclasses instead of ebuilds.
\fB\-s\fR, \fB\-\-skip\-comments\fR
Skip comments lines.
.TP
+\fB\-R\fR, \fB\-\-repo\fR
+Print source repository name for each match (implies -N).
+.TP
\fB\-S\fR \fI<arg>\fR, \fB\-\-skip\fR \fI<arg>\fR
Skip lines matching <arg>.
.TP
diff --git a/qgrep.c b/qgrep.c
index 3950c22..9d78c18 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -25,7 +25,7 @@
#include "xchdir.h"
#include "xregex.h"
-#define QGREP_FLAGS "IiHNclLexJEsS:B:A:" COMMON_FLAGS
+#define QGREP_FLAGS "IiHNclLexJEsRS:B:A:" COMMON_FLAGS
static struct option const qgrep_long_opts[] = {
{"invert-match", no_argument, NULL, 'I'},
{"ignore-case", no_argument, NULL, 'i'},
@@ -39,6 +39,7 @@ static struct option const qgrep_long_opts[] = {
{"installed", no_argument, NULL, 'J'},
{"eclass", no_argument, NULL, 'E'},
{"skip-comments", no_argument, NULL, 's'},
+ {"repo", no_argument, NULL, 'R'},
{"skip", a_argument, NULL, 'S'},
{"before", a_argument, NULL, 'B'},
{"after", a_argument, NULL, 'A'},
@@ -57,6 +58,7 @@ static const char * const qgrep_opts_help[] = {
"Search in installed ebuilds instead of the tree",
"Search in eclasses instead of ebuilds",
"Skip comments lines",
+ "Print source repository name for each match (implies -N)",
"Skip lines matching <arg>",
"Print <arg> lines of leading context",
"Print <arg> lines of trailing context",
@@ -198,6 +200,7 @@ struct qgrep_grepargs {
bool do_list:1;
bool show_filename:1;
bool show_name:1;
+ bool show_repo:1;
bool skip_comments:1;
bool invert_list:1;
bool invert_match:1;
@@ -421,7 +424,10 @@ qgrep_cache_cb(cache_pkg_ctx *pkg_ctx, void *priv)
label = NULL;
if (data->show_name) {
- snprintf(name, sizeof(name), "%s/%s", patom->CATEGORY, patom->P);
+ char *repo = data->show_repo ? cctx->repo : NULL;
+ snprintf(name, sizeof(name), "%s%s/%s%s%s%s%s%s",
+ BOLD, patom->CATEGORY, BLUE, patom->P, GREEN,
+ repo ? "::" : "", repo ? repo : "", NORM);
label = name;
} else if (data->show_filename) {
label = buf;
@@ -473,7 +479,8 @@ qgrep_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
label = NULL;
if (data->show_name) {
- snprintf(name, sizeof(name), "%s/%s", patom->CATEGORY, patom->P);
+ snprintf(name, sizeof(name), "%s%s/%s%s%s",
+ BOLD, patom->CATEGORY, BLUE, patom->P, NORM);
label = name;
} else if (data->show_filename) {
label = buf;
@@ -523,25 +530,26 @@ int qgrep_main(int argc, char **argv)
while ((i = GETOPT_LONG(QGREP, qgrep, "")) != -1) {
switch (i) {
- case 'I': args.invert_match = 1; break;
+ case 'I': args.invert_match = true; break;
case 'i':
args.strfunc = strcasestr;
reflags |= REG_ICASE;
break;
- case 'c': args.do_count = 1; break;
- case 'l': args.do_list = 1; break;
- case 'L': args.do_list = args.invert_list = 1; break;
- case 'e': args.do_regex = 1; break;
+ case 'c': args.do_count = true; break;
+ case 'l': args.do_list = true; break;
+ case 'L': args.do_list = args.invert_list = true; break;
+ case 'e': args.do_regex = true; break;
case 'x':
- args.do_regex = 1;
+ args.do_regex = true;
reflags |= REG_EXTENDED;
break;
- case 'J': do_installed = 1; break;
- case 'E': do_eclass = 1; break;
- case 'H': args.show_filename = 1; break;
- case 'N': args.show_name = 1; break;
- case 's': args.skip_comments = 1; break;
- case 'S': args.skip_pattern = optarg; break;
+ case 'J': do_installed = true; break;
+ case 'E': do_eclass = true; break;
+ case 'H': args.show_filename = true; break;
+ case 'N': args.show_name = true; break;
+ case 's': args.skip_comments = true; break;
+ case 'R': args.show_repo = args.show_name = true; break;
+ case 'S': args.skip_pattern = optarg; break;
case 'B':
case 'A':
errno = 0;
@@ -667,8 +675,9 @@ int qgrep_main(int argc, char **argv)
label = NULL;
if (args.show_name) {
- snprintf(name, sizeof(name), "%.*s",
- (int)(strlen(dentry->d_name) - 7), dentry->d_name);
+ snprintf(name, sizeof(name), "%s%.*s%s", BLUE,
+ (int)(strlen(dentry->d_name) - 7), dentry->d_name,
+ NORM);
label = name;
} else if (args.show_filename) {
snprintf(name, sizeof(name), "eclass/%s", dentry->d_name);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-05-02 18:02 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-05-02 18:02 UTC (permalink / raw
To: gentoo-commits
commit: 6eee66bd91df5928c0fbf1ee9cd2ff8a3f575d89
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu May 2 18:00:17 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu May 2 18:00:17 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6eee66bd
qcache: rename to qkeyword
qcache has its roots in reading the metadata cache, but since this is
standard functionality provided by libq/cache now, all that qcache does
really is things with keywords.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
.gitignore | 4 +-
Makefile.am | 6 +--
Makefile.in | 40 ++++++++--------
TODO.md | 2 -
applets.h | 4 +-
man/q.1 | 6 +--
man/qatom.1 | 4 +-
man/qcheck.1 | 4 +-
man/qdepends.1 | 4 +-
man/qfile.1 | 4 +-
man/qgrep.1 | 4 +-
man/{qcache.1 => qkeyword.1} | 6 +--
man/qlist.1 | 4 +-
man/qlop.1 | 4 +-
man/qmerge.1 | 4 +-
man/qpkg.1 | 4 +-
man/qsearch.1 | 4 +-
man/qsize.1 | 4 +-
man/qtbz2.1 | 4 +-
man/qtegrity.1 | 4 +-
man/quse.1 | 2 +-
man/qxpak.1 | 4 +-
qcache.c => qkeyword.c | 112 +++++++++++++++++++++----------------------
23 files changed, 118 insertions(+), 120 deletions(-)
diff --git a/.gitignore b/.gitignore
index c571c4e..b65a0fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,18 +32,18 @@ stamp-h1
/*.old.c
/q
/qatom
-/qcache
/qcheck
/qdepends
/qfile
/qglsa
/qgrep
+/qkeyword
/qlist
/qlop
/qmerge
/qpkg
/qsearch
/qsize
+/qtegrity
/quse
/qxpak
-/qtegrity
diff --git a/Makefile.am b/Makefile.am
index 9306019..b36173c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,11 +10,11 @@ SUBDIRS = \
APPLETS = \
q \
qatom \
- qcache \
qcheck \
qdepends \
qfile \
qgrep \
+ qkeyword \
qlist \
qlop \
qmerge \
@@ -30,11 +30,11 @@ APPLETS = \
dist_man_MANS = \
man/q.1 \
man/qatom.1 \
- man/qcache.1 \
man/qcheck.1 \
man/qdepends.1 \
man/qfile.1 \
man/qgrep.1 \
+ man/qkeyword.1 \
man/qlist.1 \
man/qlop.1 \
man/qmerge.1 \
@@ -52,11 +52,11 @@ q_SOURCES = \
main.c \
q.c \
qatom.c \
- qcache.c \
qcheck.c \
qdepends.c \
qfile.c \
qgrep.c \
+ qkeyword.c \
qlist.c \
qlop.c \
qmerge.c \
diff --git a/Makefile.in b/Makefile.in
index b211bdd..6af9c8a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -246,8 +246,8 @@ CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
PROGRAMS = $(bin_PROGRAMS)
am_q_OBJECTS = q-main.$(OBJEXT) q-q.$(OBJEXT) q-qatom.$(OBJEXT) \
- q-qcache.$(OBJEXT) q-qcheck.$(OBJEXT) q-qdepends.$(OBJEXT) \
- q-qfile.$(OBJEXT) q-qgrep.$(OBJEXT) q-qlist.$(OBJEXT) \
+ q-qcheck.$(OBJEXT) q-qdepends.$(OBJEXT) q-qfile.$(OBJEXT) \
+ q-qgrep.$(OBJEXT) q-qkeyword.$(OBJEXT) q-qlist.$(OBJEXT) \
q-qlop.$(OBJEXT) q-qmerge.$(OBJEXT) q-qpkg.$(OBJEXT) \
q-qsearch.$(OBJEXT) q-qsize.$(OBJEXT) q-qtbz2.$(OBJEXT) \
q-qtegrity.$(OBJEXT) q-quse.$(OBJEXT) q-qxpak.$(OBJEXT)
@@ -1550,11 +1550,11 @@ SUBDIRS = \
APPLETS = \
q \
qatom \
- qcache \
qcheck \
qdepends \
qfile \
qgrep \
+ qkeyword \
qlist \
qlop \
qmerge \
@@ -1570,11 +1570,11 @@ APPLETS = \
dist_man_MANS = \
man/q.1 \
man/qatom.1 \
- man/qcache.1 \
man/qcheck.1 \
man/qdepends.1 \
man/qfile.1 \
man/qgrep.1 \
+ man/qkeyword.1 \
man/qlist.1 \
man/qlop.1 \
man/qmerge.1 \
@@ -1591,11 +1591,11 @@ q_SOURCES = \
main.c \
q.c \
qatom.c \
- qcache.c \
qcheck.c \
qdepends.c \
qfile.c \
qgrep.c \
+ qkeyword.c \
qlist.c \
qlop.c \
qmerge.c \
@@ -1744,11 +1744,11 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-q.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qatom.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qcache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qcheck.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qdepends.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qgrep.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qkeyword.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qlop.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/q-qmerge.Po@am__quote@
@@ -1823,20 +1823,6 @@ q-qatom.obj: qatom.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qatom.obj `if test -f 'qatom.c'; then $(CYGPATH_W) 'qatom.c'; else $(CYGPATH_W) '$(srcdir)/qatom.c'; fi`
-q-qcache.o: qcache.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT q-qcache.o -MD -MP -MF $(DEPDIR)/q-qcache.Tpo -c -o q-qcache.o `test -f 'qcache.c' || echo '$(srcdir)/'`qcache.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/q-qcache.Tpo $(DEPDIR)/q-qcache.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='qcache.c' object='q-qcache.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qcache.o `test -f 'qcache.c' || echo '$(srcdir)/'`qcache.c
-
-q-qcache.obj: qcache.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT q-qcache.obj -MD -MP -MF $(DEPDIR)/q-qcache.Tpo -c -o q-qcache.obj `if test -f 'qcache.c'; then $(CYGPATH_W) 'qcache.c'; else $(CYGPATH_W) '$(srcdir)/qcache.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/q-qcache.Tpo $(DEPDIR)/q-qcache.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='qcache.c' object='q-qcache.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qcache.obj `if test -f 'qcache.c'; then $(CYGPATH_W) 'qcache.c'; else $(CYGPATH_W) '$(srcdir)/qcache.c'; fi`
-
q-qcheck.o: qcheck.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT q-qcheck.o -MD -MP -MF $(DEPDIR)/q-qcheck.Tpo -c -o q-qcheck.o `test -f 'qcheck.c' || echo '$(srcdir)/'`qcheck.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/q-qcheck.Tpo $(DEPDIR)/q-qcheck.Po
@@ -1893,6 +1879,20 @@ q-qgrep.obj: qgrep.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qgrep.obj `if test -f 'qgrep.c'; then $(CYGPATH_W) 'qgrep.c'; else $(CYGPATH_W) '$(srcdir)/qgrep.c'; fi`
+q-qkeyword.o: qkeyword.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT q-qkeyword.o -MD -MP -MF $(DEPDIR)/q-qkeyword.Tpo -c -o q-qkeyword.o `test -f 'qkeyword.c' || echo '$(srcdir)/'`qkeyword.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/q-qkeyword.Tpo $(DEPDIR)/q-qkeyword.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='qkeyword.c' object='q-qkeyword.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qkeyword.o `test -f 'qkeyword.c' || echo '$(srcdir)/'`qkeyword.c
+
+q-qkeyword.obj: qkeyword.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT q-qkeyword.obj -MD -MP -MF $(DEPDIR)/q-qkeyword.Tpo -c -o q-qkeyword.obj `if test -f 'qkeyword.c'; then $(CYGPATH_W) 'qkeyword.c'; else $(CYGPATH_W) '$(srcdir)/qkeyword.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/q-qkeyword.Tpo $(DEPDIR)/q-qkeyword.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='qkeyword.c' object='q-qkeyword.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qkeyword.obj `if test -f 'qkeyword.c'; then $(CYGPATH_W) 'qkeyword.c'; else $(CYGPATH_W) '$(srcdir)/qkeyword.c'; fi`
+
q-qlist.o: qlist.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT q-qlist.o -MD -MP -MF $(DEPDIR)/q-qlist.Tpo -c -o q-qlist.o `test -f 'qlist.c' || echo '$(srcdir)/'`qlist.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/q-qlist.Tpo $(DEPDIR)/q-qlist.Po
diff --git a/TODO.md b/TODO.md
index 9d44710..007d906 100644
--- a/TODO.md
+++ b/TODO.md
@@ -30,8 +30,6 @@
- vdb repo/slot think about when it is freed (see cache\_pkg\_close)
-- qcache -> rename to qkeyword
-
- quse -K -> move to qkeyword
# Atoms
diff --git a/applets.h b/applets.h
index 4dd5bc2..8cb537a 100644
--- a/applets.h
+++ b/applets.h
@@ -52,7 +52,7 @@ DECLARE_APPLET(qpkg)
DECLARE_APPLET(qgrep)
DECLARE_APPLET(qatom)
DECLARE_APPLET(qmerge)
-DECLARE_APPLET(qcache)
+DECLARE_APPLET(qkeyword)
/*DECLARE_APPLET(qglsa) disable */
DECLARE_APPLET(qtegrity)
#undef DECLARE_APPLET
@@ -66,7 +66,7 @@ static const struct applet_t {
/* q must always be the first applet */
{"q", q_main, "<applet> <args>", "virtual applet"},
{"qatom", qatom_main, "<pkg>", "split atom strings"},
- {"qcache", qcache_main, "<action> <args>", "search the metadata cache"},
+ {"qkeyword", qkeyword_main, "<action> <args>", "list packages based on keywords"},
{"qcheck", qcheck_main, "<pkgname>", "verify integrity of installed packages"},
{"qdepends", qdepends_main, "<pkgname>", "show dependency info"},
{"qfile", qfile_main, "<filename>", "list all pkgs owning files"},
diff --git a/man/q.1 b/man/q.1
index afba24a..cbf2303 100644
--- a/man/q.1
+++ b/man/q.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH q "1" "Apr 2019" "Gentoo Foundation" "q"
+.TH q "1" "May 2019" "Gentoo Foundation" "q"
.SH NAME
q \- invoke a portage utility applet
.SH SYNOPSIS
@@ -37,7 +37,7 @@ Print version and exit.
.B This applet also has sub applets:
q <applet> <args> : virtual applet
qatom <pkg> : split atom strings
- qcache <action> <args> : search the metadata cache
+ qkeyword <action> <args> : list packages based on keywords
qcheck <pkgname> : verify integrity of installed packages
qdepends <pkgname> : show dependency info
qfile <filename> : list all pkgs owning files
@@ -65,11 +65,11 @@ Fabian Groffen <grobian@gentoo.org>
.fi
.SH "SEE ALSO"
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qatom.1 b/man/qatom.1
index 046b89e..15799c4 100644
--- a/man/qatom.1
+++ b/man/qatom.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qatom "1" "Apr 2019" "Gentoo Foundation" "qatom"
+.TH qatom "1" "May 2019" "Gentoo Foundation" "qatom"
.SH NAME
qatom \- split atom strings
.SH SYNOPSIS
@@ -100,11 +100,11 @@ Fabian Groffen <grobian@gentoo.org>
.fi
.SH "SEE ALSO"
.BR q (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qcheck.1 b/man/qcheck.1
index c139744..336813f 100644
--- a/man/qcheck.1
+++ b/man/qcheck.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qcheck "1" "Apr 2019" "Gentoo Foundation" "qcheck"
+.TH qcheck "1" "May 2019" "Gentoo Foundation" "qcheck"
.SH NAME
qcheck \- verify integrity of installed packages
.SH SYNOPSIS
@@ -64,10 +64,10 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qdepends.1 b/man/qdepends.1
index dcaef0c..1020b9a 100644
--- a/man/qdepends.1
+++ b/man/qdepends.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qdepends "1" "Apr 2019" "Gentoo Foundation" "qdepends"
+.TH qdepends "1" "May 2019" "Gentoo Foundation" "qdepends"
.SH NAME
qdepends \- show dependency info
.SH SYNOPSIS
@@ -121,10 +121,10 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qfile.1 b/man/qfile.1
index 5cd297a..1440bd7 100644
--- a/man/qfile.1
+++ b/man/qfile.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qfile "1" "Apr 2019" "Gentoo Foundation" "qfile"
+.TH qfile "1" "May 2019" "Gentoo Foundation" "qfile"
.SH NAME
qfile \- list all pkgs owning files
.SH SYNOPSIS
@@ -214,10 +214,10 @@ TGL <degrenier[at]easyconnect.fr>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qgrep.1 b/man/qgrep.1
index 34fe54d..78ffb19 100644
--- a/man/qgrep.1
+++ b/man/qgrep.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qgrep "1" "Apr 2019" "Gentoo Foundation" "qgrep"
+.TH qgrep "1" "May 2019" "Gentoo Foundation" "qgrep"
.SH NAME
qgrep \- grep in ebuilds
.SH SYNOPSIS
@@ -94,10 +94,10 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qcache.1 b/man/qkeyword.1
similarity index 93%
rename from man/qcache.1
rename to man/qkeyword.1
index 675059e..a575404 100644
--- a/man/qcache.1
+++ b/man/qkeyword.1
@@ -1,9 +1,9 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qcache "1" "Apr 2019" "Gentoo Foundation" "qcache"
+.TH qkeyword "1" "May 2019" "Gentoo Foundation" "qkeyword"
.SH NAME
-qcache \- search the metadata cache
+qkeyword \- list packages based on keywords
.SH SYNOPSIS
-.B qcache
+.B qkeyword
\fI[opts] <action> <args>\fR
.SH DESCRIPTION
diff --git a/man/qlist.1 b/man/qlist.1
index 0b16318..3932319 100644
--- a/man/qlist.1
+++ b/man/qlist.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qlist "1" "Apr 2019" "Gentoo Foundation" "qlist"
+.TH qlist "1" "May 2019" "Gentoo Foundation" "qlist"
.SH NAME
qlist \- list files owned by pkgname
.SH SYNOPSIS
@@ -86,11 +86,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlop (1),
.BR qmerge (1),
.BR qpkg (1),
diff --git a/man/qlop.1 b/man/qlop.1
index 4dd31c1..83b62f8 100644
--- a/man/qlop.1
+++ b/man/qlop.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qlop "1" "Apr 2019" "Gentoo Foundation" "qlop"
+.TH qlop "1" "May 2019" "Gentoo Foundation" "qlop"
.SH NAME
qlop \- emerge log analyzer
.SH SYNOPSIS
@@ -135,11 +135,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qmerge (1),
.BR qpkg (1),
diff --git a/man/qmerge.1 b/man/qmerge.1
index d303e45..e0503e1 100644
--- a/man/qmerge.1
+++ b/man/qmerge.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qmerge "1" "Apr 2019" "Gentoo Foundation" "qmerge"
+.TH qmerge "1" "May 2019" "Gentoo Foundation" "qmerge"
.SH NAME
qmerge \- fetch and merge binary package
.SH SYNOPSIS
@@ -75,11 +75,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qpkg (1),
diff --git a/man/qpkg.1 b/man/qpkg.1
index 17278ec..4fb265c 100644
--- a/man/qpkg.1
+++ b/man/qpkg.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qpkg "1" "Apr 2019" "Gentoo Foundation" "qpkg"
+.TH qpkg "1" "May 2019" "Gentoo Foundation" "qpkg"
.SH NAME
qpkg \- manipulate Gentoo binpkgs
.SH SYNOPSIS
@@ -55,11 +55,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qsearch.1 b/man/qsearch.1
index 1bea7ab..af27416 100644
--- a/man/qsearch.1
+++ b/man/qsearch.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qsearch "1" "Apr 2019" "Gentoo Foundation" "qsearch"
+.TH qsearch "1" "May 2019" "Gentoo Foundation" "qsearch"
.SH NAME
qsearch \- search pkgname/desc
.SH SYNOPSIS
@@ -60,11 +60,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qsize.1 b/man/qsize.1
index 9733e04..bcad17e 100644
--- a/man/qsize.1
+++ b/man/qsize.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qsize "1" "Apr 2019" "Gentoo Foundation" "qsize"
+.TH qsize "1" "May 2019" "Gentoo Foundation" "qsize"
.SH NAME
qsize \- calculate size usage
.SH SYNOPSIS
@@ -64,11 +64,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qtbz2.1 b/man/qtbz2.1
index bb591b1..f177128 100644
--- a/man/qtbz2.1
+++ b/man/qtbz2.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qtbz2 "1" "Apr 2019" "Gentoo Foundation" "qtbz2"
+.TH qtbz2 "1" "May 2019" "Gentoo Foundation" "qtbz2"
.SH NAME
qtbz2 \- manipulate tbz2 packages
.SH SYNOPSIS
@@ -59,11 +59,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qtegrity.1 b/man/qtegrity.1
index 429c4f7..048d4fa 100644
--- a/man/qtegrity.1
+++ b/man/qtegrity.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qtegrity "1" "Apr 2019" "Gentoo Foundation" "qtegrity"
+.TH qtegrity "1" "May 2019" "Gentoo Foundation" "qtegrity"
.SH NAME
qtegrity \- verify files with IMA
.SH SYNOPSIS
@@ -65,11 +65,11 @@ Sam Besselink
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/quse.1 b/man/quse.1
index bb02306..6f0d8d3 100644
--- a/man/quse.1
+++ b/man/quse.1
@@ -58,11 +58,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/man/qxpak.1 b/man/qxpak.1
index ccd94a1..529e8b3 100644
--- a/man/qxpak.1
+++ b/man/qxpak.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qxpak "1" "Apr 2019" "Gentoo Foundation" "qxpak"
+.TH qxpak "1" "May 2019" "Gentoo Foundation" "qxpak"
.SH NAME
qxpak \- manipulate xpak archives
.SH SYNOPSIS
@@ -55,11 +55,11 @@ Fabian Groffen <grobian@gentoo.org>
.SH "SEE ALSO"
.BR q (1),
.BR qatom (1),
-.BR qcache (1),
.BR qcheck (1),
.BR qdepends (1),
.BR qfile (1),
.BR qgrep (1),
+.BR qkeyword (1),
.BR qlist (1),
.BR qlop (1),
.BR qmerge (1),
diff --git a/qcache.c b/qkeyword.c
similarity index 85%
rename from qcache.c
rename to qkeyword.c
index 116f389..17430fc 100644
--- a/qcache.c
+++ b/qkeyword.c
@@ -28,8 +28,8 @@
/* Required portage-utils stuff */
/********************************************************************/
-#define QCACHE_FLAGS "p:c:idtans" COMMON_FLAGS
-static struct option const qcache_long_opts[] = {
+#define QKEYWORD_FLAGS "p:c:idtans" COMMON_FLAGS
+static struct option const qkeyword_long_opts[] = {
{"matchpkg", a_argument, NULL, 'p'},
{"matchcat", a_argument, NULL, 'c'},
{"imlate", no_argument, NULL, 'i'},
@@ -40,7 +40,7 @@ static struct option const qcache_long_opts[] = {
{"not", no_argument, NULL, 'n'},
COMMON_LONG_OPTS
};
-static const char * const qcache_opts_help[] = {
+static const char * const qkeyword_opts_help[] = {
"match pkgname",
"match catname",
"list packages that can be marked stable on a given arch",
@@ -51,7 +51,7 @@ static const char * const qcache_opts_help[] = {
"list packages that aren't keyworded on a given arch.",
COMMON_OPTS_HELP
};
-#define qcache_usage(ret) usage(ret, QCACHE_FLAGS, qcache_long_opts, qcache_opts_help, NULL, lookup_applet_idx("qcache"))
+#define qkeyword_usage(ret) usage(ret, QKEYWORD_FLAGS, qkeyword_long_opts, qkeyword_opts_help, NULL, lookup_applet_idx("qkeyword"))
typedef struct {
depend_atom *qatom;
@@ -60,14 +60,14 @@ typedef struct {
size_t keywordsbuflen;
const char *arch;
cache_pkg_cb *runfunc;
-} qcache_data;
+} qkeyword_data;
static set *archs = NULL;
static char **archlist = NULL;
static size_t archlist_count;
static size_t arch_longest_len;
const char status[3] = {'-', '~', '+'};
-int qcache_test_arch = 0;
+int qkeyword_test_arch = 0;
enum { none = 0, testing, stable, minus };
@@ -200,7 +200,7 @@ read_keywords(char *s, int *keywords)
* 0 (SAME)
*/
static int
-qcache_vercmp(const struct dirent **x, const struct dirent **y)
+qkeyword_vercmp(const struct dirent **x, const struct dirent **y)
{
switch (atom_compare_str((*x)->d_name, (*y)->d_name)) {
case EQUAL: return 0;
@@ -211,12 +211,12 @@ qcache_vercmp(const struct dirent **x, const struct dirent **y)
}
static int
-qcache_imlate(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_imlate(cache_pkg_ctx *pkg_ctx, void *priv)
{
size_t a;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
- switch (data->keywordsbuf[qcache_test_arch]) {
+ switch (data->keywordsbuf[qkeyword_test_arch]) {
case stable:
case none:
case minus:
@@ -238,13 +238,13 @@ qcache_imlate(cache_pkg_ctx *pkg_ctx, void *priv)
}
static int
-qcache_not(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_not(cache_pkg_ctx *pkg_ctx, void *priv)
{
size_t a;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
- if (data->keywordsbuf[qcache_test_arch] != testing &&
- data->keywordsbuf[qcache_test_arch] != stable)
+ if (data->keywordsbuf[qkeyword_test_arch] != testing &&
+ data->keywordsbuf[qkeyword_test_arch] != stable)
{
/* match if any of the other arches have keywords */
for (a = 0; a < archlist_count; a++) {
@@ -263,12 +263,12 @@ qcache_not(cache_pkg_ctx *pkg_ctx, void *priv)
}
static int
-qcache_all(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_all(cache_pkg_ctx *pkg_ctx, void *priv)
{
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
- if (data->keywordsbuf[qcache_test_arch] == stable ||
- data->keywordsbuf[qcache_test_arch] == testing)
+ if (data->keywordsbuf[qkeyword_test_arch] == stable ||
+ data->keywordsbuf[qkeyword_test_arch] == testing)
{
print_keywords(pkg_ctx->cat_ctx->name, pkg_ctx->name,
data->keywordsbuf);
@@ -279,7 +279,7 @@ qcache_all(cache_pkg_ctx *pkg_ctx, void *priv)
}
static int
-qcache_dropped(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_dropped(cache_pkg_ctx *pkg_ctx, void *priv)
{
static bool candidate = false;
static char pkg1[_Q_PATH_MAX];
@@ -290,7 +290,7 @@ qcache_dropped(cache_pkg_ctx *pkg_ctx, void *priv)
static int *candkwds = NULL;
static size_t candkwdslen = 0;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
size_t i;
char *p;
@@ -333,12 +333,12 @@ qcache_dropped(cache_pkg_ctx *pkg_ctx, void *priv)
}
/* explicitly removed? */
- if (data->keywordsbuf[qcache_test_arch] == minus)
+ if (data->keywordsbuf[qkeyword_test_arch] == minus)
return EXIT_FAILURE;
/* got a keyword? */
- if (data->keywordsbuf[qcache_test_arch] == testing ||
- data->keywordsbuf[qcache_test_arch] == stable)
+ if (data->keywordsbuf[qkeyword_test_arch] == testing ||
+ data->keywordsbuf[qkeyword_test_arch] == stable)
{
if (candidate) {
p = strchr(candpkg, '/');
@@ -390,7 +390,7 @@ print_seconds_for_earthlings(const unsigned long t)
}
static int
-qcache_stats(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_stats(cache_pkg_ctx *pkg_ctx, void *priv)
{
static time_t runtime;
static int numpkg = 0;
@@ -404,7 +404,7 @@ qcache_stats(cache_pkg_ctx *pkg_ctx, void *priv)
size_t a;
depend_atom *atom;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
/* Is this the last time we'll be called? */
if (!data) {
@@ -527,7 +527,7 @@ qcache_stats(cache_pkg_ctx *pkg_ctx, void *priv)
}
static int
-qcache_testing_only(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_testing_only(cache_pkg_ctx *pkg_ctx, void *priv)
{
static bool candidate = false;
static char pkg1[_Q_PATH_MAX];
@@ -538,7 +538,7 @@ qcache_testing_only(cache_pkg_ctx *pkg_ctx, void *priv)
static int *candkwds = NULL;
static size_t candkwdslen = 0;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
char *p;
p = lastpkg;
@@ -576,12 +576,12 @@ qcache_testing_only(cache_pkg_ctx *pkg_ctx, void *priv)
}
/* explicitly removed or unkeyworded? */
- if (data->keywordsbuf[qcache_test_arch] == minus ||
- data->keywordsbuf[qcache_test_arch] == none)
+ if (data->keywordsbuf[qkeyword_test_arch] == minus ||
+ data->keywordsbuf[qkeyword_test_arch] == none)
return EXIT_FAILURE;
/* got a stable keyword? */
- if (data->keywordsbuf[qcache_test_arch] == stable)
+ if (data->keywordsbuf[qkeyword_test_arch] == stable)
return EXIT_SUCCESS; /* suppress further hits for this package */
/* must be testing at this point */
@@ -597,10 +597,10 @@ qcache_testing_only(cache_pkg_ctx *pkg_ctx, void *priv)
}
static int
-qcache_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
+qkeyword_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
{
int *keywords;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
char buf[_Q_PATH_MAX];
depend_atom *patom = NULL;
cache_pkg_meta *meta;
@@ -658,7 +658,7 @@ qcache_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
}
static void
-qcache_load_arches(const char *overlay)
+qkeyword_load_arches(const char *overlay)
{
FILE *fp;
char *filename, *s;
@@ -705,17 +705,17 @@ qcache_load_arches(const char *overlay)
}
static int
-qcache_traverse(cache_pkg_cb func, void *priv)
+qkeyword_traverse(cache_pkg_cb func, void *priv)
{
int ret;
size_t n;
const char *overlay;
- qcache_data *data = (qcache_data *)priv;
+ qkeyword_data *data = (qkeyword_data *)priv;
/* Preload all the arches. Not entirely correctly (as arches are bound
* to overlays if set), but oh well. */
array_for_each(overlays, n, overlay)
- qcache_load_arches(overlay);
+ qkeyword_load_arches(overlay);
/* allocate memory (once) for the list used by various funcs */
if (archlist_count > data->keywordsbuflen) {
@@ -724,28 +724,28 @@ qcache_traverse(cache_pkg_cb func, void *priv)
data->keywordsbuflen = archlist_count;
}
- qcache_test_arch = decode_arch(data->arch);
- if (qcache_test_arch == -1)
+ qkeyword_test_arch = decode_arch(data->arch);
+ if (qkeyword_test_arch == -1)
return EXIT_FAILURE;
data->runfunc = func;
ret = 0;
array_for_each(overlays, n, overlay)
ret |= cache_foreach_pkg_sorted(portroot, overlay,
- qcache_results_cb, priv, NULL, qcache_vercmp);
+ qkeyword_results_cb, priv, NULL, qkeyword_vercmp);
return ret;
}
-int qcache_main(int argc, char **argv)
+int qkeyword_main(int argc, char **argv)
{
int i;
char action = '\0';
- qcache_data data;
+ qkeyword_data data;
char *pkg = NULL;
char *cat = NULL;
- while ((i = GETOPT_LONG(QCACHE, qcache, "")) != -1) {
+ while ((i = GETOPT_LONG(QKEYWORD, qkeyword, "")) != -1) {
switch (i) {
case 'p': pkg = optarg; break;
case 'c': cat = optarg; break;
@@ -756,12 +756,12 @@ int qcache_main(int argc, char **argv)
case 'a':
case 'n':
if (action)
- qcache_usage(EXIT_FAILURE);
+ qkeyword_usage(EXIT_FAILURE);
/* trying to use more than 1 action */
action = i;
break;
- COMMON_GETOPTS_CASES(qcache)
+ COMMON_GETOPTS_CASES(qkeyword)
}
}
@@ -770,7 +770,7 @@ int qcache_main(int argc, char **argv)
data.arch = argv[optind];
if ((data.arch == NULL && action != 's') || optind + 1 < argc)
- qcache_usage(EXIT_FAILURE);
+ qkeyword_usage(EXIT_FAILURE);
if (cat != NULL) {
char buf[_Q_PATH_MAX];
@@ -797,17 +797,17 @@ int qcache_main(int argc, char **argv)
data.keywordsbuflen = 0;
switch (action) {
- case 'i': i = qcache_traverse(qcache_imlate, &data); break;
- case 'd': i = qcache_traverse(qcache_dropped, &data);
- i = qcache_dropped(NULL, NULL); break;
- case 't': i = qcache_traverse(qcache_testing_only, &data);
- i = qcache_testing_only(NULL, NULL); break;
+ case 'i': i = qkeyword_traverse(qkeyword_imlate, &data); break;
+ case 'd': i = qkeyword_traverse(qkeyword_dropped, &data);
+ i = qkeyword_dropped(NULL, NULL); break;
+ case 't': i = qkeyword_traverse(qkeyword_testing_only, &data);
+ i = qkeyword_testing_only(NULL, NULL); break;
case 's': data.arch = "amd64"; /* doesn't matter, need to be set */
- i = qcache_traverse(qcache_stats, &data);
- i = qcache_stats(NULL, NULL); break;
- case 'a': i = qcache_traverse(qcache_all, &data); break;
- case 'n': i = qcache_traverse(qcache_not, &data); break;
- default: i = -2; break;
+ i = qkeyword_traverse(qkeyword_stats, &data);
+ i = qkeyword_stats(NULL, NULL); break;
+ case 'a': i = qkeyword_traverse(qkeyword_all, &data); break;
+ case 'n': i = qkeyword_traverse(qkeyword_not, &data); break;
+ default: i = -2; break;
}
if (data.qatom != NULL)
@@ -815,6 +815,6 @@ int qcache_main(int argc, char **argv)
free(archlist);
free_set(archs);
if (i == -2)
- qcache_usage(EXIT_FAILURE);
+ qkeyword_usage(EXIT_FAILURE);
return i;
}
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-05-03 8:50 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-05-03 8:50 UTC (permalink / raw
To: gentoo-commits
commit: 47c13a275a7b76d77e5ac3e3ada5024bfc5372bd
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri May 3 08:47:26 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri May 3 08:47:26 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=47c13a27
quse: make -v output faster, format and introduce --repo
- improve performance for -v output (listing all use-flags with
descriptions per package match)
- add -R/--repo flag to print repository next to atom
- align USE-flags in -v mode per package
Bug: https://bugs.gentoo.org/656550
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
TODO.md | 1 -
man/quse.1 | 3 ++
quse.c | 171 +++++++++++++++++++++++++++++++++++++++++++++----------------
3 files changed, 131 insertions(+), 44 deletions(-)
diff --git a/TODO.md b/TODO.md
index 349170f..b70dffc 100644
--- a/TODO.md
+++ b/TODO.md
@@ -88,5 +88,4 @@
package X
# quse
-- make -v faster by calling searcg funcs once per package match
- make -v only print requested USE-flag when flags given
diff --git a/man/quse.1 b/man/quse.1
index 6f0d8d3..ef17c10 100644
--- a/man/quse.1
+++ b/man/quse.1
@@ -25,6 +25,9 @@ Describe the USE flag.
\fB\-p\fR \fI<arg>\fR, \fB\-\-package\fR \fI<arg>\fR
Restrict matching to package or category.
.TP
+\fB\-R\fR, \fB\-\-repo\fR
+Show repository the ebuild originates from.
+.TP
\fB\-\-root\fR \fI<arg>\fR
Set the ROOT env var.
.TP
diff --git a/quse.c b/quse.c
index fbf61cf..604efdf 100644
--- a/quse.c
+++ b/quse.c
@@ -26,13 +26,14 @@
#include "xarray.h"
#include "xregex.h"
-#define QUSE_FLAGS "eaLDp:" COMMON_FLAGS
+#define QUSE_FLAGS "eaLDp:R" COMMON_FLAGS
static struct option const quse_long_opts[] = {
{"exact", no_argument, NULL, 'e'},
{"all", no_argument, NULL, 'a'},
{"license", no_argument, NULL, 'L'},
{"describe", no_argument, NULL, 'D'},
{"package", a_argument, NULL, 'p'},
+ {"repo", no_argument, NULL, 'R'},
COMMON_LONG_OPTS
};
static const char * const quse_opts_help[] = {
@@ -41,6 +42,7 @@ static const char * const quse_opts_help[] = {
"Use the LICENSE vs IUSE",
"Describe the USE flag",
"Restrict matching to package or category",
+ "Show repository the ebuild originates from",
COMMON_OPTS_HELP
};
#define quse_usage(ret) usage(ret, QUSE_FLAGS, quse_long_opts, quse_opts_help, NULL, lookup_applet_idx("quse"))
@@ -48,12 +50,14 @@ static const char * const quse_opts_help[] = {
struct quse_state {
int argc;
char **argv;
+ char **retv;
const char *overlay;
bool do_all:1;
bool do_regex:1;
bool do_describe:1;
bool do_licence:1;
bool do_list:1;
+ bool do_repo:1;
depend_atom *match;
regex_t *pregv;
};
@@ -110,6 +114,9 @@ quse_search_use_local_desc(int portdirfd, struct quse_state *state)
match = false;
for (i = 0; i < state->argc; i++) {
+ if (state->do_list && state->retv[i] != NULL)
+ continue;
+
if (state->do_regex) {
if (regexec(&state->pregv[i], p, 0, NULL, 0) != 0)
continue;
@@ -128,13 +135,14 @@ quse_search_use_local_desc(int portdirfd, struct quse_state *state)
if (state->match == NULL ||
atom_compare(atom, state->match) == EQUAL)
{
- if (state->do_list)
- printf(" %s%s%s %s\n", MAGENTA, p, NORM, q);
- else
+ if (state->do_list) {
+ state->retv[i] = xstrdup(q);
+ } else {
printf("%s%s/%s%s%s[%s%s%s] %s\n",
BOLD, atom->CATEGORY,
BLUE, atom->PN, NORM,
MAGENTA, p, NORM, q);
+ }
}
atom_implode(atom);
@@ -142,6 +150,16 @@ quse_search_use_local_desc(int portdirfd, struct quse_state *state)
}
} while (1);
+ if (state->do_list && ret) {
+ /* check if all requested flags are retrieved */
+ ret = true;
+ for (i = 0; i < state->argc; i++)
+ if (state->retv[i] == NULL)
+ break;
+ if (i < state->argc)
+ ret = false;
+ }
+
fclose(f);
return ret;
}
@@ -186,6 +204,9 @@ quse_search_use_desc(int portdirfd, struct quse_state *state)
match = false;
for (i = 0; i < state->argc; i++) {
+ if (state->do_list && state->retv[i] != NULL)
+ continue;
+
if (state->do_regex) {
if (regexec(&state->pregv[i], buf, 0, NULL, 0) != 0)
continue;
@@ -198,16 +219,27 @@ quse_search_use_desc(int portdirfd, struct quse_state *state)
}
if (match) {
- if (state->do_list)
- printf(" %s%s%s %s\n", MAGENTA, buf, NORM, p);
- else
+ if (state->do_list) {
+ state->retv[i] = xstrdup(p);
+ } else {
printf("%sglobal%s[%s%s%s] %s\n",
BOLD, NORM, MAGENTA, buf, NORM, p);
+ }
ret = true;
}
} while (1);
+ if (state->do_list && ret) {
+ /* check if all requested flags are retrieved */
+ ret = true;
+ for (i = 0; i < state->argc; i++)
+ if (state->retv[i] == NULL)
+ break;
+ if (i < state->argc)
+ ret = false;
+ }
+
fclose(f);
return ret;
}
@@ -287,6 +319,9 @@ quse_search_profiles_desc(
match = false;
for (i = 0; i < state->argc; i++) {
+ if (state->do_list && state->retv[i] != NULL)
+ continue;
+
arglen = strlen(state->argv[i]);
if (arglen > namelen) {
/* nginx_modules_http_lua = NGINX_MODULES_HTTP[lua] */
@@ -312,17 +347,18 @@ quse_search_profiles_desc(
}
if (match) {
- const char *r = de->d_name;
- char *s = ubuf;
- do {
- *s++ = (char)toupper((int)*r);
- } while (++r < (de->d_name + namelen));
- *s = '\0';
- if (state->do_list)
- printf(" %s=%s%s%s %s\n", ubuf, MAGENTA, buf, NORM, p);
- else
+ if (state->do_list) {
+ state->retv[i] = xstrdup(p);
+ } else {
+ const char *r = de->d_name;
+ char *s = ubuf;
+ do {
+ *s++ = (char)toupper((int)*r);
+ } while (++r < (de->d_name + namelen));
+ *s = '\0';
printf("%s%s%s[%s%s%s] %s\n",
BOLD, ubuf, NORM, MAGENTA, buf, NORM, p);
+ }
ret = true;
}
@@ -332,6 +368,16 @@ quse_search_profiles_desc(
}
closedir(d);
+ if (state->do_list && ret) {
+ /* check if all requested flags are retrieved */
+ ret = true;
+ for (i = 0; i < state->argc; i++)
+ if (state->retv[i] == NULL)
+ break;
+ if (i < state->argc)
+ ret = false;
+ }
+
return ret;
}
@@ -369,6 +415,8 @@ quse_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
char *w;
int i;
int len;
+ int maxlen;
+ int cnt;
int portdirfd = -1; /* pacify compiler */
if (state->match || verbose) {
@@ -402,13 +450,15 @@ quse_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
return 0;
}
+ maxlen = 0;
+ cnt = 0;
match = false;
q = p = state->do_licence ? meta->LICENSE : meta->IUSE;
buf[0] = '\0';
v = buf;
w = buf + sizeof(buf);
- if (state->do_all) {
+ if (state->do_all && !verbose) {
match = true;
v = q;
} else {
@@ -423,7 +473,10 @@ quse_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
s = q;
if (*q == '-' || *q == '+' || *q == '@')
q++;
- if (state->do_regex) {
+ if (state->do_all) {
+ i = 0;
+ match = true;
+ } else if (state->do_regex) {
char r;
for (i = 0; i < state->argc; i++) {
r = *p;
@@ -452,6 +505,11 @@ quse_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
}
if (i == state->argc)
v += snprintf(v, w - v, "%.*s%c", (int)(p - s), s, *p);
+
+ if (maxlen < p - q)
+ maxlen = p - q;
+ cnt++;
+
q = p + 1;
}
} while (*p++ != '\0' && v < w);
@@ -459,57 +517,82 @@ quse_results_cb(cache_pkg_ctx *pkg_ctx, void *priv)
}
if (match) {
+ char *repo = state->do_repo ? pkg_ctx->repo : NULL;
+
if (quiet) {
- printf("%s%s/%s%s%s\n", BOLD, pkg_ctx->cat_ctx->name,
- BLUE, pkg_ctx->name, NORM);
- } else if (verbose) {
+ printf("%s%s/%s%s%s%s%s%s\n", BOLD, pkg_ctx->cat_ctx->name,
+ BLUE, pkg_ctx->name,
+ repo ? RED : "", repo ? "::" : "", repo ? repo : "",
+ NORM);
+ } else if (verbose && !state->do_licence) {
/* multi-line result, printing USE-flags with their descs */
struct quse_state us = {
.do_regex = false,
.do_describe = false,
.do_list = true,
.match = atom,
- .argc = 1,
- .argv = NULL,
+ .argc = cnt,
+ .argv = xmalloc(sizeof(char *) * cnt),
+ .retv = xzalloc(sizeof(char *) * cnt),
.overlay = NULL,
};
- printf("%s%s/%s%s%s:\n", BOLD, pkg_ctx->cat_ctx->name,
- BLUE, pkg_ctx->name, NORM);
+ printf("%s%s/%s%s%s%s%s%s\n", BOLD, pkg_ctx->cat_ctx->name,
+ BLUE, pkg_ctx->name,
+ repo ? RED : "", repo ? "::" : "", repo ? repo : "",
+ NORM);
- q = p = state->do_licence ? meta->LICENSE : meta->IUSE;
+ q = p = meta->IUSE;
buf[0] = '\0';
+ v = buf;
+ w = buf + sizeof(buf);
+ i = 0;
do {
if (*p == ' ' || *p == '\0') {
s = q;
if (*q == '-' || *q == '+' || *q == '@')
q++;
- snprintf(buf, sizeof(buf), "%.*s", (int)(p - q), q);
- v = buf;
- us.argv = &v;
-
- /* print at most one match for each flag, this is
- * why we can't setup all flags in argc/argv,
- * because then we either print way to few, or way
- * too many, possible opt: when argv would be
- * modified by search funcs so they remove what they
- * matched */
- if (!quse_search_use_local_desc(portdirfd, &us))
- if (!quse_search_use_desc(portdirfd, &us))
- quse_search_profiles_desc(portdirfd, &us);
+ /* pre-padd everything such that we always refer to
+ * the char before the USE-flag */
+ us.argv[i++] = v + 1;
+ v += snprintf(v, w - v, "%c%.*s",
+ s == q ? ' ' : *s, (int)(p - q), q) + 1;
q = p + 1;
}
- } while (*p++ != '\0');
+ } while (*p++ != '\0' && i < cnt && v < w);
+
+ /* harvest descriptions for USE-flags */
+ if (!quse_search_use_local_desc(portdirfd, &us))
+ if (!quse_search_use_desc(portdirfd, &us))
+ quse_search_profiles_desc(portdirfd, &us);
+
+ for (i = 0; i < cnt; i++) {
+ printf(" %c%s%s%s%*s %s\n",
+ us.argv[i][-1],
+ /* selected ? RED : NORM */ MAGENTA,
+ us.argv[i],
+ NORM,
+ (int)(maxlen - strlen(us.argv[i])), "",
+ us.retv[i] == NULL ? "<no description found>" :
+ us.retv[i]);
+ if (us.retv[i] != NULL)
+ free(us.retv[i]);
+ }
+
+ free(us.retv);
+ free(us.argv);
} else {
- printf("%s%s/%s%s%s: %s\n", BOLD, pkg_ctx->cat_ctx->name,
- BLUE, pkg_ctx->name, NORM, v);
+ printf("%s%s/%s%s%s%s%s%s: %s\n", BOLD, pkg_ctx->cat_ctx->name,
+ BLUE, pkg_ctx->name,
+ repo ? RED : "", repo ? "::" : "", repo ? repo : "",
+ NORM, v);
}
}
cache_close_meta(meta);
- if (state->match || verbose)
+ if (state->match && verbose)
atom_implode(atom);
if (verbose)
close(portdirfd);
@@ -528,6 +611,7 @@ int quse_main(int argc, char **argv)
.do_regex = true,
.do_describe = false,
.do_licence = false,
+ .do_repo = false,
.match = NULL,
.overlay = NULL,
};
@@ -538,6 +622,7 @@ int quse_main(int argc, char **argv)
case 'a': state.do_all = true; break;
case 'L': state.do_licence = true; break;
case 'D': state.do_describe = true; break;
+ case 'R': state.do_repo = true; break;
case 'p': match = optarg; break;
COMMON_GETOPTS_CASES(quse)
}
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-06-21 18:24 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-06-21 18:24 UTC (permalink / raw
To: gentoo-commits
commit: 2fd5a0ccc059a64a25aa292b7899af9e3ccf94f0
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 21 18:23:31 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Jun 21 18:23:31 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2fd5a0cc
qgrep: fix command descriptions
Bug: https://bugs.gentoo.org/688442
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qgrep.1 | 32 ++++++++++++++++----------------
qgrep.c | 1 -
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/man/qgrep.1 b/man/qgrep.1
index 6701061..fbde702 100644
--- a/man/qgrep.1
+++ b/man/qgrep.1
@@ -24,43 +24,43 @@ Ignore case distinctions.
Print the filename for each match.
.TP
\fB\-c\fR, \fB\-\-count\fR
-Print the package or eclass name for each match.
+Only print a count of matching lines per FILE.
.TP
\fB\-l\fR, \fB\-\-list\fR
-Only print a count of matching lines per FILE.
+Only print FILE names containing matches.
.TP
\fB\-L\fR, \fB\-\-invert\-list\fR
-Only print FILE names containing matches.
+Only print FILE names containing no match.
.TP
\fB\-e\fR, \fB\-\-regexp\fR
-Only print FILE names containing no match.
+Use PATTERN as a regular expression.
.TP
\fB\-x\fR, \fB\-\-extended\fR
-Use PATTERN as a regular expression.
+Use PATTERN as an extended regular expression.
.TP
\fB\-J\fR, \fB\-\-installed\fR
-Use PATTERN as an extended regular expression.
+Search in installed ebuilds instead of the tree.
.TP
\fB\-E\fR, \fB\-\-eclass\fR
-Search in installed ebuilds instead of the tree.
+Search in eclasses instead of ebuilds.
.TP
\fB\-s\fR, \fB\-\-skip\-comments\fR
-Search in eclasses instead of ebuilds.
+Skip comments lines.
.TP
\fB\-R\fR, \fB\-\-repo\fR
-Skip comments lines.
+Print source repository name for each match (implies -N).
.TP
\fB\-S\fR \fI<arg>\fR, \fB\-\-skip\fR \fI<arg>\fR
-Print source repository name for each match (implies -N).
+Skip lines matching <arg>.
.TP
\fB\-B\fR \fI<arg>\fR, \fB\-\-before\fR \fI<arg>\fR
-Skip lines matching <arg>.
+Print <arg> lines of leading context.
.TP
\fB\-A\fR \fI<arg>\fR, \fB\-\-after\fR \fI<arg>\fR
-Print <arg> lines of leading context.
+Print <arg> lines of trailing context.
.TP
\fB\-\-root\fR \fI<arg>\fR
-Print <arg> lines of trailing context.
+Set the ROOT env var.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Prefix each matching line with filename (like \fB-H\fR). When this
@@ -70,13 +70,13 @@ option is given multiple times, also linenumbers are printed.
Do not prefix each match with filename.
.TP
\fB\-C\fR, \fB\-\-nocolor\fR
-Tighter output; suppress warnings.
+Don't output color.
.TP
\fB\-h\fR, \fB\-\-help\fR
-Don't output color.
+Print this help and exit.
.TP
\fB\-V\fR, \fB\-\-version\fR
-Print this help and exit.
+Print version and exit.
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
diff --git a/qgrep.c b/qgrep.c
index 003ead2..1f6d0de 100644
--- a/qgrep.c
+++ b/qgrep.c
@@ -47,7 +47,6 @@ static const char * const qgrep_opts_help[] = {
"Select non-matching lines",
"Ignore case distinctions",
"Print the filename for each match",
- "Print the package or eclass name for each match",
"Only print a count of matching lines per FILE",
"Only print FILE names containing matches",
"Only print FILE names containing no match",
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-07-14 13:09 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-07-14 13:09 UTC (permalink / raw
To: gentoo-commits
commit: 46f6f4a1c29eb1bcd66af043b13d6952ad3a5e0a
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 11:43:29 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 11:43:29 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=46f6f4a1
qsearch: add -F argument, also make -v act like for other applets
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qsearch.1 | 3 +++
qsearch.c | 59 ++++++++++++++++++++++++++++++++++++-----------------------
2 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/man/qsearch.1 b/man/qsearch.1
index f6b9baf..e805f82 100644
--- a/man/qsearch.1
+++ b/man/qsearch.1
@@ -29,6 +29,9 @@ Show homepage info instead of description.
\fB\-R\fR, \fB\-\-repo\fR
Show repository the ebuild originates from.
.TP
+\fB\-F\fR \fI<arg>\fR, \fB\-\-format\fR \fI<arg>\fR
+Print matched atom using given format string.
+.TP
\fB\-\-root\fR \fI<arg>\fR
Set the ROOT env var.
.TP
diff --git a/qsearch.c b/qsearch.c
index db220c7..8245383 100644
--- a/qsearch.c
+++ b/qsearch.c
@@ -25,7 +25,7 @@
#include "xarray.h"
#include "xregex.h"
-#define QSEARCH_FLAGS "asSNHR" COMMON_FLAGS
+#define QSEARCH_FLAGS "asSNHRF:" COMMON_FLAGS
static struct option const qsearch_long_opts[] = {
{"all", no_argument, NULL, 'a'},
{"search", no_argument, NULL, 's'},
@@ -33,6 +33,7 @@ static struct option const qsearch_long_opts[] = {
{"name-only", no_argument, NULL, 'N'},
{"homepage", no_argument, NULL, 'H'},
{"repo", no_argument, NULL, 'R'},
+ {"format", a_argument, NULL, 'F'},
COMMON_LONG_OPTS
};
static const char * const qsearch_opts_help[] = {
@@ -42,6 +43,7 @@ static const char * const qsearch_opts_help[] = {
"Only show package name",
"Show homepage info instead of description",
"Show repository the ebuild originates from",
+ "Print matched atom using given format string",
COMMON_OPTS_HELP
};
#define qsearch_usage(ret) usage(ret, QSEARCH_FLAGS, qsearch_long_opts, qsearch_opts_help, NULL, lookup_applet_idx("qsearch"))
@@ -50,10 +52,11 @@ struct qsearch_state {
bool show_homepage:1;
bool show_name:1;
bool show_desc:1;
- bool show_repo:1;
bool search_desc:1;
bool search_name:1;
+ bool need_full_atom:1;
regex_t search_expr;
+ const char *fmt;
};
static int
@@ -99,16 +102,10 @@ qsearch_cb(tree_pkg_ctx *pkg_ctx, void *priv)
match = true;
if (match) {
- const char *qfmt;
- if (state->show_repo) {
- atom = tree_get_atom(pkg_ctx, 1);
- qfmt = "%[CATEGORY]%[PN]%[REPO]";
- } else {
- qfmt = "%[CATEGORY]%[PN]";
- }
+ atom = tree_get_atom(pkg_ctx, state->need_full_atom);
printf("%s%s%s\n",
- atom_format(qfmt, atom),
- (state->show_name ? "" : " "),
+ atom_format(state->fmt, atom),
+ (state->show_name ? "" : ": "),
(state->show_name ? "" : desc ? desc : ""));
}
@@ -131,23 +128,25 @@ int qsearch_main(int argc, char **argv)
const char *overlay;
size_t n;
struct qsearch_state state = {
- .show_homepage = false,
- .show_name = false,
- .show_desc = false,
- .show_repo = false,
- .search_desc = false,
- .search_name = false,
+ .show_homepage = false,
+ .show_name = false,
+ .show_desc = false,
+ .search_desc = false,
+ .search_name = false,
+ .need_full_atom = false,
+ .fmt = NULL,
};
while ((i = GETOPT_LONG(QSEARCH, qsearch, "")) != -1) {
switch (i) {
COMMON_GETOPTS_CASES(qsearch)
- case 'a': search_me = ".*"; break;
- case 's': state.search_name = true; break;
- case 'S': state.search_desc = true; break;
- case 'N': state.show_name = true; break;
- case 'H': state.show_homepage = true; break;
- case 'R': state.show_repo = true; break;
+ case 'a': search_me = ".*"; break;
+ case 's': state.search_name = true; break;
+ case 'S': state.search_desc = true; break;
+ case 'N': state.show_name = true; break;
+ case 'H': state.show_homepage = true; break;
+ case 'F': state.fmt = optarg; /* fall through */
+ case 'R': state.need_full_atom = true; break;
}
}
@@ -165,6 +164,20 @@ int qsearch_main(int argc, char **argv)
}
xregcomp(&state.search_expr, search_me, REG_EXTENDED | REG_ICASE);
+ /* set default format */
+ if (state.fmt == NULL) {
+ if (state.need_full_atom)
+ if (verbose)
+ state.fmt = "%[CATEGORY]%[PF]%[REPO]";
+ else
+ state.fmt = "%[CATEGORY]%[PN]%[REPO]";
+ else
+ if (verbose)
+ state.fmt = "%[CATEGORY]%[PF]";
+ else
+ state.fmt = "%[CATEGORY]%[PN]";
+ }
+
/* use sorted order here so the duplicate reduction works reliably */
array_for_each(overlays, n, overlay) {
tree_ctx *t = tree_open(portroot, overlay);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2019-07-14 18:51 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2019-07-14 18:51 UTC (permalink / raw
To: gentoo-commits
commit: bc9b220f15d357ea2b729311a3f9da563d978438
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 18:43:49 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 18:43:49 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bc9b220f
qlist: add -F argument
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qlist.1 | 3 ++
qlist.c | 116 ++++++++++++++++++++++++++++++++++--------------------------
2 files changed, 68 insertions(+), 51 deletions(-)
diff --git a/man/qlist.1 b/man/qlist.1
index 8f9cf56..2fd9575 100644
--- a/man/qlist.1
+++ b/man/qlist.1
@@ -52,6 +52,9 @@ Only show objects.
\fB\-s\fR, \fB\-\-sym\fR
Only show symlinks.
.TP
+\fB\-F\fR \fI<arg>\fR, \fB\-\-format\fR \fI<arg>\fR
+Print matched atom using given format string.
+.TP
\fB\-\-root\fR \fI<arg>\fR
Set the ROOT env var.
.TP
diff --git a/qlist.c b/qlist.c
index ab3fb4f..e0a8a07 100644
--- a/qlist.c
+++ b/qlist.c
@@ -21,7 +21,7 @@
#include "tree.h"
#include "xregex.h"
-#define QLIST_FLAGS "ISRUcDeados" COMMON_FLAGS
+#define QLIST_FLAGS "ISRUcDeadosF:" COMMON_FLAGS
static struct option const qlist_long_opts[] = {
{"installed", no_argument, NULL, 'I'},
{"slots", no_argument, NULL, 'S'},
@@ -35,10 +35,11 @@ static struct option const qlist_long_opts[] = {
{"obj", no_argument, NULL, 'o'},
{"sym", no_argument, NULL, 's'},
/* {"file", a_argument, NULL, 'f'}, */
+ {"format", a_argument, NULL, 'F'},
COMMON_LONG_OPTS
};
static const char * const qlist_opts_help[] = {
- "Just show installed packages",
+ "Just show installed package names",
"Display installed packages with slots (use twice for subslots)",
"Display installed packages with repository",
"Display installed packages with flags used",
@@ -50,6 +51,7 @@ static const char * const qlist_opts_help[] = {
"Only show objects",
"Only show symlinks",
/* "query filename for pkgname", */
+ "Print matched atom using given format string",
COMMON_OPTS_HELP
};
#define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, NULL, lookup_applet_idx("qlist"))
@@ -311,19 +313,18 @@ struct qlist_opt_state {
int argc;
char **argv;
depend_atom **atoms;
- bool exact;
- bool all;
- bool just_pkgname;
- bool show_dir;
- bool show_obj;
- bool show_repo;
- bool show_sym;
- int show_slots;
- bool show_umap;
- bool show_dbg;
- bool columns;
+ bool exact:1;
+ bool all:1;
+ bool just_pkgname:1;
+ bool show_dir:1;
+ bool show_obj:1;
+ bool show_sym:1;
+ bool need_full_atom:1;
+ bool show_umap:1;
+ bool show_dbg:1;
char *buf;
size_t buflen;
+ const char *fmt;
};
static int
@@ -342,29 +343,11 @@ qlist_cb(tree_pkg_ctx *pkg_ctx, void *priv)
if ((i == state->argc) && (state->argc != optind))
return 0;
- atom = tree_get_atom(pkg_ctx, false);
+ atom = tree_get_atom(pkg_ctx, state->need_full_atom);
if (state->just_pkgname) {
if ((state->all + state->just_pkgname) < 2) {
- char qfmt[128];
- atom = tree_get_atom(pkg_ctx,
- state->show_slots || state->show_repo);
- if (state->columns) {
- snprintf(qfmt, sizeof(qfmt),
- "%%{CATEGORY} %%{PN}%s%s%s%s",
- verbose ? " %{PVR}" : "",
- state->show_slots >= 1 ? " %{SLOT}" : "",
- state->show_slots >= 2 ? " %{SUBSLOT}" : "",
- state->show_repo ? " %{REPO}" : "");
- } else {
- snprintf(qfmt, sizeof(qfmt),
- "%%[CATEGORY]%%[P%c]%s%s%s",
- verbose ? 'F' : 'N',
- state->show_slots >= 1 ? "%[SLOT]" : "",
- state->show_slots >= 2 ? "%[SUBSLOT]" : "",
- state->show_repo ? "%[REPO]" : "");
- }
printf("%s%s\n",
- atom_format(qfmt, atom),
+ atom_format(state->fmt, atom),
umapstr(state->show_umap, pkg_ctx));
}
@@ -374,7 +357,7 @@ qlist_cb(tree_pkg_ctx *pkg_ctx, void *priv)
if (verbose)
printf("%s %sCONTENTS%s:\n",
- atom_format("%[CATEGORY]%[PF]", atom), DKBLUE, NORM);
+ atom_format(state->fmt, atom), DKBLUE, NORM);
fp = tree_pkg_vdb_fopenat_ro(pkg_ctx, "CONTENTS");
if (fp == NULL)
@@ -425,6 +408,10 @@ int qlist_main(int argc, char **argv)
int i;
int ret;
tree_ctx *vdb;
+ int show_slots = 0;
+ bool show_repo = false;
+ bool do_columns = false;
+ char qfmt[128];
struct qlist_opt_state state = {
.argc = argc,
.argv = argv,
@@ -433,40 +420,67 @@ int qlist_main(int argc, char **argv)
.just_pkgname = false,
.show_dir = false,
.show_obj = false,
- .show_repo = false,
.show_sym = false,
- .show_slots = 0,
+ .need_full_atom = false,
.show_umap = false,
.show_dbg = false,
- .columns = false,
.buflen = _Q_PATH_MAX,
+ .fmt = NULL,
};
while ((i = GETOPT_LONG(QLIST, qlist, "")) != -1) {
switch (i) {
COMMON_GETOPTS_CASES(qlist)
- case 'a': state.all = true; /* fall through */
- case 'I': state.just_pkgname = true; break;
- case 'S': state.just_pkgname = true; ++state.show_slots; break;
- case 'R': state.just_pkgname = state.show_repo = true; break;
- case 'U': state.just_pkgname = state.show_umap = true; break;
- case 'e': state.exact = true; break;
- case 'd': state.show_dir = true; break;
- case 128: state.show_dbg = true; break;
- case 'o': state.show_obj = true; break;
- case 's': state.show_sym = true; break;
- case 'c': state.columns = true; break;
- case 'f': break;
+ case 'a': state.all = true; /* fall through */
+ case 'I': state.just_pkgname = true; break;
+ case 'S': state.just_pkgname = true; show_slots++; break;
+ case 'R': state.just_pkgname = show_repo = true; break;
+ case 'U': state.just_pkgname = state.show_umap = true; break;
+ case 'e': state.exact = true; break;
+ case 'd': state.show_dir = true; break;
+ case 128: state.show_dbg = true; break;
+ case 'o': state.show_obj = true; break;
+ case 's': state.show_sym = true; break;
+ case 'c': do_columns = true; break;
+ case 'F': state.fmt = optarg; break;
}
}
- if (state.columns)
- verbose = 0; /* if not set to zero; atom wont be exploded; segv */
+
/* default to showing syms and objs */
if (!state.show_dir && !state.show_obj && !state.show_sym)
state.show_obj = state.show_sym = true;
if (argc == optind && !state.just_pkgname)
qlist_usage(EXIT_FAILURE);
+ if (state.fmt == NULL) {
+ const char *l = "%[";
+ const char *r = "]";
+ if (do_columns) {
+ l = "%{";
+ r = "} ";
+ }
+ snprintf(qfmt, sizeof(qfmt), "%sCATEGORY%s"
+ "%s%s%s" /* PN/PF */
+ "%s%s%s" /* SLOT */
+ "%s%s%s" /* SUBSLOT */
+ "%s%s%s", /* REPO */
+ l, r,
+ l, verbose ? "PF" : "PN", r,
+ show_slots >= 1 ? l : "",
+ show_slots >= 1 ? "SLOT" : "",
+ show_slots >= 1 ? r : "",
+ show_slots >= 2 ? l : "",
+ show_slots >= 2 ? "SUBSLOT" : "",
+ show_slots >= 2 ? r : "",
+ show_repo ? l : "",
+ show_repo ? "REPO" : "",
+ show_repo ? r : "");
+ state.fmt = qfmt;
+ state.need_full_atom = show_slots > 0 || show_repo;
+ } else {
+ state.need_full_atom = true;
+ }
+
state.buf = xmalloc(state.buflen);
state.atoms = xcalloc(argc - optind, sizeof(*state.atoms));
ret = 1;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2020-01-19 9:49 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2020-01-19 9:49 UTC (permalink / raw
To: gentoo-commits
commit: 16215c71c61da9cb44868d58b4c3ce0529c5d4ac
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 19 09:48:50 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 19 09:48:50 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=16215c71
qatom: add -l option to match an atom against the tree
returns the latest available version of the atom requested, or nothing
when not found
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qatom.1 | 5 ++++-
qatom.c | 33 +++++++++++++++++++++++++++------
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/man/qatom.1 b/man/qatom.1
index 6254912..4f6ccf2 100644
--- a/man/qatom.1
+++ b/man/qatom.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qatom "1" "Nov 2019" "Gentoo Foundation" "qatom"
+.TH qatom "1" "Jan 2020" "Gentoo Foundation" "qatom"
.SH NAME
qatom \- split atom strings
.SH SYNOPSIS
@@ -70,6 +70,9 @@ Compare two atoms.
\fB\-p\fR, \fB\-\-print\fR
Print reconstructed atom.
.TP
+\fB\-l\fR, \fB\-\-lookup\fR
+Lookup atom in tree.
+.TP
\fB\-\-root\fR \fI<arg>\fR
Set the ROOT env var.
.TP
diff --git a/qatom.c b/qatom.c
index 23d10d8..59f7392 100644
--- a/qatom.c
+++ b/qatom.c
@@ -8,36 +8,37 @@
*/
#include "main.h"
-
-#include <stdlib.h>
-#include <stdbool.h>
+#include "applets.h"
#include "atom.h"
-#include "applets.h"
+#include "tree.h"
#define QATOM_FORMAT "%{CATEGORY} %{PN} %{PV} %[PR] %[SLOT] %[pfx] %[sfx]"
-#define QATOM_FLAGS "F:cp" COMMON_FLAGS
+#define QATOM_FLAGS "F:cpl" COMMON_FLAGS
static struct option const qatom_long_opts[] = {
{"format", a_argument, NULL, 'F'},
{"compare", no_argument, NULL, 'c'},
{"print", no_argument, NULL, 'p'},
+ {"lookup", no_argument, NULL, 'l'},
COMMON_LONG_OPTS
};
static const char * const qatom_opts_help[] = {
"Custom output format (default: " QATOM_FORMAT ")",
"Compare two atoms",
"Print reconstructed atom",
+ "Lookup atom in tree",
COMMON_OPTS_HELP
};
#define qatom_usage(ret) usage(ret, QATOM_FLAGS, qatom_long_opts, qatom_opts_help, NULL, lookup_applet_idx("qatom"))
int qatom_main(int argc, char **argv)
{
- enum qatom_atom { _EXPLODE=0, _COMPARE, _PRINT } action = _EXPLODE;
+ enum qatom_atom { _EXPLODE=0, _COMPARE, _PRINT, _LOOKUP } action = _EXPLODE;
const char *format = QATOM_FORMAT;
depend_atom *atom;
depend_atom *atomc;
+ tree_ctx *tree = NULL;
int i;
while ((i = GETOPT_LONG(QATOM, qatom, "")) != -1) {
@@ -45,6 +46,7 @@ int qatom_main(int argc, char **argv)
case 'F': format = optarg; break;
case 'c': action = _COMPARE; break;
case 'p': action = _PRINT; break;
+ case 'l': action = _LOOKUP; break;
COMMON_GETOPTS_CASES(qatom)
}
}
@@ -55,6 +57,12 @@ int qatom_main(int argc, char **argv)
if (action == _COMPARE && (argc - optind) % 2)
err("compare needs even number of arguments");
+ if (action == _LOOKUP) {
+ tree = tree_open(portroot, main_overlay);
+ if (tree == NULL)
+ err("failed to open tree");
+ }
+
for (i = optind; i < argc; i++) {
atom = atom_explode(argv[i]);
if (atom == NULL) {
@@ -101,10 +109,23 @@ int qatom_main(int argc, char **argv)
case _PRINT:
printf("%s\n", atom_to_string(atom));
break;
+ case _LOOKUP:
+ {
+ tree_pkg_ctx *pkg = tree_match_atom(tree, atom);
+ if (pkg != NULL) {
+ atomc = tree_get_atom(pkg, true);
+ if (!quiet)
+ printf("%s: ", atom_to_string(atom));
+ printf("%s\n", atom_format(format, atomc));
+ }
+ }
}
atom_implode(atom);
}
+ if (action == _LOOKUP)
+ tree_close(tree);
+
return EXIT_SUCCESS;
}
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2020-05-16 13:06 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2020-05-16 13:06 UTC (permalink / raw
To: gentoo-commits
commit: ae5f28c57d2552786d813f44608cc74baf5fbf6d
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 13:05:54 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 16 13:05:54 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ae5f28c5
qatom: add -s switch to strictly emulate a call to atom_compare
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qatom.1 | 5 ++++-
qatom.c | 29 ++++++++++++++++++++---------
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/man/qatom.1 b/man/qatom.1
index 4f6ccf2..9ebb9a0 100644
--- a/man/qatom.1
+++ b/man/qatom.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qatom "1" "Jan 2020" "Gentoo Foundation" "qatom"
+.TH qatom "1" "May 2020" "Gentoo Foundation" "qatom"
.SH NAME
qatom \- split atom strings
.SH SYNOPSIS
@@ -67,6 +67,9 @@ The package suffices, currently that is just the asterisk.
\fB\-c\fR, \fB\-\-compare\fR
Compare two atoms.
.TP
+\fB\-s\fR, \fB\-\-scompare\fR
+Compare two atoms in the given order data, query.
+.TP
\fB\-p\fR, \fB\-\-print\fR
Print reconstructed atom.
.TP
diff --git a/qatom.c b/qatom.c
index 59f7392..1c1c50e 100644
--- a/qatom.c
+++ b/qatom.c
@@ -15,10 +15,11 @@
#define QATOM_FORMAT "%{CATEGORY} %{PN} %{PV} %[PR] %[SLOT] %[pfx] %[sfx]"
-#define QATOM_FLAGS "F:cpl" COMMON_FLAGS
+#define QATOM_FLAGS "F:cspl" COMMON_FLAGS
static struct option const qatom_long_opts[] = {
{"format", a_argument, NULL, 'F'},
{"compare", no_argument, NULL, 'c'},
+ {"scompare", no_argument, NULL, 's'},
{"print", no_argument, NULL, 'p'},
{"lookup", no_argument, NULL, 'l'},
COMMON_LONG_OPTS
@@ -26,6 +27,7 @@ static struct option const qatom_long_opts[] = {
static const char * const qatom_opts_help[] = {
"Custom output format (default: " QATOM_FORMAT ")",
"Compare two atoms",
+ "Compare two atoms in the given order data, query",
"Print reconstructed atom",
"Lookup atom in tree",
COMMON_OPTS_HELP
@@ -34,7 +36,13 @@ static const char * const qatom_opts_help[] = {
int qatom_main(int argc, char **argv)
{
- enum qatom_atom { _EXPLODE=0, _COMPARE, _PRINT, _LOOKUP } action = _EXPLODE;
+ enum qatom_atom {
+ _EXPLODE = 0,
+ _COMPARE,
+ _SCOMPARE,
+ _PRINT,
+ _LOOKUP
+ } action = _EXPLODE;
const char *format = QATOM_FORMAT;
depend_atom *atom;
depend_atom *atomc;
@@ -43,10 +51,11 @@ int qatom_main(int argc, char **argv)
while ((i = GETOPT_LONG(QATOM, qatom, "")) != -1) {
switch (i) {
- case 'F': format = optarg; break;
- case 'c': action = _COMPARE; break;
- case 'p': action = _PRINT; break;
- case 'l': action = _LOOKUP; break;
+ case 'F': format = optarg; break;
+ case 'c': action = _COMPARE; break;
+ case 's': action = _SCOMPARE; break;
+ case 'p': action = _PRINT; break;
+ case 'l': action = _LOOKUP; break;
COMMON_GETOPTS_CASES(qatom)
}
}
@@ -54,7 +63,7 @@ int qatom_main(int argc, char **argv)
if (argc == optind)
qatom_usage(EXIT_FAILURE);
- if (action == _COMPARE && (argc - optind) % 2)
+ if ((action == _COMPARE || action == _SCOMPARE) && (argc - optind) % 2)
err("compare needs even number of arguments");
if (action == _LOOKUP) {
@@ -71,7 +80,8 @@ int qatom_main(int argc, char **argv)
}
switch (action) {
- case _COMPARE: {
+ case _COMPARE:
+ case _SCOMPARE: {
int r;
i++;
@@ -81,7 +91,8 @@ int qatom_main(int argc, char **argv)
break;
}
- if (atomc->blocker != ATOM_BL_NONE ||
+ if (action == _SCOMPARE ||
+ atomc->blocker != ATOM_BL_NONE ||
atomc->pfx_op != ATOM_OP_NONE ||
atomc->sfx_op != ATOM_OP_NONE ||
(atomc->CATEGORY == NULL &&
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2021-02-17 20:23 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2021-02-17 20:23 UTC (permalink / raw
To: gentoo-commits
commit: 307939315330f631f9f526f8560a2ce09605fc9c
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 17 20:19:58 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Feb 17 20:19:58 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=30793931
qwhich: add applet to show paths to packages
e.g. to find the ebuild dir of bash in thw tree:
% qwhich -dt bash
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Makefile.am | 3 +
man/qwhich.1 | 79 +++++++++++++++++++++++++
qwhich.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 272 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index ceded24..cf578f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,7 @@ APPLETS = \
qsize \
qtbz2 \
quse \
+ qwhich \
qxpak \
$(NULL)
@@ -42,6 +43,7 @@ dist_man_MANS = \
man/qsize.1 \
man/qtbz2.1 \
man/quse.1 \
+ man/qwhich.1 \
man/qxpak.1 \
$(NULL)
@@ -63,6 +65,7 @@ q_SOURCES = \
qsize.c \
qtbz2.c \
quse.c \
+ qwhich.c \
qxpak.c \
$(NULL)
q_CPPFLAGS = \
diff --git a/man/qwhich.1 b/man/qwhich.1
new file mode 100644
index 0000000..dce52c2
--- /dev/null
+++ b/man/qwhich.1
@@ -0,0 +1,79 @@
+.\" generated by mkman.py, please do NOT edit!
+.TH qwhich "1" "Feb 2021" "Gentoo Foundation" "qwhich"
+.SH NAME
+qwhich \- find path to pkg
+.SH SYNOPSIS
+.B qwhich
+\fI[opts] <useflag>\fR
+.SH DESCRIPTION
+
+.SH OPTIONS
+.TP
+\fB\-I\fR, \fB\-\-vdb\fR
+Look in VDB (installed packages).
+.TP
+\fB\-b\fR, \fB\-\-binpkg\fR
+Look at binary packages.
+.TP
+\fB\-t\fR, \fB\-\-tree\fR
+Look in main tree and overlays.
+.TP
+\fB\-p\fR, \fB\-\-pretty\fR
+Print (pretty) atom instead of path for use with -F.
+.TP
+\fB\-d\fR, \fB\-\-dir\fR
+Print directory instead of path.
+.TP
+\fB\-f\fR, \fB\-\-first\fR
+Stop searching after first match.
+.TP
+\fB\-F\fR \fI<arg>\fR, \fB\-\-format\fR \fI<arg>\fR
+Print matched using given format string.
+.TP
+\fB\-\-root\fR \fI<arg>\fR
+Set the ROOT env var.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Report full package versions, emit more elaborate output.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Tighter output; suppress warnings.
+.TP
+\fB\-C\fR, \fB\-\-nocolor\fR
+Don't output color.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Print this help and exit.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Print version and exit.
+
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.br
+Product: Portage Development; Component: Tools
+.SH AUTHORS
+.nf
+Ned Ludd <solar@gentoo.org>
+Mike Frysinger <vapier@gentoo.org>
+Fabian Groffen <grobian@gentoo.org>
+.fi
+.SH "SEE ALSO"
+.BR q (1),
+.BR qatom (1),
+.BR qcheck (1),
+.BR qdepends (1),
+.BR qfile (1),
+.BR qgrep (1),
+.BR qkeyword (1),
+.BR qlist (1),
+.BR qlop (1),
+.BR qmanifest (1),
+.BR qmerge (1),
+.BR qpkg (1),
+.BR qsearch (1),
+.BR qsize (1),
+.BR qtbz2 (1),
+.BR qtegrity (1),
+.BR quse (1),
+.BR qxpak (1)
diff --git a/qwhich.c b/qwhich.c
new file mode 100644
index 0000000..3a0c791
--- /dev/null
+++ b/qwhich.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2021 Gentoo Foundation
+ * Distributed under the terms of the GNU General Public License v2
+ *
+ * Copyright 2021- Fabian Groffen - <grobian@gentoo.org>
+ */
+
+#include "main.h"
+#include "applets.h"
+
+#include <string.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <limits.h>
+#include <sys/stat.h>
+
+#include "atom.h"
+#include "tree.h"
+
+#define QWHICH_FLAGS "IbtpdfF:" COMMON_FLAGS
+static struct option const qwhich_long_opts[] = {
+ {"vdb", no_argument, NULL, 'I'},
+ {"binpkg", no_argument, NULL, 'b'},
+ {"tree", no_argument, NULL, 't'},
+ {"pretty", no_argument, NULL, 'p'},
+ {"dir", no_argument, NULL, 'd'},
+ {"first", no_argument, NULL, 'f'},
+ {"format", a_argument, NULL, 'F'},
+ COMMON_LONG_OPTS
+};
+static const char * const qwhich_opts_help[] = {
+ "Look in VDB (installed packages)",
+ "Look at binary packages",
+ "Look in main tree and overlays",
+ "Print (pretty) atom instead of path for use with -F",
+ "Print directory instead of path",
+ "Stop searching after first match",
+ "Print matched using given format string",
+ COMMON_OPTS_HELP
+};
+static const char qwhich_desc[] = "";
+#define qwhich_usage(ret) \
+ usage(ret, QWHICH_FLAGS, qwhich_long_opts, qwhich_opts_help, qwhich_desc, lookup_applet_idx("qwhich"))
+
+struct qwhich_mode {
+ char do_vdb:1;
+ char do_binpkg:1;
+ char do_tree:1;
+ char print_atom:1;
+ char print_path:1;
+ char match_first:1;
+ const char *fmt;
+};
+
+int qwhich_main(int argc, char **argv)
+{
+ depend_atom *atom;
+ DECLARE_ARRAY(atoms);
+ DECLARE_ARRAY(trees);
+ struct qwhich_mode m;
+ struct tree_match_ctx *tmc;
+ struct tree_match_ctx *tmcw;
+ size_t i;
+ size_t j;
+ char *overlay;
+ size_t n;
+ int ret;
+ tree_ctx *t;
+ int repolen;
+
+ memset(&m, 0, sizeof(m));
+
+ while ((ret = GETOPT_LONG(QWHICH, qwhich, "")) != -1) {
+ switch (ret) {
+ COMMON_GETOPTS_CASES(qwhich)
+
+ case 'I': m.do_vdb = true; break;
+ case 'b': m.do_binpkg = true; break;
+ case 't': m.do_tree = true; break;
+ case 'p': m.print_atom = true; break;
+ case 'd': m.print_path = true; break;
+ case 'f': m.match_first = true; break;
+ case 'F': m.fmt = optarg; break;
+ }
+ }
+
+ /* defaults: no options at all, enable first match,
+ * no selectors, enable tree + overlays */
+ if (!m.do_vdb && !m.do_binpkg && !m.do_tree) {
+ if (!m.print_atom && !m.print_path && !m.match_first && m.fmt == NULL)
+ m.match_first = true;
+ m.do_tree = true;
+ }
+
+ /* when printing path, we better just match the first, else we get a
+ * lot of dups */
+ if (m.print_path)
+ m.match_first = true;
+
+ /* set format if none given */
+ if (m.fmt == NULL) {
+ if (verbose)
+ m.fmt = "%[CATEGORY]%[PF]";
+ else
+ m.fmt = "%[CATEGORY]%[PN]";
+ } else {
+ /* makes no sense to use formatter if we're not going to use it */
+ m.print_atom = true;
+ }
+
+ argc -= optind;
+ argv += optind;
+ for (i = 0; i < (size_t)argc; ++i) {
+ atom = atom_explode(argv[i]);
+ if (!atom)
+ warn("invalid atom: %s", argv[i]);
+ else
+ xarraypush_ptr(atoms, atom);
+ }
+
+ /* TODO: silence when the path doesn't exist -- reasonable though? */
+ if (m.do_vdb) {
+ t = tree_open_vdb(portroot, portvdb);
+ if (t != NULL)
+ xarraypush_ptr(trees, t);
+ }
+ if (m.do_binpkg) {
+ t = tree_open_binpkg(portroot, pkgdir);
+ if (t != NULL)
+ xarraypush_ptr(trees, t);
+ }
+
+ if (m.do_tree) {
+ array_for_each(overlays, n, overlay) {
+ t = tree_open(portroot, overlay);
+ if (t != NULL)
+ xarraypush_ptr(trees, t);
+ }
+ }
+
+ /* at least keep the IO constrained to a tree at a time */
+ array_for_each(trees, j, t) {
+ if (t->cachetype == CACHE_METADATA_MD5)
+ repolen = strlen(t->path) - (sizeof("/metadata/md5-cache") - 1);
+ else if (t->cachetype == CACHE_METADATA_PMS)
+ repolen = strlen(t->path) - (sizeof("/metadata/cache") - 1);
+ else
+ repolen = 0;
+
+ array_for_each(atoms, i, atom) {
+ tmc = tree_match_atom(t, atom,
+ m.match_first ? TREE_MATCH_FIRST : TREE_MATCH_DEFAULT);
+ for (tmcw = tmc; tmcw != NULL; tmcw = tmcw->next) {
+ if (m.print_atom) {
+ printf("%s\n", atom_format(m.fmt, tmcw->atom));
+ } else {
+ if (t->cachetype == CACHE_METADATA_MD5 ||
+ t->cachetype == CACHE_METADATA_PMS)
+ {
+ if (m.print_path)
+ printf("%s%.*s/%s%s/%s%s%s\n",
+ GREEN, repolen, t->path,
+ BOLD, tmcw->atom->CATEGORY,
+ DKBLUE, tmcw->atom->PN,
+ NORM);
+ else
+ printf("%s%.*s/%s%s/%s%s/%s%s%s.ebuild%s\n",
+ DKGREEN, repolen, t->path,
+ BOLD, tmcw->atom->CATEGORY,
+ DKBLUE, tmcw->atom->PN,
+ BLUE, tmcw->atom->P,
+ DKGREEN, NORM);
+ } else {
+ printf("%s%s%s\n", DKBLUE, tmcw->path, NORM);
+ }
+ }
+ }
+ tree_match_close(tmc);
+ }
+ tree_close(t);
+ }
+ array_for_each(atoms, i, atom)
+ atom_implode(atom);
+ xarrayfree_int(atoms);
+ xarrayfree_int(trees);
+
+ return EXIT_SUCCESS;
+}
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2022-05-26 14:36 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2022-05-26 14:36 UTC (permalink / raw
To: gentoo-commits
commit: d301ed27e28417f185c374a044cfabeb32beb607
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu May 26 14:32:32 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu May 26 14:32:32 2022 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d301ed27
qdepends: add --resolve flag to lookup depstrings
This doesn't respect keywords or masks, but with installed packages
shows which packages currently match the deps as expressed
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qdepends.1 | 11 ++++++++++-
qdepends.c | 51 +++++++++++++++++++++++++++++++++++----------------
2 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/man/qdepends.1 b/man/qdepends.1
index 0690f16..5e5b00a 100644
--- a/man/qdepends.1
+++ b/man/qdepends.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qdepends "1" "Feb 2021" "Gentoo Foundation" "qdepends"
+.TH qdepends "1" "May 2022" "Gentoo Foundation" "qdepends"
.SH NAME
qdepends \- show dependency info
.SH SYNOPSIS
@@ -68,6 +68,9 @@ Search installed packages using VDB.
\fB\-t\fR, \fB\-\-tree\fR
Search available ebuilds in the tree.
.TP
+\fB\-U\fR, \fB\-\-use\fR
+Apply profile USE-flags to conditional deps.
+.TP
\fB\-F\fR \fI<arg>\fR, \fB\-\-format\fR \fI<arg>\fR
Pretty-print DEPEND declaration to be used in an ebuild. This
option initiates a very different mode of operation. Instead of
@@ -82,6 +85,9 @@ e.g.\ the DEPEND= part is skipped.
\fB\-S\fR, \fB\-\-pretty\fR
Pretty format specified depend strings.
.TP
+\fB\-R\fR, \fB\-\-resolve\fR
+Resolve found dependencies to package versions.
+.TP
\fB\-\-root\fR \fI<arg>\fR
Set the ROOT env var.
.TP
@@ -97,6 +103,9 @@ Suppress DEPEND= output for \fB\-f\fR. Only print the matching atom for \fB\-Q\
\fB\-C\fR, \fB\-\-nocolor\fR
Don't output color.
.TP
+\fB\-\-color\fR
+Force color in output.
+.TP
\fB\-h\fR, \fB\-\-help\fR
Print this help and exit.
.TP
diff --git a/qdepends.c b/qdepends.c
index f1bc3ad..bd7c379 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -22,7 +22,7 @@
#include "xasprintf.h"
#include "xregex.h"
-#define QDEPENDS_FLAGS "drpbQitUF:S" COMMON_FLAGS
+#define QDEPENDS_FLAGS "drpbQitUF:SR" COMMON_FLAGS
static struct option const qdepends_long_opts[] = {
{"depend", no_argument, NULL, 'd'},
{"rdepend", no_argument, NULL, 'r'},
@@ -34,6 +34,7 @@ static struct option const qdepends_long_opts[] = {
{"use", no_argument, NULL, 'U'},
{"format", a_argument, NULL, 'F'},
{"pretty", no_argument, NULL, 'S'},
+ {"resolve", no_argument, NULL, 'R'},
COMMON_LONG_OPTS
};
static const char * const qdepends_opts_help[] = {
@@ -47,20 +48,23 @@ static const char * const qdepends_opts_help[] = {
"Apply profile USE-flags to conditional deps",
"Print matched atom using given format string",
"Pretty format specified depend strings",
+ "Resolve found dependencies to package versions",
COMMON_OPTS_HELP
};
#define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, NULL, lookup_applet_idx("qdepends"))
/* structures / types / etc ... */
struct qdepends_opt_state {
- unsigned int qmode;
- array_t *atoms;
- array_t *deps;
- set *udeps;
- char *depend;
- size_t depend_len;
- const char *format;
- tree_ctx *vdb;
+ unsigned int qmode;
+ array_t *atoms;
+ array_t *deps;
+ set *udeps;
+ char *depend;
+ size_t depend_len;
+ const char *format;
+ char resolve:1;
+ tree_ctx *vdb;
+ tree_ctx *rtree;
};
#define QMODE_DEPEND (1<<0)
@@ -174,6 +178,10 @@ qdepends_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
continue;
}
+ /* try and resolve expressions to real package atoms */
+ if (state->resolve)
+ dep_resolve_tree(dep_tree, state->rtree);
+
if (state->qmode & QMODE_TREE &&
!(state->qmode & QMODE_REVERSE) &&
verbose)
@@ -301,12 +309,14 @@ int qdepends_main(int argc, char **argv)
DECLARE_ARRAY(atoms);
DECLARE_ARRAY(deps);
struct qdepends_opt_state state = {
- .atoms = atoms,
- .deps = deps,
- .udeps = create_set(),
- .qmode = 0,
- .format = "%[CATEGORY]%[PF]",
- .vdb = NULL,
+ .atoms = atoms,
+ .deps = deps,
+ .udeps = create_set(),
+ .qmode = 0,
+ .format = "%[CATEGORY]%[PF]",
+ .resolve = false,
+ .vdb = NULL,
+ .rtree = NULL,
};
size_t i;
int ret;
@@ -328,6 +338,7 @@ int qdepends_main(int argc, char **argv)
case 't': state.qmode |= QMODE_TREE; break;
case 'U': state.qmode |= QMODE_FILTERUSE; break;
case 'S': do_pretty = true; break;
+ case 'R': state.resolve = true; break;
case 'F': state.format = optarg; break;
}
}
@@ -391,6 +402,8 @@ int qdepends_main(int argc, char **argv)
array_for_each(overlays, n, overlay) {
t = tree_open(portroot, overlay);
if (t != NULL) {
+ if (state.resolve)
+ state.rtree = tree_open(portroot, overlay);
if (!(state.qmode & QMODE_REVERSE) && array_cnt(atoms) > 0) {
array_for_each(atoms, i, atom) {
ret |= tree_foreach_pkg_sorted(t,
@@ -401,9 +414,13 @@ int qdepends_main(int argc, char **argv)
qdepends_results_cb, &state, NULL);
}
tree_close(t);
+ if (state.rtree)
+ tree_close(state.rtree);
}
}
- } else {
+ } else { /* INSTALLED */
+ if (state.resolve)
+ state.rtree = tree_open_vdb(portroot, portvdb);
if (!(state.qmode & QMODE_REVERSE) && array_cnt(atoms) > 0) {
array_for_each(atoms, i, atom) {
ret |= tree_foreach_pkg_fast(state.vdb,
@@ -413,6 +430,8 @@ int qdepends_main(int argc, char **argv)
ret |= tree_foreach_pkg_fast(state.vdb,
qdepends_results_cb, &state, NULL);
}
+ if (state.rtree)
+ tree_close(state.rtree);
}
if (state.vdb != NULL)
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, /
@ 2022-12-15 9:36 Fabian Groffen
0 siblings, 0 replies; 13+ messages in thread
From: Fabian Groffen @ 2022-12-15 9:36 UTC (permalink / raw
To: gentoo-commits
commit: 05e24fdd5fda7fdee37c7f48d398e15f3ba56514
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 15 09:35:57 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Dec 15 09:35:57 2022 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=05e24fdd
qkeyword: add -A option to show the current arch
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/qkeyword.1 | 8 +++++++-
qkeyword.c | 31 +++++++++++++++++++------------
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/man/qkeyword.1 b/man/qkeyword.1
index 2c7eaf5..476a6fa 100644
--- a/man/qkeyword.1
+++ b/man/qkeyword.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qkeyword "1" "Feb 2021" "Gentoo Foundation" "qkeyword"
+.TH qkeyword "1" "Dec 2022" "Gentoo Foundation" "qkeyword"
.SH NAME
qkeyword \- list packages based on keywords
.SH SYNOPSIS
@@ -37,6 +37,9 @@ match catname.
\fB\-m\fR \fI<arg>\fR, \fB\-\-matchmaint\fR \fI<arg>\fR
match maintainer email from metadata.xml (slow).
.TP
+\fB\-A\fR, \fB\-\-showarch\fR
+show selected arch from profile configuration.
+.TP
\fB\-i\fR, \fB\-\-imlate\fR
list packages that can be marked stable for <arch>.
.TP
@@ -76,6 +79,9 @@ Tighter output; suppress warnings.
\fB\-C\fR, \fB\-\-nocolor\fR
Don't output color.
.TP
+\fB\-\-color\fR
+Force color in output.
+.TP
\fB\-h\fR, \fB\-\-help\fR
Print this help and exit.
.TP
diff --git a/qkeyword.c b/qkeyword.c
index 0989e20..5bc1010 100644
--- a/qkeyword.c
+++ b/qkeyword.c
@@ -28,11 +28,12 @@
/* Required portage-utils stuff */
/********************************************************************/
-#define QKEYWORD_FLAGS "p:c:m:idtsanSTF:" COMMON_FLAGS
+#define QKEYWORD_FLAGS "p:c:m:AidtsanSTF:" COMMON_FLAGS
static struct option const qkeyword_long_opts[] = {
{"matchpkg", a_argument, NULL, 'p'},
{"matchcat", a_argument, NULL, 'c'},
{"matchmaint", a_argument, NULL, 'm'},
+ {"showarch", no_argument, NULL, 'A'},
{"imlate", no_argument, NULL, 'i'},
{"dropped", no_argument, NULL, 'd'},
{"needsstable", no_argument, NULL, 't'},
@@ -48,6 +49,7 @@ static const char * const qkeyword_opts_help[] = {
"match pkgname",
"match catname",
"match maintainer email from metadata.xml (slow)",
+ "show selected arch from profile configuration",
"list packages that can be marked stable for <arch>",
"list packages that have dropped keywords for <arch>",
"list packages that have ~arch versions, but no stable versions for <arch>",
@@ -818,19 +820,22 @@ qkeyword_traverse(tree_pkg_cb func, void *priv)
int qkeyword_main(int argc, char **argv)
{
- int i;
- char action = '\0';
+ int i;
+ char action = '\0';
+ char *pkg = NULL;
+ char *cat = NULL;
+ char *maint = NULL;
+ bool showarch = false;
qkeyword_data data;
- char *pkg = NULL;
- char *cat = NULL;
- char *maint = NULL;
data.fmt = NULL;
while ((i = GETOPT_LONG(QKEYWORD, qkeyword, "")) != -1) {
switch (i) {
- case 'p': pkg = optarg; break;
- case 'c': cat = optarg; break;
- case 'm': maint = optarg; break;
+ case 'p': pkg = optarg; break;
+ case 'c': cat = optarg; break;
+ case 'm': maint = optarg; break;
+ case 'A': showarch = true; break;
+ case 'F': data.fmt = optarg; break;
case 'i':
case 'd':
case 't':
@@ -844,9 +849,6 @@ int qkeyword_main(int argc, char **argv)
qkeyword_usage(EXIT_FAILURE);
action = i;
break;
- case 'F':
- data.fmt = optarg;
- break;
COMMON_GETOPTS_CASES(qkeyword)
}
@@ -860,6 +862,11 @@ int qkeyword_main(int argc, char **argv)
optind + 1 < argc)
qkeyword_usage(EXIT_FAILURE);
+ if (showarch) {
+ printf("%s\n", data.arch);
+ return EXIT_SUCCESS;
+ }
+
if (cat != NULL) {
data.qatom = atom_explode_cat(pkg == NULL ? "" : pkg, cat);
if (data.qatom == NULL) {
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-12-15 9:36 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-17 20:23 [gentoo-commits] proj/portage-utils:master commit in: man/, / Fabian Groffen
-- strict thread matches above, loose matches on Subject: below --
2022-12-15 9:36 Fabian Groffen
2022-05-26 14:36 Fabian Groffen
2020-05-16 13:06 Fabian Groffen
2020-01-19 9:49 Fabian Groffen
2019-07-14 18:51 Fabian Groffen
2019-07-14 13:09 Fabian Groffen
2019-06-21 18:24 Fabian Groffen
2019-05-03 8:50 Fabian Groffen
2019-05-02 18:02 Fabian Groffen
2019-04-28 8:52 Fabian Groffen
2019-02-28 19:28 Fabian Groffen
2016-03-28 4:53 Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox