aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2022-05-19 10:31:40 +0200
committerFabian Groffen <grobian@gentoo.org>2022-05-19 10:31:40 +0200
commit566c8b8db5bc0f7ae4636a1d3387ddb6de41692f (patch)
treee3bea8224711bfc0b20463e5b104d6e711bcb475
parentlibq/atom: make atom_compare consider BUILDID (diff)
downloadportage-utils-566c8b8db5bc0f7ae4636a1d3387ddb6de41692f.tar.gz
portage-utils-566c8b8db5bc0f7ae4636a1d3387ddb6de41692f.tar.bz2
portage-utils-566c8b8db5bc0f7ae4636a1d3387ddb6de41692f.zip
libq/atom: allow including BUILDID in atom_format
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--libq/atom.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libq/atom.c b/libq/atom.c
index 6f88698a..3d9d31f3 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++;