Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Mon, 17 Aug 2020 13:09:00
Message-Id: 1597668652.345bb718f59c65823722e8ae94ac7ae9f9060dd1.grobian@gentoo
1 commit: 345bb718f59c65823722e8ae94ac7ae9f9060dd1
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 17 12:50:52 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 17 12:50:52 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=345bb718
7
8 qlop: recognise logfile naming when PORTAGE_LOGDIR is set, bug #711896
9
10 Bug: https://bugs.gentoo.org/711896
11 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
12
13 qlop.c | 40 ++++++++++++++++++++++++++++++----------
14 1 file changed, 30 insertions(+), 10 deletions(-)
15
16 diff --git a/qlop.c b/qlop.c
17 index a5761d7..47ef83d 100644
18 --- a/qlop.c
19 +++ b/qlop.c
20 @@ -1231,10 +1231,13 @@ static array_t *probe_proc(array_t *atoms)
21 if (rpathlen <= 0)
22 continue;
23 rpath[rpathlen] = '\0';
24 +
25 /* check if this points to a portage build:
26 - * <somepath>/portage/<cat>/<pf>/temp/build.log */
27 + * <somepath>/portage/<cat>/<pf>/temp/build.log
28 + * <somepath>/<cat>:<pf>:YYYYMMDD-HHMMSS.log */
29 + atom = NULL;
30 if ((size_t)rpathlen > sizeof("/temp/build.log") &&
31 - strcmp(rpath + rpathlen -
32 + strcmp(rpath + rpathlen -
33 (sizeof("/temp/build.log") - 1),
34 "/temp/build.log") == 0 &&
35 (p = strstr(rpath, "/portage/")) != NULL)
36 @@ -1243,15 +1246,32 @@ static array_t *probe_proc(array_t *atoms)
37 rpath[rpathlen - (sizeof("/temp/build.log") - 1)] =
38 '\0';
39 atom = atom_explode(p);
40 - if (atom == NULL ||
41 - atom->CATEGORY == NULL || atom->P == NULL)
42 - {
43 - if (atom != NULL)
44 - atom_implode(atom);
45 - continue;
46 - }
47 - xarraypush_ptr(ret_atoms, atom);
48 + } else if ((size_t)rpathlen > sizeof(".log") &&
49 + strcmp(rpath + rpathlen -
50 + (sizeof(".log") - 1), ".log") == 0 &&
51 + (p = strchr(rpath, ':')) != NULL &&
52 + (p = strchr(p + 1, ':')) != NULL &&
53 + (p = strrchr(rpath, '/')) != NULL)
54 + {
55 + char *q;
56 +
57 + p++; /* skip / */
58 + q = strchr(p, ':'); /* checked above to exist */
59 + *q++ = '/';
60 + q = strchr(q, ':'); /* checked above to exist */
61 + *q = '\0';
62 +
63 + atom = atom_explode(p);
64 }
65 +
66 + if (atom->CATEGORY == NULL || atom->P == NULL) {
67 + atom_implode(atom);
68 + continue;
69 + }
70 + if (atom == NULL)
71 + continue;
72 +
73 + xarraypush_ptr(ret_atoms, atom);
74 }
75 scandir_free(links, linkslen);
76 }