From 62403a40c40cba564caa3f58424972a8e87fcac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Sun, 30 May 2010 19:41:24 +0000 Subject: [PATCH] repodb: Fix use of compressed local repositories This fixes a serious regression in 2.3. Repo index files are also cached when it is compressed. Parse the cached xml file if the uri of compressed index file is given as the repo address. --- pisi/db/repodb.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pisi/db/repodb.py b/pisi/db/repodb.py index 0056032d..d707c677 100644 --- a/pisi/db/repodb.py +++ b/pisi/db/repodb.py @@ -151,14 +151,17 @@ class RepoDB(lazydb.LazyDB): def get_repo_doc(self, repo_name): repo = self.get_repo(repo_name) - if repo.indexuri.is_remote_file(): - index = os.path.basename(repo.indexuri.get_uri()) - index_path = pisi.util.join_path(ctx.config.index_dir(), repo_name, index) - else: - index_path = repo.indexuri.get_uri() - if index_path.endswith("bz2"): - index_path = pisi.util.remove_suffix(".bz2", index_path) + index_path = repo.indexuri.get_uri() + + #FIXME Local index files should also be cached. + if index_path.endswith("bz2") or repo.indexuri.is_remote_file(): + index = os.path.basename(index_path) + index_path = pisi.util.join_path(ctx.config.index_dir(), + repo_name, index) + + if index_path.endswith("bz2"): + index_path = pisi.util.remove_suffix(".bz2", index_path) if not os.path.exists(index_path): ctx.ui.warning(_("%s repository needs to be updated") % repo_name)