* fix:
- correct a few typos, and unicode blurbs - don't require that the file exists as a path, we got destdir
This commit is contained in:
@@ -807,19 +807,19 @@ Finds the installed package which contains the specified file.
|
|||||||
self.parser.add_option("-l", "--long", action="store_true",
|
self.parser.add_option("-l", "--long", action="store_true",
|
||||||
default=False, help="show in long format")
|
default=False, help="show in long format")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def search_exact(path):
|
def search_exact(path):
|
||||||
|
path = path.lstrip('/') #FIXME: this shouldn't be necessary :/
|
||||||
if ctx.filesdb.has_file(path):
|
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)
|
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,
|
ctx.ui.info(_('Type: %s, Hash: %s') % (file_info.type,
|
||||||
file_info.hash) )
|
file_info.hash) )
|
||||||
else:
|
else:
|
||||||
ctx.ui.error(_('Path %s does not belong to an installed package') % path)
|
ctx.ui.error(_('Path %s does not belong to an installed package') % path)
|
||||||
search_exact = staticmethod(search_exact)
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
import os.path
|
|
||||||
|
|
||||||
self.init(True)
|
self.init(True)
|
||||||
|
|
||||||
@@ -830,10 +830,10 @@ Finds the installed package which contains the specified file.
|
|||||||
# search among existing files
|
# search among existing files
|
||||||
for path in self.args:
|
for path in self.args:
|
||||||
ctx.ui.info(_('Searching for %s') % path)
|
ctx.ui.info(_('Searching for %s') % path)
|
||||||
|
import os.path
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
self.search_exact(os.path.realpath(path))
|
path = os.path.realpath(path)
|
||||||
else:
|
self.search_exact(path)
|
||||||
pisi.api.error(_('%s cannot be found'))
|
|
||||||
|
|
||||||
self.finalize()
|
self.finalize()
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -105,12 +105,13 @@ class FilesDB(shelve.LockedDBShelf):
|
|||||||
|
|
||||||
def add_files(self, pkg_name, files):
|
def add_files(self, pkg_name, files):
|
||||||
for x in files.list:
|
for x in files.list:
|
||||||
self[x.path] = (pkg_name, x)
|
self[str(x.path)] = (pkg_name, x)
|
||||||
|
|
||||||
def has_file(self, path):
|
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):
|
if not self.has_key(path):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -205,5 +205,8 @@ class Installer:
|
|||||||
self.metadata.package.build,
|
self.metadata.package.build,
|
||||||
self.metadata.package.distribution)
|
self.metadata.package.distribution)
|
||||||
|
|
||||||
|
# filesdb
|
||||||
|
ctx.filesdb.add_files(self.metadata.package.name, self.files)
|
||||||
|
|
||||||
# installed packages
|
# installed packages
|
||||||
packagedb.inst_packagedb.add_package(self.pkginfo)
|
packagedb.inst_packagedb.add_package(self.pkginfo)
|
||||||
|
|||||||
Reference in New Issue
Block a user