* fix: packagedb: remove reverse dependencies correctly when removing a package
* fix: info command sets repository correctly to packagedb * fix: use -mx=9 options for pylzma, implement that by passing keyword args down to pylzma. 64mb dictionary size 64 fastBytes BT4, we can't implement the wonderful BCJ2
This commit is contained in:
+20
-24
@@ -258,31 +258,27 @@ def info_file(package_fn):
|
||||
|
||||
def info_name(package_name, installed=False):
|
||||
"""fetch package information for a package"""
|
||||
if ctx.packagedb.has_package(package_name, pisi.itembyrepodb.all):
|
||||
if installed:
|
||||
package = ctx.packagedb.get_package(package_name, pisi.itembyrepodb.installed)
|
||||
else:
|
||||
package, repo = ctx.packagedb.get_package_repo(package_name)
|
||||
if repo==pisi.itembyrepodb.installed:
|
||||
raise Error(_('Package %s not found') % package_name)
|
||||
|
||||
from pisi.metadata import MetaData
|
||||
metadata = MetaData()
|
||||
metadata.package = package
|
||||
#FIXME: get it from sourcedb if available
|
||||
metadata.source = None
|
||||
#TODO: fetch the files from server if possible (wow, you maniac -- future exa)
|
||||
if installed and ctx.installdb.is_installed(package.name):
|
||||
try:
|
||||
files = ctx.installdb.files(package.name)
|
||||
except pisi.Error, e:
|
||||
ctx.ui.warning(e)
|
||||
files = None
|
||||
else:
|
||||
files = None
|
||||
return metadata, files
|
||||
if installed:
|
||||
package = ctx.packagedb.get_package(package_name, pisi.itembyrepodb.installed)
|
||||
else:
|
||||
raise Error(_('Package %s not found') % package_name)
|
||||
package, repo = ctx.packagedb.get_package_repo(package_name, pisi.itembyrepodb.repos)
|
||||
repostr = repo
|
||||
|
||||
from pisi.metadata import MetaData
|
||||
metadata = MetaData()
|
||||
metadata.package = package
|
||||
#FIXME: get it from sourcedb if available
|
||||
metadata.source = None
|
||||
#TODO: fetch the files from server if possible (wow, you maniac -- future exa)
|
||||
if installed and ctx.installdb.is_installed(package.name):
|
||||
try:
|
||||
files = ctx.installdb.files(package.name)
|
||||
except pisi.Error, e:
|
||||
ctx.ui.warning(e)
|
||||
files = None
|
||||
else:
|
||||
files = None
|
||||
return metadata, files
|
||||
|
||||
def search_package_names(query):
|
||||
r = set()
|
||||
|
||||
+4
-1
@@ -134,7 +134,10 @@ class ArchiveZip(ArchiveBase):
|
||||
else:
|
||||
method = ctx.get_option('compression_method')
|
||||
if not method:
|
||||
self.zip_obj.write(file_name, arc_name, zipfileext.ZIP_LZMA_BOGUS)
|
||||
method = 'lzma'
|
||||
if method == 'lzma':
|
||||
self.zip_obj.write(file_name, arc_name, zipfileext.ZIP_LZMA_BOGUS,
|
||||
dictionary = 26, fastBytes = 64)
|
||||
else:
|
||||
self.zip_obj.write(file_name, arc_name, self.comp_method[method])
|
||||
|
||||
|
||||
@@ -675,7 +675,7 @@ Usage: info <package1> <package2> ... <packagen>
|
||||
ctx.ui.info(_('[inst] '), noln=True)
|
||||
else:
|
||||
ctx.ui.info(_('Installed package:'))
|
||||
self.print_pkginfo(metadata, files)
|
||||
self.print_pkginfo(metadata, files,pisi.itembyrepodb.installed)
|
||||
|
||||
if ctx.packagedb.has_package(arg):
|
||||
metadata, files = pisi.api.info_name(arg, False)
|
||||
@@ -683,9 +683,9 @@ Usage: info <package1> <package2> ... <packagen>
|
||||
ctx.ui.info(_('[repo] '), noln=True)
|
||||
else:
|
||||
ctx.ui.info(_('Package found in repository:'))
|
||||
self.print_pkginfo(metadata, files)
|
||||
self.print_pkginfo(metadata, files, pisi.itembyrepodb.repos)
|
||||
|
||||
def print_pkginfo(self, metadata, files):
|
||||
def print_pkginfo(self, metadata, files, repo = None):
|
||||
import os.path
|
||||
|
||||
if not ctx.get_option('long'):
|
||||
@@ -693,8 +693,10 @@ Usage: info <package1> <package2> ... <packagen>
|
||||
ctx.ui.info('%15s - %s' % (pkg.name, unicode(pkg.summary)))
|
||||
else:
|
||||
ctx.ui.info(unicode(metadata.package))
|
||||
revdeps = [x[0] for x in ctx.packagedb.get_rev_deps(metadata.package.name)]
|
||||
print _('Reverse Dependencies:'), util.strlist(revdeps)
|
||||
if repo:
|
||||
revdeps = [x[0] for x in
|
||||
ctx.packagedb.get_rev_deps(metadata.package.name, repo)]
|
||||
print _('Reverse Dependencies:'), util.strlist(revdeps)
|
||||
if self.options.files or self.options.files_path:
|
||||
if files:
|
||||
print _('\nFiles:')
|
||||
|
||||
+6
-1
@@ -117,8 +117,13 @@ class PackageDB(object):
|
||||
def proc(txn):
|
||||
package_info = self.d.get_item(name, repo, txn=txn)
|
||||
self.d.remove_item(name, repo, txn=txn)
|
||||
for dep in package_info.runtimeDependencies():
|
||||
dep_name = str(dep.package)
|
||||
if self.dr.has_key(dep_name, repo, txn):
|
||||
revdep = self.dr.get_item(dep_name, repo, txn)
|
||||
revdep = filter(lambda (n,d):n!=name, revdep)
|
||||
self.dr.add_item(dep_name, revdep, repo, txn)
|
||||
if self.dr.has_key(name, repo, txn=txn):
|
||||
|
||||
self.dr.remove_item(name, repo, txn=txn)
|
||||
ctx.componentdb.remove_package(package_info.partOf, package_info.name, repo, txn)
|
||||
self.d.txn_proc(proc, txn)
|
||||
|
||||
+2
-7
@@ -192,7 +192,7 @@ class ZipFileExt(ZipFile):
|
||||
raise RuntimeError, \
|
||||
"Compression requires the (missing) pylzma module"
|
||||
|
||||
def write(self, filename, arcname=None, compress_type=None):
|
||||
def write(self, filename, arcname=None, compress_type=None, **kwargs):
|
||||
"""Put the bytes from filename into the archive under the name
|
||||
arcname."""
|
||||
st = os.stat(filename)
|
||||
@@ -253,7 +253,7 @@ class ZipFileExt(ZipFile):
|
||||
buf = fp.read()
|
||||
file_size = len(buf)
|
||||
CRC = binascii.crc32(buf, CRC)
|
||||
compressed = pylzma.compress(buf, eos=1)
|
||||
compressed = pylzma.compress(buf, **kwargs)
|
||||
self.fp.write(compressed)
|
||||
zinfo.compress_size = len(compressed)
|
||||
|
||||
@@ -284,11 +284,6 @@ class ZipFileExt(ZipFile):
|
||||
raise RuntimeError, \
|
||||
"De-compression requires the (missing) zlib module"
|
||||
return DeflatedZipFileEntry(self.fp, zinfo.compress_size)
|
||||
## elif zinfo.compress_type == ZIP_BZIP2:
|
||||
## if not bzip2:
|
||||
## raise RuntimeError, \
|
||||
## "De-compression requires the (missing) bzip2 module"
|
||||
## return LZMAFileEntry(self.fp, zinfo.compress_size)
|
||||
elif zinfo.compress_type == ZIP_LZMA_BOGUS:
|
||||
if not pylzma:
|
||||
raise RuntimeError, \
|
||||
|
||||
Reference in New Issue
Block a user