From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1555976-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 0C53E158089
	for <garchives@archives.gentoo.org>; Tue, 19 Sep 2023 19:13:15 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 3D5972BC021;
	Tue, 19 Sep 2023 19:13:14 +0000 (UTC)
Received: from smtp.gentoo.org (mail.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))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 26A572BC021
	for <gentoo-commits@lists.gentoo.org>; Tue, 19 Sep 2023 19:13:14 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6854A335CCD
	for <gentoo-commits@lists.gentoo.org>; Tue, 19 Sep 2023 19:13:13 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id E7D9A11AA
	for <gentoo-commits@lists.gentoo.org>; Tue, 19 Sep 2023 19:13:11 +0000 (UTC)
From: "Sam James" <sam@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, "Sam James" <sam@gentoo.org>
Message-ID: <1695150782.5146d35eb97e2c1a8f7691e59c755ed14e858dd4.sam@gentoo>
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
X-VCS-Repository: proj/gentoolkit
X-VCS-Files: pym/gentoolkit/equery/meta.py
X-VCS-Directories: pym/gentoolkit/equery/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 5146d35eb97e2c1a8f7691e59c755ed14e858dd4
X-VCS-Branch: master
Date: Tue, 19 Sep 2023 19:13:11 +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: fe07e68f-57f3-4b45-bc83-a459c79d2b0d
X-Archives-Hash: ad62a0491ded70ee215d9f10ab7cd9f7

commit:     5146d35eb97e2c1a8f7691e59c755ed14e858dd4
Author:     Siddhanth Rathod <xsiddhanthrathod <AT> gmail <DOT> com>
AuthorDate: Tue Sep 19 18:31:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 19:13:02 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5146d35e

equery meta: map the remote-id to the respective url

Bug: https://bugs.gentoo.org/877519
Signed-off-by: Siddhanth Rathod <xsiddhanthrathod <AT> gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/32
Signed-off-by: Sam James <sam <AT> gentoo.org>

 pym/gentoolkit/equery/meta.py | 51 ++++++++++++++++++++++++++++++++++---------
 1 file changed, 41 insertions(+), 10 deletions(-)

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 02b6f67..de5631b 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -10,19 +10,19 @@ __docformat__ = "epytext"
 # Imports
 # =======
 
-import re
 import os
+import re
 import sys
 import warnings
-from getopt import gnu_getopt, GetoptError
+from getopt import GetoptError, gnu_getopt
 
 import gentoolkit.pprinter as pp
 from gentoolkit import errors
+from gentoolkit.equery import CONFIG, format_options, mod_usage
+from gentoolkit.helpers import print_file, print_sequence
 from gentoolkit.keyword import Keyword
-from gentoolkit.equery import format_options, mod_usage, CONFIG
-from gentoolkit.helpers import print_sequence, print_file
-from gentoolkit.textwrap_ import TextWrapper
 from gentoolkit.query import Query
+from gentoolkit.textwrap_ import TextWrapper
 
 # =======
 # Globals
@@ -189,11 +189,42 @@ def format_upstream(upstream):
 
     def _format_upstream_ids(ids):
         result = []
-        for id_ in ids:
-            site = id_[0]
-            proj_id = id_[1]
-            idstr = f"{site} ID: {proj_id}"
-            result.append(idstr)
+        remote_ids = {
+            "github": "https://github.com/remote-id",
+            "gentoo": "https://gitweb.gentoo.org/remote-id.git/",
+            "bitbucket": "https://bitbucket.org/remote-id",
+            "codeberg": "https://codeberg.org/remote-id",
+            "cpan": "https://metacpan.org/dist/remote-id",
+            "cpan-module": "https://metacpan.org/pod/remote-id",
+            "cpe": "remote-id",
+            "cran": "https://cran.r-project.org/web/packages/remote-id/",
+            "ctan": "https://ctan.org/pkg/remote-id",
+            "freedesktop-gitlab": "https://gitlab.freedesktop.org/remote-id.git/",
+            "gitlab": "https://gitlab.com/remote-id",
+            "gnome-gitlab": "https://gitlab.gnome.org/remote-id.git/",
+            "google-code": "https://code.google.com/archive/p/remote-id/",
+            "hackage": "https://hackage.haskell.org/package/remote-id",
+            "heptapod": "https://foss.heptapod.net/remote-id",
+            "kde-invent": "https://invent.kde.org/remote-id",
+            "launchpad": "https://launchpad.net/remote-id",
+            "osdn": "https://osdn.net/projects/remote-id/",
+            "pear": "https://pear.php.net/package/remote-id",
+            "pecl": "https://pecl.php.net/package/remote-id",
+            "pypi": "https://pypi.org/project/remote-id/",
+            "rubygems": "https://rubygems.org/gems/remote-id/",
+            "savannah": "https://savannah.gnu.org/projects/remote-id",
+            "savannah-nongnu": "https://savannah.nongnu.org/projects/remote-id",
+            "sourceforge": "https://sourceforge.net/projects/remote-id/",
+            "sourcehut": "https://sr.ht/remote-id/",
+            "vim": "https://www.vim.org/scripts/script.php?script_id=remote-id",
+        }
+        for id in ids:
+            proj_id = id[1]
+            try:
+                site = remote_ids[proj_id].replace("remote-id", id[0])
+            except KeyError:
+                site = id[0]
+            result.append(f"{site} ({proj_id})")
         return result
 
     result = []