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