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: libq/
Date: Mon, 04 Oct 2021 06:28:47
Message-Id: 1633328882.ef14d5f7bb09b8a90e827262798ebd1fde58913a.grobian@gentoo
1 commit: ef14d5f7bb09b8a90e827262798ebd1fde58913a
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 4 06:28:02 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 4 06:28:02 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ef14d5f7
7
8 libq/atom: parse/set SUBSLOT when absent to SLOT (PMS 7.2)
9
10 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
11
12 libq/atom.c | 22 ++++++++++++++++------
13 1 file changed, 16 insertions(+), 6 deletions(-)
14
15 diff --git a/libq/atom.c b/libq/atom.c
16 index d210ed6..9a51e22 100644
17 --- a/libq/atom.c
18 +++ b/libq/atom.c
19 @@ -218,6 +218,10 @@ atom_explode_cat(const char *atom, const char *cat)
20 /* set to NULL if there's nothing */
21 if (ret->SLOT[0] == '\0')
22 ret->SLOT = NULL;
23 +
24 + /* PMS 7.2: SUBSLOT defaults to SLOT when unset */
25 + if (ret->SUBSLOT == NULL)
26 + ret->SUBSLOT = ret->SLOT;
27 }
28
29 /* see if we have any suffix operators */
30 @@ -380,7 +384,7 @@ atom_clone(depend_atom *atom)
31 rlen = strlen(atom->REPO) + 1;
32 if (atom->SLOT != NULL)
33 slen = strlen(atom->SLOT) + 1;
34 - if (atom->SUBSLOT != NULL)
35 + if (atom->SUBSLOT != NULL && atom->SUBSLOT != atom->SLOT)
36 sslen = strlen(atom->SUBSLOT) + 1;
37 if (atom->CATEGORY != NULL)
38 clen = strlen(atom->CATEGORY) + 1;
39 @@ -427,9 +431,13 @@ atom_clone(depend_atom *atom)
40 p += slen;
41 }
42 if (atom->SUBSLOT != NULL) {
43 - ret->SUBSLOT = p;
44 - memcpy(ret->SUBSLOT, atom->SUBSLOT, sslen);
45 - p += sslen;
46 + if (atom->SUBSLOT == atom->SLOT) { /* PMS 7.2 */
47 + ret->SUBSLOT = ret->SLOT;
48 + } else {
49 + ret->SUBSLOT = p;
50 + memcpy(ret->SUBSLOT, atom->SUBSLOT, sslen);
51 + p += sslen;
52 + }
53 }
54 if (atom->REPO != NULL) {
55 ret->REPO = p;
56 @@ -820,7 +828,8 @@ atom_to_string_r(char *buf, size_t buflen, depend_atom *a)
57 if (a->SLOT != NULL || a->slotdep != ATOM_SD_NONE)
58 off += snprintf(buf + off, buflen - off, ":%s%s%s%s",
59 a->SLOT ? a->SLOT : "",
60 - a->SUBSLOT ? "/" : "", a->SUBSLOT ? a->SUBSLOT : "",
61 + a->SUBSLOT && a->SUBSLOT != a->SLOT ? "/" : "",
62 + a->SUBSLOT && a->SUBSLOT != a->SLOT ? a->SUBSLOT : "",
63 atom_slotdep_str[a->slotdep]);
64 for (ud = a->usedeps; ud != NULL; ud = ud->next)
65 off += snprintf(buf + off, buflen - off, "%s%s%s%s%s",
66 @@ -933,7 +942,8 @@ atom_format_r(
67 HN(atom->SLOT),
68 NORM);
69 } else if (!strncmp("SUBSLOT", fmt, len)) {
70 - if (showit || atom->SUBSLOT)
71 + if (showit ||
72 + (atom->SUBSLOT && atom->SUBSLOT != atom->SLOT))
73 append_buf(buf, buflen, "%s%s%s%s%s",
74 YELLOW,
75 connected ? "/" : "",