diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index d7396535..3e51d9f2 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -807,19 +807,19 @@ Finds the installed package which contains the specified file. self.parser.add_option("-l", "--long", action="store_true", default=False, help="show in long format") + @staticmethod def search_exact(path): + path = path.lstrip('/') #FIXME: this shouldn't be necessary :/ if ctx.filesdb.has_file(path): - (pkg_name, file_info) = ctx.filesdb.get_info(path) + (pkg_name, file_info) = ctx.filesdb.get_file(path) ctx.ui.info(_('Package: %s') % pkg_name) - if ctx.options.long: + if ctx.config.options.long: ctx.ui.info(_('Type: %s, Hash: %s') % (file_info.type, file_info.hash) ) else: ctx.ui.error(_('Path %s does not belong to an installed package') % path) - search_exact = staticmethod(search_exact) def run(self): - import os.path self.init(True) @@ -830,10 +830,10 @@ Finds the installed package which contains the specified file. # search among existing files for path in self.args: ctx.ui.info(_('Searching for %s') % path) + import os.path if os.path.exists(path): - self.search_exact(os.path.realpath(path)) - else: - pisi.api.error(_('%s cannot be found')) + path = os.path.realpath(path) + self.search_exact(path) self.finalize() diff --git a/pisi/files.py b/pisi/files.py index d2e7576c..ef3c1292 100644 --- a/pisi/files.py +++ b/pisi/files.py @@ -105,12 +105,13 @@ class FilesDB(shelve.LockedDBShelf): def add_files(self, pkg_name, files): for x in files.list: - self[x.path] = (pkg_name, x) + self[str(x.path)] = (pkg_name, x) def has_file(self, path): - return self.has_key(path) + return self.has_key(str(path)) - def get_file_info(self, path): + def get_file(self, path): + path = str(path) if not self.has_key(path): return None else: diff --git a/pisi/install.py b/pisi/install.py index 98101529..d0d73e42 100644 --- a/pisi/install.py +++ b/pisi/install.py @@ -205,5 +205,8 @@ class Installer: self.metadata.package.build, self.metadata.package.distribution) + # filesdb + ctx.filesdb.add_files(self.metadata.package.name, self.files) + # installed packages packagedb.inst_packagedb.add_package(self.pkginfo)