From a7d55ef8d5c6c9847ed0b851b746487166d83560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Wed, 23 Feb 2011 13:14:05 +0000 Subject: [PATCH] installdb: Parse directory names correctly parse_package_name cannot parse directory names like "zlib-32bit". Implement a function to split names. Bumped cache version to force update. --- pisi/db/installdb.py | 8 ++++++-- pisi/db/lazydb.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pisi/db/installdb.py b/pisi/db/installdb.py index 24fa8b38..7f4cc3f5 100644 --- a/pisi/db/installdb.py +++ b/pisi/db/installdb.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2005-2010, TUBITAK/UEKAE +# Copyright (C) 2005-2011, TUBITAK/UEKAE # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free @@ -69,7 +69,11 @@ class InstallDB(lazydb.LazyDB): self.rev_deps_db = self.__generate_revdeps() def __generate_installed_pkgs(self): - return dict(map(lambda x:pisi.util.parse_package_name(x), os.listdir(ctx.config.packages_dir()))) + def split_name(dirname): + name, version, release = dirname.rsplit("-", 2) + return name, version + "-" + release + + return dict(map(split_name, os.listdir(ctx.config.packages_dir()))) def __get_marked_packages(self, _type): info_path = os.path.join(ctx.config.info_dir(), _type) diff --git a/pisi/db/lazydb.py b/pisi/db/lazydb.py index 1d99dc1c..99c1e7a8 100644 --- a/pisi/db/lazydb.py +++ b/pisi/db/lazydb.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2007-2010, TUBITAK/UEKAE +# Copyright (C) 2007-2011, TUBITAK/UEKAE # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free @@ -36,7 +36,7 @@ class Singleton(object): class LazyDB(Singleton): - cache_version = "2.3" + cache_version = "2.4" def __init__(self, cacheable=False, cachedir=None): if not self.__dict__.has_key("initialized"):