1 |
commit: 566c8b8db5bc0f7ae4636a1d3387ddb6de41692f |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 19 08:31:40 2022 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 19 08:31:40 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=566c8b8d |
7 |
|
8 |
libq/atom: allow including BUILDID in atom_format |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
libq/atom.c | 15 +++++++++++++++ |
13 |
1 file changed, 15 insertions(+) |
14 |
|
15 |
diff --git a/libq/atom.c b/libq/atom.c |
16 |
index 6f88698..3d9d31f 100644 |
17 |
--- a/libq/atom.c |
18 |
+++ b/libq/atom.c |
19 |
@@ -1045,6 +1045,7 @@ atom_to_string_r(char *buf, size_t buflen, depend_atom *a) |
20 |
* - any prefix of these (e.g. CAT, CA, C) will match as well |
21 |
* pfx - the version qualifier if set (e.g. > < = !) |
22 |
* sfx - the version qualifier if set (e.g. *) |
23 |
+ * BUILDID - the binpkg-multi-instance id |
24 |
*/ |
25 |
char * |
26 |
atom_format_r( |
27 |
@@ -1174,6 +1175,20 @@ atom_format_r( |
28 |
append_buf(buf, buflen, "%s", "]"); |
29 |
} |
30 |
} |
31 |
+ } else if (strncmp("BUILDID", fmt, len) == 0) { |
32 |
+ if (showit || atom->BUILDID > 0) { |
33 |
+ /* this is really shitty, '-' is not feasible, |
34 |
+ * but used by Portage |
35 |
+ * https://archives.gentoo.org/gentoo-portage-dev/message/054f5f1f334b60bdb1b7f80ff4755bd4 |
36 |
+ * using this we cannot parse what we would |
37 |
+ * produce, but look more like the original |
38 |
+ * since it's not clear this is necessary at |
39 |
+ * all, I decided to avoid any confusion and use |
40 |
+ * '~' so we can see this is not a version bit */ |
41 |
+ append_buf(buf, buflen, "%s%s%u%s", |
42 |
+ RED, connected ? "~" : "", |
43 |
+ atom->BUILDID, NORM); |
44 |
+ } |
45 |
} else |
46 |
append_buf(buf, buflen, "<BAD:%.*s>", (int)len, fmt); |
47 |
p++; |