From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1398574-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 407CD158090
	for <garchives@archives.gentoo.org>; Thu, 19 May 2022 08:32:25 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 836C7E082B;
	Thu, 19 May 2022 08:32:24 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5B6D6E082B
	for <gentoo-commits@lists.gentoo.org>; Thu, 19 May 2022 08:32:24 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 4814034123C
	for <gentoo-commits@lists.gentoo.org>; Thu, 19 May 2022 08:32:22 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D617B430
	for <gentoo-commits@lists.gentoo.org>; Thu, 19 May 2022 08:32:20 +0000 (UTC)
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org>
Message-ID: <1652949100.566c8b8db5bc0f7ae4636a1d3387ddb6de41692f.grobian@gentoo>
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/
X-VCS-Repository: proj/portage-utils
X-VCS-Files: libq/atom.c
X-VCS-Directories: libq/
X-VCS-Committer: grobian
X-VCS-Committer-Name: Fabian Groffen
X-VCS-Revision: 566c8b8db5bc0f7ae4636a1d3387ddb6de41692f
X-VCS-Branch: master
Date: Thu, 19 May 2022 08:32:20 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: dbf5aefe-f314-4808-b70b-caa6a40dc4ad
X-Archives-Hash: c43dc5da2d5ddcf19b0af482182b4a25

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++;