* [gentoo-commits] proj/portage-utils:master commit in: man/include/, /
@ 2019-11-17 15:12 Fabian Groffen
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Groffen @ 2019-11-17 15:12 UTC (permalink / raw
To: gentoo-commits
commit: f9eef8946dee223de1115e572633a7ddefa3197c
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 15:02:30 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 15:02:30 2019 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f9eef894
qlist: add -k option to operate on binpkgs
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/include/qlist.desc | 3 ++-
man/include/qlist.optdesc.yaml | 2 ++
qlist.c | 22 +++++++++++++++-------
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/man/include/qlist.desc b/man/include/qlist.desc
index e02d971..e26d63d 100644
--- a/man/include/qlist.desc
+++ b/man/include/qlist.desc
@@ -3,4 +3,5 @@ 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.
+its name. When no packages are given to match, \fIqlist\fR lists all
+installed packages.
diff --git a/man/include/qlist.optdesc.yaml b/man/include/qlist.optdesc.yaml
index 5fff904..30d8446 100644
--- a/man/include/qlist.optdesc.yaml
+++ b/man/include/qlist.optdesc.yaml
@@ -1,6 +1,8 @@
installed: |
Instead of listing the contents of a package, just print the package
name if the package is currently installed.
+binpkgs: |
+ Operate on binary packages instead of installed packges.
umap: |
List USE-flags enabled when the package was installed. This flag
implies \fB\-I\fR.
diff --git a/qlist.c b/qlist.c
index a97111d..30c0c6f 100644
--- a/qlist.c
+++ b/qlist.c
@@ -21,16 +21,16 @@
#include "tree.h"
#include "xregex.h"
-#define QLIST_FLAGS "ISRUcDeadosF:" COMMON_FLAGS
+#define QLIST_FLAGS "IkSRUcDedosF:" COMMON_FLAGS
static struct option const qlist_long_opts[] = {
{"installed", no_argument, NULL, 'I'},
+ {"binpkgs", no_argument, NULL, 'k'},
{"slots", no_argument, NULL, 'S'},
{"repo", no_argument, NULL, 'R'},
{"umap", no_argument, NULL, 'U'},
{"columns", no_argument, NULL, 'c'},
{"showdebug", no_argument, NULL, 128},
{"exact", no_argument, NULL, 'e'},
- {"all", no_argument, NULL, 'a'},
{"dir", no_argument, NULL, 'd'},
{"obj", no_argument, NULL, 'o'},
{"sym", no_argument, NULL, 's'},
@@ -40,13 +40,13 @@ static struct option const qlist_long_opts[] = {
};
static const char * const qlist_opts_help[] = {
"Just show installed package names",
+ "Use binpkgs instead of installed packages",
"Display installed packages with slots (use twice for subslots)",
"Display installed packages with repository",
"Display installed packages with flags used",
"Display column view",
"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",
"Only show objects",
"Only show symlinks",
@@ -410,6 +410,7 @@ int qlist_main(int argc, char **argv)
int show_slots = 0;
bool show_repo = false;
bool do_columns = false;
+ bool do_binpkgs = false;
char qfmt[128];
struct qlist_opt_state state = {
.argc = argc,
@@ -430,8 +431,8 @@ int qlist_main(int argc, char **argv)
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 'k': do_binpkgs = 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;
@@ -448,8 +449,12 @@ int qlist_main(int argc, char **argv)
/* 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.all)
- qlist_usage(EXIT_FAILURE);
+ if (argc == optind) {
+ if (state.just_pkgname)
+ state.all = true;
+ else
+ qlist_usage(EXIT_FAILURE);
+ }
if (state.fmt == NULL) {
const char *l = "%[";
@@ -483,7 +488,10 @@ int qlist_main(int argc, char **argv)
state.buf = xmalloc(state.buflen);
state.atoms = xcalloc(argc - optind, sizeof(*state.atoms));
ret = 1;
- vdb = tree_open_vdb(portroot, portvdb);
+ if (do_binpkgs)
+ vdb = tree_open_binpkg(portroot, pkgdir);
+ else
+ vdb = tree_open_vdb(portroot, portvdb);
if (vdb != NULL) {
ret = tree_foreach_pkg_sorted(vdb, qlist_cb, &state);
tree_close(vdb);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage-utils:master commit in: man/include/, /
@ 2020-05-02 9:58 Fabian Groffen
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Groffen @ 2020-05-02 9:58 UTC (permalink / raw
To: gentoo-commits
commit: f926e13ef6202ec76ba057141933e835ee571787
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 2 09:46:57 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 2 09:58:33 2020 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f926e13e
qlop: add -v mode to -E that displays emerge invocation
Really complete the --emerge option with --verbose to get:
% qlop -Ev
emerge -uaD @world
U sys-kernel/linux-firmware-20200421 [20200316]
N www-servers/nginx-1.18.0
D www-servers/nginx-1.17.10
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
man/include/qlop.optdesc.yaml | 13 +++++++
qlop.c | 84 ++++++++++++++++++++++++++++++++++++++++---
2 files changed, 92 insertions(+), 5 deletions(-)
diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml
index 463a19d..c6e0833 100644
--- a/man/include/qlop.optdesc.yaml
+++ b/man/include/qlop.optdesc.yaml
@@ -55,3 +55,16 @@ running: |
observed, or no previous occurrences for the operation exist,
\fIunknown\fR is printed. When combined with \fB-t\fR the
elapsed time is also displayed.
+emerge: |
+ Immitate \fBemerge\fR(1) output, as if \fBemerge -pv\fR had been
+ run. This produces a list of packages that were installed (N),
+ upgraded (U), downgraded (UD), re-installed (R) or unmerged (D).
+ The list always includes the version numbers, and for up/downgrades
+ the previous version is listed between square brackets after the
+ package. When \fB-v\fR is used, the \fBemerge\fR invocations are
+ printed as well, to really show what happened. When concurrent
+ merges are present in the displayed timeframe, the output will be
+ hard to read. This is a limitation of the \fIemerge.log\fR format.
+ It is possible to combine this flag with the \fB-d\fR flag, in which
+ case the default behaviour of displaying the last merge (\fB-l\fR)
+ is disabled.
diff --git a/qlop.c b/qlop.c
index 69133bb..d5ace83 100644
--- a/qlop.c
+++ b/qlop.c
@@ -539,7 +539,82 @@ static int do_emerge_log(
continue;
/* are we interested in this line? */
- if (flags->do_sync && (
+ if (flags->show_emerge && verbose && (
+ strncmp(p, " *** emerge ", 13) == 0))
+ {
+ char shortopts[8]; /* must hold as many opts converted below */
+ int numopts = 0;
+
+ printf("emerge");
+ for (p += 13; (q = strtok(p, " \n")) != NULL; p = NULL) {
+ if (strncmp(q, "--", 2) == 0) {
+ /* portage seems to normalise options given into
+ * their long forms always; I don't want to keep a
+ * mapping table to short forms here, but it's
+ * tempting, so I just do a few of the often used
+ * ones */
+ q += 2;
+ if (strcmp(q, "ask") == 0) {
+ shortopts[numopts++] = 'a';
+ } else if (strcmp(q, "verbose") == 0) {
+ shortopts[numopts++] = 'v';
+ } else if (strcmp(q, "oneshot") == 0) {
+ shortopts[numopts++] = '1';
+ } else if (strcmp(q, "deep") == 0) {
+ shortopts[numopts++] = 'D';
+ } else if (strcmp(q, "update") == 0) {
+ shortopts[numopts++] = 'u';
+ } else if (strcmp(q, "depclean") == 0) {
+ shortopts[numopts++] = 'c';
+ } else if (strcmp(q, "unmerge") == 0) {
+ shortopts[numopts++] = 'C';
+ } else {
+ q = NULL;
+ }
+
+ /* process next token */
+ if (q != NULL)
+ continue;
+ }
+
+ /* if we're here, we've assembled opts whatever we could */
+ if (numopts > 0) {
+ printf(" %s-%.*s%s",
+ GREEN, numopts, shortopts, NORM);
+ numopts = 0;
+ }
+
+ if (*q == '\0') {
+ /* skip empty token, likely the trailing \n */
+ continue;
+ }
+
+ if (strncmp(q, "--", 2) == 0) {
+ printf(" %s--%s%s", GREEN, q, NORM);
+ } else if (strcmp(q, "@world") == 0 ||
+ strcmp(q, "@system") == 0)
+ {
+ printf(" %s%s%s", YELLOW, q, NORM);
+ } else if (strcmp(q, "world") == 0 ||
+ strcmp(q, "system") == 0)
+ {
+ printf(" %s@%s%s", YELLOW, q, NORM);
+ } else {
+ /* this should be an atom */
+ atom = atom_explode(q);
+ if (atom == NULL) {
+ /* or not ... just print it */
+ printf(" %s", q);
+ } else {
+ printf(" %s", atom_format(
+ "%[pfx]%[CAT]%[PF]%[sfx]"
+ "%[SLOT]%[SUBSLOT]%[REPO]", atom));
+ atom_implode(atom);
+ }
+ }
+ }
+ printf("\n");
+ } else if (flags->do_sync && (
strncmp(p, " === Sync completed ", 20) == 0 ||
strcmp(p, " === sync\n") == 0))
{
@@ -702,7 +777,7 @@ static int do_emerge_log(
printf(" %sU%sD%s ", BLUE, DKBLUE, NORM);
break;
}
- printf("%s", atom_format(flags->fmt, pkgw->atom));
+ printf("%s", atom_format("%[CAT]%[PF]", pkgw->atom));
if (state == NEWER || state == OLDER)
printf(" %s[%s%s%s]%s", DKBLUE, NORM,
atom_format("%[PVR]", upgrade_atom),
@@ -836,7 +911,7 @@ static int do_emerge_log(
* is the only distinquishable choice, appearing
* in the place of N(ew). */
printf("%sD%s %s", RED, NORM,
- atom_format(flags->fmt, pkgw->atom));
+ atom_format("%[CAT]%[PF]", pkgw->atom));
if (flags->do_time)
printf(": %s\n", fmt_elapsedtime(flags, elapsed));
else
@@ -1266,8 +1341,7 @@ int qlop_main(int argc, char **argv)
m.do_unmerge = 1;
m.do_autoclean = 1;
m.show_lastmerge = 1;
- m.show_emerge = 1;
- verbose = 1; break;
+ m.show_emerge = 1; break;
case 'r': m.do_running = 1;
runningmode++; break;
case 'a': m.do_average = 1; break;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-02 9:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-17 15:12 [gentoo-commits] proj/portage-utils:master commit in: man/include/, / Fabian Groffen
-- strict thread matches above, loose matches on Subject: below --
2020-05-02 9:58 Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox