From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1591061-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 363BE15838C
	for <garchives@archives.gentoo.org>; Tue, 16 Jan 2024 05:16:16 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 74205E2B8C;
	Tue, 16 Jan 2024 05:16:15 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.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 278EBE2B8C
	for <gentoo-commits@lists.gentoo.org>; Tue, 16 Jan 2024 05:16:15 +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 6175C343270
	for <gentoo-commits@lists.gentoo.org>; Tue, 16 Jan 2024 05:16:14 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id F3C5B13E9
	for <gentoo-commits@lists.gentoo.org>; Tue, 16 Jan 2024 05:16:12 +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: <1705382169.58b094bc79e999e44a5b108e2b7273c164aa906e.sam@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/portage/dbapi/bintree.py
X-VCS-Directories: lib/portage/dbapi/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 58b094bc79e999e44a5b108e2b7273c164aa906e
X-VCS-Branch: master
Date: Tue, 16 Jan 2024 05:16:12 +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: d0756d62-c8b2-4442-b82b-60037c696dbc
X-Archives-Hash: fa543919472bc296f7e1c5eaa2f3cae5

commit:     58b094bc79e999e44a5b108e2b7273c164aa906e
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Fri Jan  5 19:30:38 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 16 05:16:09 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=58b094bc

bintree: use urllib provided attributes for hostname, user and password

In addition to simplifying it also solves an issue with parsing raw
ipv6 addresses.

Bug: https://bugs.gentoo.org/921400
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/1230
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 5fc4716980..2342d571b9 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1344,23 +1344,13 @@ class binarytree:
         for repo in reversed(list(self._binrepos_conf.values())):
             base_url = repo.sync_uri
             parsed_url = urlparse(base_url)
-            host = parsed_url.netloc
+            host = parsed_url.hostname or ""
             port = parsed_url.port
-            user = None
-            passwd = None
-            user_passwd = ""
+            user = parsed_url.username
+            passwd = parsed_url.password
+            user_passwd = user + "@" if user else ""
             gpkg_only_warned = False
 
-            if "@" in host:
-                user, host = host.split("@", 1)
-                user_passwd = user + "@"
-                if ":" in user:
-                    user, passwd = user.split(":", 1)
-
-            if port is not None:
-                port_str = f":{port}"
-                if host.endswith(port_str):
-                    host = host[: -len(port_str)]
             pkgindex_file = os.path.join(
                 self.settings["EROOT"],
                 CACHE_PATH,