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,
