diff --git a/pisi/db/repodb.py b/pisi/db/repodb.py index 4d2f8780..db061db3 100644 --- a/pisi/db/repodb.py +++ b/pisi/db/repodb.py @@ -23,6 +23,7 @@ import pisi.uri import pisi.util import pisi.context as ctx import pisi.db.lazydb as lazydb +from pisi.file import File class RepoError(pisi.Error): pass @@ -155,13 +156,13 @@ class RepoDB(lazydb.LazyDB): 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(): + if File.is_compressed(index_path) 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) + repo_name, index) - if index_path.endswith("bz2"): - index_path = pisi.util.remove_suffix(".bz2", index_path) + if File.is_compressed(index_path): + index_path = os.path.splitext(index_path)[0] if not os.path.exists(index_path): ctx.ui.warning(_("%s repository needs to be updated") % repo_name) diff --git a/pisi/pxml/xmlfile.py b/pisi/pxml/xmlfile.py index 8cc25c66..3331a795 100644 --- a/pisi/pxml/xmlfile.py +++ b/pisi/pxml/xmlfile.py @@ -66,7 +66,7 @@ class XmlFile(object): # workaround for repo index files to fix # rev. 17027 regression (http://liste.pardus.org.tr/gelistirici/2008-February/011133.html) - compressed = str(uri).endswith(".bz2") or str(uri).endswith(".gz") + compressed = pisi.file.File.is_compressed(str(uri)) if uri.is_local_file() and not compressed: # this is a local file