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.
This commit is contained in:
Fatih Aşıcı
2011-02-23 13:14:05 +00:00
parent 6c7f49bc82
commit a7d55ef8d5
2 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -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)
+2 -2
View File
@@ -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"):