* [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, /
@ 2018-04-03 11:50 Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2018-04-03 11:50 UTC (permalink / raw
To: gentoo-commits
commit: 1def9d468742c0d6d6b24aa1f1d76243be6e24cd
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 3 11:49:41 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Apr 3 11:49:41 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1def9d46
qlist: improve documentation
Bug: https://bugs.gentoo.org/645554
man/include/qlist.desc | 6 +++++
man/include/qlist.optdesc.yaml | 24 ++++++++++++++++++
man/qlist.1 | 56 +++++++++++++++++++++++++++---------------
qlist.c | 2 +-
4 files changed, 67 insertions(+), 21 deletions(-)
diff --git a/man/include/qlist.desc b/man/include/qlist.desc
new file mode 100644
index 0000000..e02d971
--- /dev/null
+++ b/man/include/qlist.desc
@@ -0,0 +1,6 @@
+\fIqlist\fR shows the contents, or a subset thereof, of an installed
+package. Alternatively, lists whether a package is installed,
+optionally with version, USE-flag, SLOT or REPO information. The
+\fIpkgname\fR to query for does not have to be an exact match, it may be
+part of it, e.g.\ an entire category, or any package with some string in
+its name.
diff --git a/man/include/qlist.optdesc.yaml b/man/include/qlist.optdesc.yaml
new file mode 100644
index 0000000..a60ef0d
--- /dev/null
+++ b/man/include/qlist.optdesc.yaml
@@ -0,0 +1,24 @@
+installed: |
+ Instead of listing the contents of a package, just print the package
+ name if the package is currently installed.
+umap: |
+ List USE-flags enabled when the package was installed. This flag
+ implies \fB\-I\fR.
+slot: |
+ Display installed packages with slots (use twice for subslots).
+ This flag implies \fB\-I\fR.
+repo: |
+ Display installed packages with repository the ebuild originated from.
+ This flag implies \fB\-I\fR.
+columns: |
+ Like \fB\-Iv\fR, but package name and version are separated by a
+ space for easy consumption by e.g.\ shell scripts which can read
+ space-separated columns.
+verbose: |
+ When used with \fB\-I\fR, print the package version next to name.
+ When listing the package contents, a single \fB\-v\fR displays
+ symlinks with an arrow (\->) to their target. Two or more \fB\-v\fR
+ adds colour to the entries and prints like \fB\-I\fR before the
+ listing.
+quiet: |
+ Suppresses the parenthesis around the USE-flags when used with \fB\-U\fR.
diff --git a/man/qlist.1 b/man/qlist.1
index 05e9326..f7dd847 100644
--- a/man/qlist.1
+++ b/man/qlist.1
@@ -1,68 +1,84 @@
-.TH qlist "1" "Mar 2016" "Gentoo Foundation" "qlist"
+.\" generated by mkman.py, please do NOT edit!
+.TH qlist "1" "Apr 2018" "Gentoo Foundation" "qlist"
.SH NAME
qlist \- list files owned by pkgname
.SH SYNOPSIS
.B qlist
\fI[opts] <pkgname>\fR
.SH DESCRIPTION
-
+\fIqlist\fR shows the contents, or a subset thereof, of an installed
+package. Alternatively, lists whether a package is installed,
+optionally with version, USE-flag, SLOT or REPO information. The
+\fIpkgname\fR to query for does not have to be an exact match, it may be
+part of it, e.g.\ an entire category, or any package with some string in
+its name.
.SH OPTIONS
.TP
\fB\-I\fR, \fB\-\-installed\fR
-Just show installed packages
+Instead of listing the contents of a package, just print the package
+name if the package is currently installed.
.TP
\fB\-S\fR, \fB\-\-slots\fR
-Display installed packages with slots (use twice for subslots)
+Display installed packages with slots (use twice for subslots).
.TP
\fB\-R\fR, \fB\-\-repo\fR
-Display installed packages with repository
+Display installed packages with repository the ebuild originated from.
+This flag implies \fB\-I\fR.
.TP
\fB\-U\fR, \fB\-\-umap\fR
-Display installed packages with flags used
+List USE-flags enabled when the package was installed. This flag
+implies \fB\-I\fR.
.TP
\fB\-c\fR, \fB\-\-columns\fR
-Display column view
+Like \fB\-Iv\fR, but package name and version are separated by a
+space for easy consumption by e.g.\ shell scripts which can read
+space-separated columns.
.TP
\fB\-\-showdebug\fR
-Show /usr/lib/debug files
+Show /usr/lib/debug and /usr/src/debug files.
.TP
\fB\-e\fR, \fB\-\-exact\fR
-Exact match (only CAT/PN or PN without PV)
+Exact match (only CAT/PN or PN without PV).
.TP
\fB\-a\fR, \fB\-\-all\fR
-Show every installed package
+Show every installed package.
.TP
\fB\-d\fR, \fB\-\-dir\fR
-Only show directories
+Only show directories.
.TP
\fB\-o\fR, \fB\-\-obj\fR
-Only show objects
+Only show objects.
.TP
\fB\-s\fR, \fB\-\-sym\fR
-Only show symlinks
+Only show symlinks.
.TP
\fB\-\-root\fR \fI<arg>\fR
-Set the ROOT env var
+Set the ROOT env var.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
-Make a lot of noise
+When used with \fB\-I\fR, print the package version next to name.
+When listing the package contents, a single \fB\-v\fR displays
+symlinks with an arrow (\->) to their target. Two or more \fB\-v\fR
+adds colour to the entries and prints like \fB\-I\fR before the
+listing.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
-Tighter output; suppress warnings
+Suppresses the parenthesis around the USE-flags when used with \fB\-U\fR.
.TP
\fB\-C\fR, \fB\-\-nocolor\fR
-Don't output color
+Don't output color.
.TP
\fB\-h\fR, \fB\-\-help\fR
-Print this help and exit
+Print this help and exit.
.TP
\fB\-V\fR, \fB\-\-version\fR
-Print version and exit
+Print version and exit.
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
.br
-Product: Portage Development; Component: Tools
+Product: Portage Development; Component: Tools, Assignee:
+portage-utils@gentoo.org
.SH AUTHORS
.nf
Ned Ludd <solar@gentoo.org>
diff --git a/qlist.c b/qlist.c
index 1f8757c..6b5eb0a 100644
--- a/qlist.c
+++ b/qlist.c
@@ -31,7 +31,7 @@ static const char * const qlist_opts_help[] = {
"Display installed packages with repository",
"Display installed packages with flags used",
"Display column view",
- "Show /usr/lib/debug files",
+ "Show /usr/lib/debug and /usr/src/debug files",
"Exact match (only CAT/PN or PN without PV)",
"Show every installed package",
"Only show directories",
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, /
@ 2018-04-12 19:33 Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2018-04-12 19:33 UTC (permalink / raw
To: gentoo-commits
commit: 33d4e18b26cd37691a81584da0efd929097a22b3
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 12 19:14:19 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Apr 12 19:14:19 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=33d4e18b
qlop: don't rely on %F for data parsing for portability
While at it document the date formats in the man-page.
man/include/qlop.optdesc.yaml | 16 ++++++++++++++++
man/qlop.1 | 16 +++++++++++++++-
qlop.c | 6 +++---
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml
index 7864d6e..fad1670 100644
--- a/man/include/qlop.optdesc.yaml
+++ b/man/include/qlop.optdesc.yaml
@@ -1,3 +1,19 @@
+date: |
+ Limit the selection of packages to the date given, or to the range
+ of dates if this argument is given twice. The \fB--date\fR option
+ can take a few forms.
+ .RS
+ .IP "NUMBER <day|week|month|year>[s] [ago]"
+ Relative time, specifying \fINUMBER\fR \fIdays\fR, \fIweeks\fR,
+ \fImonths\fR or \fIyears\fR, for example \fI3 days ago\fR.
+ .IP YYYY-MM-DD
+ Big-endian date, with components separated by hyphens, starting with
+ year, followed by month and day of month.
+ .IP SSSSSSSSS
+ Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch.
+ .IP FORMAT|DATE
+ Use \fIFORMAT\fR as input for \fBstrptime\fR(3) to parse \fIDATE\fR.
+ .RE
gauge: |
Gauge number of times a package has been merged. This shows the
merge time for each individual merge of package.
diff --git a/man/qlop.1 b/man/qlop.1
index c138054..9c449a9 100644
--- a/man/qlop.1
+++ b/man/qlop.1
@@ -39,7 +39,21 @@ Show current emerging packages. This relies on
in order to detect running merges.
.TP
\fB\-d\fR \fI<arg>\fR, \fB\-\-date\fR \fI<arg>\fR
-Limit selection to this time (1st -d is start, 2nd -d is end).
+Limit the selection of packages to the date given, or to the range
+of dates if this argument is given twice. The \fB--date\fR option
+can take a few forms.
+.RS
+.IP "NUMBER <day|week|month|year>[s] [ago]"
+Relative time, specifying \fINUMBER\fR \fIdays\fR, \fIweeks\fR,
+\fImonths\fR or \fIyears\fR, for example \fI3 days ago\fR.
+.IP YYYY-MM-DD
+Big-endian date, with components separated by hyphens, starting with
+year, followed by month and day of month.
+.IP SSSSSSSSS
+Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch.
+.IP FORMAT|DATE
+Use \fIFORMAT\fR as input for \fBstrptime\fR(3) to parse \fIDATE\fR.
+.RE
.TP
\fB\-f\fR \fI<arg>\fR, \fB\-\-logfile\fR \fI<arg>\fR
Read emerge logfile instead of $EMERGE_LOG_DIR/emerge.log.
diff --git a/qlop.c b/qlop.c
index 67669ef..1d4e0d9 100644
--- a/qlop.c
+++ b/qlop.c
@@ -39,7 +39,7 @@ 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 '2015-12-25' (detected as %Y-%m-%d)\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"))
@@ -733,7 +733,7 @@ parse_date(const char *sdate, time_t *t)
} else {
/* Handle automatic formats:
* - "12315128" -> %s
- * - "2015-12-24" -> %F (same as %Y-%m-%d
+ * - "2015-12-24" -> %Y-%m-%d
* - human readable format (see below)
*/
size_t len = strspn(sdate, "0123456789-");
@@ -742,7 +742,7 @@ parse_date(const char *sdate, time_t *t)
if (strchr(sdate, '-') == NULL)
fmt = "%s";
else
- fmt = "%F";
+ fmt = "%Y-%m-%d";
s = strptime(sdate, fmt, &tm);
if (s == NULL || s[0] != '\0')
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, /
@ 2019-02-05 13:51 Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2019-02-05 13:51 UTC (permalink / raw
To: gentoo-commits
commit: 5674671e9d7e0e1251561d81a1154dd5d92e60ec
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 5 13:47:59 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Feb 5 13:50:23 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5674671e
qdepends: add support for BDEPEND
Bug: https://bugs.gentoo.org/674936
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/include/qdepends.optdesc.yaml | 8 ++++----
man/qdepends.1 | 13 ++++++++-----
qdepends.c | 15 ++++++++++++---
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/man/include/qdepends.optdesc.yaml b/man/include/qdepends.optdesc.yaml
index 51b1cc7..5d786f3 100644
--- a/man/include/qdepends.optdesc.yaml
+++ b/man/include/qdepends.optdesc.yaml
@@ -1,13 +1,13 @@
all: |
- Show *DEPEND, alias for \fB\-drp\fR.
+ Show *DEPEND, alias for \fB\-drpb\fR.
key: |
Advanced option to allow querying the VDB. This option overrides
- \fB\-d\fR, \fB\-r\fR, \fB\-p\fR or \fB\-a\fR. \fI<arg>\fR can be
- any key from Portage's VDB, e.g.\ any file from
+ \fB\-d\fR, \fB\-r\fR, \fB\-p\fR, \fB\-b\fR or \fB\-a\fR.
+ \fI<arg>\fR can be any key from Portage's VDB, e.g.\ any file from
var/db/pkg/<cat>/<pkg>/.
query: |
Query reverse deps. This basically reverses the search to any
- package that references \fI<arg>\fR in DEPEND, RDEPEND or PDEPEND.
+ package that references \fI<arg>\fR in DEPEND, RDEPEND, PDEPEND or BDEPEND.
This can be useful to find consumers of a given package, e.g.\ to
search for packages that have \fIlogwatch\fR in their DEPEND.
name-only: |
diff --git a/man/qdepends.1 b/man/qdepends.1
index 2e1aab2..0273999 100644
--- a/man/qdepends.1
+++ b/man/qdepends.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qdepends "1" "May 2018" "Gentoo Foundation" "qdepends"
+.TH qdepends "1" "Feb 2019" "Gentoo Foundation" "qdepends"
.SH NAME
qdepends \- show dependency info
.SH SYNOPSIS
@@ -32,15 +32,18 @@ Show RDEPEND info.
\fB\-p\fR, \fB\-\-pdepend\fR
Show PDEPEND info.
.TP
+\fB\-b\fR, \fB\-\-bdepend\fR
+Show BDEPEND info.
+.TP
\fB\-k\fR \fI<arg>\fR, \fB\-\-key\fR \fI<arg>\fR
Advanced option to allow querying the VDB. This option overrides
-\fB\-d\fR, \fB\-r\fR, \fB\-p\fR or \fB\-a\fR. \fI<arg>\fR can be
-any key from Portage's VDB, e.g.\ any file from
+\fB\-d\fR, \fB\-r\fR, \fB\-p\fR, \fB\-b\fR or \fB\-a\fR.
+\fI<arg>\fR can be any key from Portage's VDB, e.g.\ any file from
var/db/pkg/<cat>/<pkg>/.
.TP
\fB\-Q\fR \fI<arg>\fR, \fB\-\-query\fR \fI<arg>\fR
Query reverse deps. This basically reverses the search to any
-package that references \fI<arg>\fR in DEPEND, RDEPEND or PDEPEND.
+package that references \fI<arg>\fR in DEPEND, RDEPEND, PDEPEND or BDEPEND.
This can be useful to find consumers of a given package, e.g.\ to
search for packages that have \fIlogwatch\fR in their DEPEND.
.TP
@@ -48,7 +51,7 @@ search for packages that have \fIlogwatch\fR in their DEPEND.
Only show category/package, instead of category/package-version.
.TP
\fB\-a\fR, \fB\-\-all\fR
-Show *DEPEND, alias for \fB\-drp\fR.
+Show *DEPEND, alias for \fB\-drpb\fR.
.TP
\fB\-f\fR, \fB\-\-format\fR
Pretty-print DEPEND declaration to be used in an ebuild. This
diff --git a/qdepends.c b/qdepends.c
index e6b9bcf..92ae57b 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2018 Gentoo Authors
+ * Copyright 2005-2019 Gentoo Authors
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2005-2010 Ned Ludd - <solar@gentoo.org>
@@ -9,11 +9,12 @@
#ifdef APPLET_qdepends
-#define QDEPENDS_FLAGS "drpafNk:Q:" COMMON_FLAGS
+#define QDEPENDS_FLAGS "drpbafNk:Q:" COMMON_FLAGS
static struct option const qdepends_long_opts[] = {
{"depend", no_argument, NULL, 'd'},
{"rdepend", no_argument, NULL, 'r'},
{"pdepend", no_argument, NULL, 'p'},
+ {"bdepend", no_argument, NULL, 'b'},
{"key", a_argument, NULL, 'k'},
{"query", a_argument, NULL, 'Q'},
{"name-only", no_argument, NULL, 'N'},
@@ -25,6 +26,7 @@ static const char * const qdepends_opts_help[] = {
"Show DEPEND info (default)",
"Show RDEPEND info",
"Show PDEPEND info",
+ "Show BDEPEND info",
"User defined vdb key",
"Query reverse deps",
"Only show package name",
@@ -639,7 +641,13 @@ int qdepends_main(int argc, char **argv)
bool do_format = false;
const char *query = NULL;
const char *depend_file;
- const char *depend_files[] = { "DEPEND", "RDEPEND", "PDEPEND", NULL, NULL };
+ const char *depend_files[] = {
+ /* 0 */ "DEPEND",
+ /* 1 */ "RDEPEND",
+ /* 2 */ "PDEPEND",
+ /* 3 */ "BDEPEND",
+ /* 4 */ NULL
+ };
depend_file = depend_files[0];
@@ -650,6 +658,7 @@ int qdepends_main(int argc, char **argv)
case 'd': depend_file = depend_files[0]; break;
case 'r': depend_file = depend_files[1]; break;
case 'p': depend_file = depend_files[2]; break;
+ case 'b': depend_file = depend_files[3]; break;
case 'k': depend_file = optarg; break;
case 'a': depend_file = NULL; break;
case 'Q': query = optarg; break;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, /
@ 2019-05-13 12:57 Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2019-05-13 12:57 UTC (permalink / raw
To: gentoo-commits
commit: 7854ca6d12f793f3b516373784831131db36bca9
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon May 13 12:56:30 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon May 13 12:56:30 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7854ca6d
qlop: add mode for listing last emerge contents
add -l flag to list packages/sync from last emerge operation and make it
default (when no flags are given)
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
TODO.md | 2 --
man/include/qlop.desc | 5 ++--
man/include/qlop.optdesc.yaml | 3 +++
man/qlop.1 | 9 +++++--
qlop.c | 62 ++++++++++++++++++++++++++++++++-----------
5 files changed, 60 insertions(+), 21 deletions(-)
diff --git a/TODO.md b/TODO.md
index 7df8983..58ea4c5 100644
--- a/TODO.md
+++ b/TODO.md
@@ -83,8 +83,6 @@
- have a mode that doesn't print timestamp (to get just atoms, -v should
work)
-- make a -d mode that allows to do equivalent of "last portage emerge"
- to make it easy to see what was newly merged/unmerged
# qlist
- have -F for use with -I so one can do things like print SLOT for
diff --git a/man/include/qlop.desc b/man/include/qlop.desc
index 0c14e00..3505173 100644
--- a/man/include/qlop.desc
+++ b/man/include/qlop.desc
@@ -2,9 +2,10 @@
reads from $EMERGE_LOG_DIR/emerge.log and tries to extract
information about merges, unmerges and syncs. It can
calculate average merge times or just list them. When given no
-arguments or just \fB-v\fR, \fIqlop\fR acts as if \fB-must\fR was given
+arguments or just \fB-v\fR, \fIqlop\fR acts as if \fB-slumt\fR was given
and thus lists the time taken for all occurrances of merges, unmerges
-and sync operations found in the log.
+and sync operations found in the log for the last \fBemerge\fR(1) action
+performed by Portage.
.P
By default, packages are printed as CATEGORY/PN. Use \fB-v\fR to print
the package version and revision numbers, e.g\. CATEGORY/PF. Note that
diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml
index 25143b2..677c4d2 100644
--- a/man/include/qlop.optdesc.yaml
+++ b/man/include/qlop.optdesc.yaml
@@ -21,6 +21,9 @@ date: |
.IP FORMAT|DATE
Use \fIFORMAT\fR as input for \fBstrptime\fR(3) to parse \fIDATE\fR.
.RE
+lastmerge: |
+ Limit selection to last Portage emerge action. This option is a
+ dynamic version of \fB-d\fR, and hence both cannot be used together.
time: |
Show the time it took to merge, unmerge or sync.
average: |
diff --git a/man/qlop.1 b/man/qlop.1
index 83b62f8..ae40fa7 100644
--- a/man/qlop.1
+++ b/man/qlop.1
@@ -10,9 +10,10 @@ qlop \- emerge log analyzer
reads from $EMERGE_LOG_DIR/emerge.log and tries to extract
information about merges, unmerges and syncs. It can
calculate average merge times or just list them. When given no
-arguments or just \fB-v\fR, \fIqlop\fR acts as if \fB-must\fR was given
+arguments or just \fB-v\fR, \fIqlop\fR acts as if \fB-slumt\fR was given
and thus lists the time taken for all occurrances of merges, unmerges
-and sync operations found in the log.
+and sync operations found in the log for the last \fBemerge\fR(1) action
+performed by Portage.
.P
By default, packages are printed as CATEGORY/PN. Use \fB-v\fR to print
the package version and revision numbers, e.g\. CATEGORY/PF. Note that
@@ -98,6 +99,10 @@ Seconds since 1970-01-01 00:00:00 +0000 (UTC), the UNIX epoch.
Use \fIFORMAT\fR as input for \fBstrptime\fR(3) to parse \fIDATE\fR.
.RE
.TP
+\fB\-l\fR, \fB\-\-lastmerge\fR
+Limit selection to last Portage emerge action. This option is a
+dynamic version of \fB-d\fR, and hence both cannot be used together.
+.TP
\fB\-f\fR \fI<arg>\fR, \fB\-\-logfile\fR \fI<arg>\fR
Read emerge logfile instead of $EMERGE_LOG_DIR/emerge.log.
.TP
diff --git a/qlop.c b/qlop.c
index a60e5ac..5217638 100644
--- a/qlop.c
+++ b/qlop.c
@@ -24,7 +24,7 @@
#define QLOP_DEFAULT_LOGFILE "emerge.log"
-#define QLOP_FLAGS "ctaHMmuUserd:f:w:" COMMON_FLAGS
+#define QLOP_FLAGS "ctaHMmuUslerd:f:w:" COMMON_FLAGS
static struct option const qlop_long_opts[] = {
{"summary", no_argument, NULL, 'c'},
{"time", no_argument, NULL, 't'},
@@ -38,6 +38,7 @@ static struct option const qlop_long_opts[] = {
{"endtime", no_argument, NULL, 'e'},
{"running", no_argument, NULL, 'r'},
{"date", a_argument, NULL, 'd'},
+ {"lastmerge", no_argument, NULL, 'l'},
{"logfile", a_argument, NULL, 'f'},
{"atoms", a_argument, NULL, 'w'},
COMMON_LONG_OPTS
@@ -55,6 +56,7 @@ static const char * const qlop_opts_help[] = {
"Report time at which the operation finished (iso started)",
"Show current emerging packages",
"Limit selection to this time (1st -d is start, 2nd -d is end)",
+ "Limit selection to last Portage emerge action",
"Read emerge logfile instead of $EMERGE_LOG_DIR/" QLOP_DEFAULT_LOGFILE,
"Read package atoms to report from file",
COMMON_OPTS_HELP
@@ -80,6 +82,7 @@ struct qlop_mode {
char do_human:1;
char do_machine:1;
char do_endtime:1;
+ char show_lastmerge:1;
};
static bool
@@ -319,7 +322,8 @@ static int do_emerge_log(
char buf[BUFSIZ];
char *p;
char *q;
- time_t tstart;
+ time_t tstart = LONG_MAX;
+ time_t last_merge = 0;
time_t sync_start = 0;
time_t sync_time = 0;
size_t sync_cnt = 0;
@@ -332,6 +336,7 @@ static int do_emerge_log(
DECLARE_ARRAY(unmerge_averages);
size_t i;
size_t parallel_emerge = 0;
+ bool all_atoms = false;
struct pkg_match {
char id[BUFSIZ];
@@ -352,7 +357,8 @@ static int do_emerge_log(
return 1;
}
- if (array_cnt(atoms) == 0) {
+ all_atoms = array_cnt(atoms) == 0;
+ if (all_atoms || flags->show_lastmerge) {
/* assemble list of atoms */
while (fgets(buf, sizeof(buf), fp) != NULL) {
if ((p = strchr(buf, ':')) == NULL)
@@ -363,6 +369,17 @@ static int do_emerge_log(
if (tstart < tbegin || tstart > tend)
continue;
+ if (flags->show_lastmerge) {
+ if (strncmp(p, " *** emerge ", 13) == 0) {
+ last_merge = tstart;
+ array_for_each(atoms, i, atomw)
+ atom_implode(atomw);
+ xarrayfree_int(atoms);
+ }
+ if (!all_atoms)
+ continue;
+ }
+
atom = NULL;
if (strncmp(p, " >>> emerge ", 13) == 0 &&
(p = strchr(p + 13, ')')) != NULL)
@@ -411,6 +428,10 @@ static int do_emerge_log(
rewind(fp);
}
+ if (flags->show_lastmerge) {
+ tbegin = last_merge;
+ tend = tstart;
+ }
/* loop over lines searching for atoms */
while (fgets(buf, sizeof(buf), fp) != NULL) {
if ((p = strchr(buf, ':')) == NULL)
@@ -876,22 +897,24 @@ int qlop_main(int argc, char **argv)
m.do_human = 0;
m.do_machine = 0;
m.do_endtime = 0;
+ m.show_lastmerge = 0;
while ((ret = GETOPT_LONG(QLOP, qlop, "")) != -1) {
switch (ret) {
COMMON_GETOPTS_CASES(qlop)
- case 't': m.do_time = 1; break;
- case 'm': m.do_merge = 1; break;
- case 'u': m.do_unmerge = 1; break;
- case 'U': m.do_autoclean = 1; break;
- case 's': m.do_sync = 1; break;
- case 'r': m.do_running = 1; break;
- case 'a': m.do_average = 1; break;
- case 'c': m.do_summary = 1; break;
- case 'H': m.do_human = 1; break;
- case 'M': m.do_machine = 1; break;
- case 'e': m.do_endtime = 1; break;
+ case 't': m.do_time = 1; break;
+ case 'm': m.do_merge = 1; break;
+ case 'u': m.do_unmerge = 1; break;
+ case 'U': m.do_autoclean = 1; break;
+ case 's': m.do_sync = 1; break;
+ case 'r': m.do_running = 1; break;
+ case 'a': m.do_average = 1; break;
+ case 'c': m.do_summary = 1; break;
+ case 'H': m.do_human = 1; break;
+ case 'M': m.do_machine = 1; break;
+ case 'e': m.do_endtime = 1; break;
+ case 'l': m.show_lastmerge = 1; break;
case 'd':
if (start_time == 0) {
if (!parse_date(optarg, &start_time))
@@ -945,7 +968,7 @@ int qlop_main(int argc, char **argv)
if (atomfile)
free(atomfile);
- /* default operation: -must */
+ /* default operation: -slumt */
if (
m.do_time == 0 &&
m.do_merge == 0 &&
@@ -962,6 +985,8 @@ int qlop_main(int argc, char **argv)
if (array_cnt(atoms) == 0)
m.do_sync = 1;
m.do_time = 1;
+ if (start_time == 0)
+ m.show_lastmerge = 1;
}
/* handle deps */
@@ -987,11 +1012,18 @@ int qlop_main(int argc, char **argv)
m.do_machine = 0;
}
+ /* handle -s + atoms */
if (m.do_sync && array_cnt(atoms) > 0) {
warn("-s cannot be used when specifying atoms, dropping -s");
m.do_sync = 0;
}
+ /* handle -l / -d conflict */
+ if (start_time != 0 && m.show_lastmerge) {
+ warn("-l and -d cannot be used together, dropping -l");
+ m.show_lastmerge = 0;
+ }
+
/* set default for -t, -a or -r */
if ((m.do_average || m.do_time || m.do_running) &&
!(m.do_merge || m.do_unmerge || m.do_sync))
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, /
@ 2019-07-14 13:31 Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2019-07-14 13:31 UTC (permalink / raw
To: gentoo-commits
commit: 26b9374ee23d16b3957b6ebc0cd80f53b22a4d16
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 13:30:06 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 13:30:06 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=26b9374e
quse: add -F argument, move some -v functionality to -D
-v now controls default atom formatting, as with other applets, the
ability to list USE-flags, their state and description per package now
is enabled by the -D (describe) flag, which incidentally also makes more
sense.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/include/quse.optdesc.yaml | 11 +++---
man/quse.1 | 14 ++++---
quse.c | 85 ++++++++++++++++++++++++-------------------
3 files changed, 62 insertions(+), 48 deletions(-)
diff --git a/man/include/quse.optdesc.yaml b/man/include/quse.optdesc.yaml
index 693aade..71fcd2d 100644
--- a/man/include/quse.optdesc.yaml
+++ b/man/include/quse.optdesc.yaml
@@ -1,10 +1,11 @@
exact: Search for exact string, e.g.\ do not use regular expression matching.
verbose: |
- Show descriptions for USE-flags for packages that match the search.
+ Show versions for packages that match the search.
Also shows problems encountered during parsing. These are mostly
diagnostic and indicate possible incorrectness in the results.
quiet: Ignored for compatibility with other qapplets.
-installed: |
- Only search installed packages. Together with \fB-v\fR this shows
- USE-flags and their descriptions, and currently enabled flags
- prefixed with an asterisk (\fI*\fR).
+describe: |
+ Describe the USE flag, when no USE-flag given and combined with
+ \fB-p\fR, lists all USE-flags with their descriptions (and enabled
+ state prefixed with an asterisk when used with \fB-I\fR) per
+ package.
diff --git a/man/quse.1 b/man/quse.1
index a30e189..8306ca5 100644
--- a/man/quse.1
+++ b/man/quse.1
@@ -20,12 +20,13 @@ List all ebuilds, don't match anything.
Use the LICENSE vs IUSE.
.TP
\fB\-D\fR, \fB\-\-describe\fR
-Describe the USE flag.
+Describe the USE flag, when no USE-flag given and combined with
+\fB-p\fR, lists all USE-flags with their descriptions (and enabled
+state prefixed with an asterisk when used with \fB-I\fR) per
+package.
.TP
\fB\-I\fR, \fB\-\-installed\fR
-Only search installed packages. Together with \fB-v\fR this shows
-USE-flags and their descriptions, and currently enabled flags
-prefixed with an asterisk (\fI*\fR).
+Only search installed packages.
.TP
\fB\-p\fR \fI<arg>\fR, \fB\-\-package\fR \fI<arg>\fR
Restrict matching to package or category.
@@ -33,11 +34,14 @@ Restrict matching to package or category.
\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
\fB\-v\fR, \fB\-\-verbose\fR
-Show descriptions for USE-flags for packages that match the search.
+Show versions for packages that match the search.
Also shows problems encountered during parsing. These are mostly
diagnostic and indicate possible incorrectness in the results.
.TP
diff --git a/quse.c b/quse.c
index bc99c3b..df8626e 100644
--- a/quse.c
+++ b/quse.c
@@ -27,7 +27,7 @@
#include "xarray.h"
#include "xregex.h"
-#define QUSE_FLAGS "eaLDIp:R" COMMON_FLAGS
+#define QUSE_FLAGS "eaLDIp:RF:" COMMON_FLAGS
static struct option const quse_long_opts[] = {
{"exact", no_argument, NULL, 'e'},
{"all", no_argument, NULL, 'a'},
@@ -36,6 +36,7 @@ static struct option const quse_long_opts[] = {
{"installed", no_argument, NULL, 'I'},
{"package", a_argument, NULL, 'p'},
{"repo", no_argument, NULL, 'R'},
+ {"format", a_argument, NULL, 'F'},
COMMON_LONG_OPTS
};
static const char * const quse_opts_help[] = {
@@ -46,6 +47,7 @@ static const char * const quse_opts_help[] = {
"Only search installed packages",
"Restrict matching to package or category",
"Show repository the ebuild originates from",
+ "Print matched atom using given format string",
COMMON_OPTS_HELP
};
#define quse_usage(ret) usage(ret, QUSE_FLAGS, quse_long_opts, quse_opts_help, NULL, lookup_applet_idx("quse"))
@@ -61,9 +63,10 @@ struct quse_state {
bool do_licence:1;
bool do_installed:1;
bool do_list:1;
- bool do_repo:1;
+ bool need_full_atom:1;
depend_atom *match;
regex_t *pregv;
+ const char *fmt;
};
static char *_quse_getline_buf = NULL;
@@ -142,9 +145,8 @@ quse_search_use_local_desc(int portdirfd, struct quse_state *state)
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,
+ printf("%s[%s%s%s] %s\n",
+ atom_format(state->fmt, atom),
MAGENTA, p, NORM, q);
}
}
@@ -424,7 +426,7 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
int cnt;
int portdirfd = -1; /* pacify compiler */
- if (state->match || verbose) {
+ if (state->match || state->do_describe) {
atom = tree_get_atom(pkg_ctx, 0);
if (atom == NULL)
return 0;
@@ -471,7 +473,7 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
free(s);
}
- if (verbose) {
+ if (state->do_describe) {
portdirfd = openat(pkg_ctx->cat_ctx->ctx->portroot_fd,
state->overlay == NULL ? main_overlay : state->overlay,
O_RDONLY | O_CLOEXEC | O_PATH);
@@ -487,7 +489,7 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
v = buf;
w = buf + sizeof(buf);
- if (state->do_all && !verbose) {
+ if (state->do_all && !state->do_describe) {
match = true;
v = q;
} else {
@@ -546,18 +548,10 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
}
if (match) {
- const char *qfmt;
-
- atom = tree_get_atom(pkg_ctx, state->do_repo);
- if (state->do_repo) {
- qfmt = "%[CATEGORY]%[PF]%[REPO]";
- } else {
- qfmt = "%[CATEGORY]%[PF]";
- }
-
+ atom = tree_get_atom(pkg_ctx, state->need_full_atom);
if (quiet) {
- printf("%s\n", atom_format(qfmt, atom));
- } else if (verbose && !state->do_licence) {
+ printf("%s\n", atom_format(state->fmt, atom));
+ } else if (state->do_describe && !state->do_licence) {
/* multi-line result, printing USE-flags with their descs */
size_t desclen;
struct quse_state us = {
@@ -571,7 +565,7 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
.overlay = NULL,
};
- printf("%s\n", atom_format(qfmt, atom));
+ printf("%s\n", atom_format(state->fmt, atom));
q = p = meta->IUSE;
buf[0] = '\0';
@@ -654,7 +648,7 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
free(us.retv);
free(us.argv);
} else {
- printf("%s: %s\n", atom_format(qfmt, atom), v);
+ printf("%s: %s\n", atom_format(state->fmt, atom), v);
}
}
@@ -668,7 +662,7 @@ quse_results_cb(tree_pkg_ctx *pkg_ctx, void *priv)
if (use != NULL)
free_set(use);
}
- if (verbose)
+ if (state->do_describe)
close(portdirfd);
return EXIT_SUCCESS;
@@ -681,25 +675,27 @@ int quse_main(int argc, char **argv)
const char *overlay;
char *match = NULL;
struct quse_state state = {
- .do_all = false,
- .do_regex = true,
- .do_describe = false,
- .do_licence = false,
- .do_installed = false,
- .do_repo = false,
- .match = NULL,
- .overlay = NULL,
+ .do_all = false,
+ .do_regex = true,
+ .do_describe = false,
+ .do_licence = false,
+ .do_installed = false,
+ .need_full_atom = false,
+ .match = NULL,
+ .overlay = NULL,
+ .fmt = NULL,
};
while ((i = GETOPT_LONG(QUSE, quse, "")) != -1) {
switch (i) {
- case 'e': state.do_regex = false; break;
- case 'a': state.do_all = true; break;
- case 'L': state.do_licence = true; break;
- case 'D': state.do_describe = true; break;
- case 'I': state.do_installed = true; break;
- case 'R': state.do_repo = true; break;
- case 'p': match = optarg; break;
+ case 'e': state.do_regex = false; break;
+ case 'a': state.do_all = true; break;
+ case 'L': state.do_licence = true; break;
+ case 'D': state.do_describe = true; break;
+ case 'I': state.do_installed = true; break;
+ case 'p': match = optarg; break;
+ case 'F': state.fmt = optarg; /* fall through */
+ case 'R': state.need_full_atom = true; break;
COMMON_GETOPTS_CASES(quse)
}
}
@@ -727,7 +723,20 @@ int quse_main(int argc, char **argv)
xregcomp(&state.pregv[i], state.argv[i], REG_EXTENDED | REG_NOSUB);
}
- if (state.do_describe) {
+ 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]";
+ }
+
+ if (state.do_describe && state.match == NULL) {
array_for_each(overlays, n, overlay)
quse_describe_flag(portroot, overlay, &state);
} else if (state.do_installed) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, /
@ 2020-05-16 14:30 Fabian Groffen
0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2020-05-16 14:30 UTC (permalink / raw
To: gentoo-commits
commit: a0780928edc76543e63709c915fb7d581bd13291
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 14:29:45 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 16 14:29:45 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a0780928
qfile: print symlink targets in verbose mode
e.g.:
% qfile -v /bin/csh
app-shells/tcsh-6.21.00-r1: /bin/csh -> tcsh
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/include/qfile.optdesc.yaml | 6 +++---
man/qfile.1 | 8 ++++----
qfile.c | 6 +++++-
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/man/include/qfile.optdesc.yaml b/man/include/qfile.optdesc.yaml
index 66ee885..9e1d24b 100644
--- a/man/include/qfile.optdesc.yaml
+++ b/man/include/qfile.optdesc.yaml
@@ -1,7 +1,7 @@
verbose: |
- Print package versions to matches, warn about problems with
- resolving symlinks or positioning packages under an alternative
- root.
+ Print package versions and symlink targets for matches, warn about
+ problems with resolving symlinks or positioning packages under an
+ alternative root.
quiet: |
Don't print matching file for matches, just the package. Don't
report about orphan files.
diff --git a/man/qfile.1 b/man/qfile.1
index 7501311..7caa459 100644
--- a/man/qfile.1
+++ b/man/qfile.1
@@ -1,5 +1,5 @@
.\" generated by mkman.py, please do NOT edit!
-.TH qfile "1" "Nov 2019" "Gentoo Foundation" "qfile"
+.TH qfile "1" "May 2020" "Gentoo Foundation" "qfile"
.SH NAME
qfile \- list all pkgs owning files
.SH SYNOPSIS
@@ -62,9 +62,9 @@ Don't look in the prunelib registry.
Set the ROOT env var.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
-Print package versions to matches, warn about problems with
-resolving symlinks or positioning packages under an alternative
-root.
+Print package versions and symlink targets for matches, warn about
+problems with resolving symlinks or positioning packages under an
+alternative root.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Don't print matching file for matches, just the package. Don't
diff --git a/qfile.c b/qfile.c
index d104848..efac60e 100644
--- a/qfile.c
+++ b/qfile.c
@@ -305,8 +305,12 @@ static int qfile_cb(tree_pkg_ctx *pkg_ctx, void *priv)
printf("%s", atom_format(state->format, atom));
if (quiet)
puts("");
+ else if (verbose && e->type == CONTENTS_SYM)
+ printf(": %s%s -> %s\n",
+ state->root ? state->root : "",
+ e->name, e->sym_target);
else
- printf(": %s%s\n", state->root ? : "", e->name);
+ printf(": %s%s\n", state->root ? state->root : "", e->name);
} else {
non_orphans[i] = 1;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-16 14:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 13:51 [gentoo-commits] proj/portage-utils:master commit in: man/, man/include/, / Fabian Groffen
-- strict thread matches above, loose matches on Subject: below --
2020-05-16 14:30 Fabian Groffen
2019-07-14 13:31 Fabian Groffen
2019-05-13 12:57 Fabian Groffen
2018-04-12 19:33 Fabian Groffen
2018-04-03 11:50 Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox