Skip to content

Commit

Permalink
bintree: use urllib provided attributes for hostname, user and password
Browse files Browse the repository at this point in the history
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@protonmail.com>
Closes: gentoo#1230
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
parona-source authored and thesamesam committed Jan 16, 2024
1 parent c9ed813 commit 58b094b
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions lib/portage/dbapi/bintree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,23 +1344,13 @@ def _populate_remote(self, getbinpkg_refresh=True, pretend=False):
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,
Expand Down

0 comments on commit 58b094b

Please sign in to comment.