From 09d74cf827434091b22b43230bb966b116c6845f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Tue, 16 Mar 2021 18:28:53 +0000 Subject: [PATCH] Use apt_pkg function. --- ognibuild/debian/file_search.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ognibuild/debian/file_search.py b/ognibuild/debian/file_search.py index 5a0b105..ecab66a 100644 --- a/ognibuild/debian/file_search.py +++ b/ognibuild/debian/file_search.py @@ -16,6 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +import apt_pkg from datetime import datetime import os import re @@ -41,12 +42,6 @@ def read_contents_file(f): yield path, rest -def url_to_cache_filename(url): - from urllib.parse import urlparse - parsed = urlparse(url) - return parsed.hostname + parsed.path.replace("/", "_") - - def contents_urls_from_sourceslist(sl, arch): # TODO(jelmer): Verify signatures, etc. arches = [(arch, True), ("all", False)] @@ -116,7 +111,7 @@ def load_contents_url(url): def load_apt_cache_file(cache_dir, url): - fn = url_to_cache_filename(url) + fn = apt_pkg.uri_to_filename(url) p = os.path.join(cache_dir, fn + ".lz4") if not os.path.exists(p): return None