* up up with delta.. yihuu!
This commit is contained in:
@@ -64,14 +64,25 @@ class Install(AtomicOperation):
|
||||
ctx.ui.info(_("Package %s found in repository %s") % (name, repo))
|
||||
repo = ctx.repodb.get_repo(repo)
|
||||
pkg = ctx.packagedb.get_package(name)
|
||||
delta = None
|
||||
|
||||
# FIXME: let pkg.packageURI be stored as URI type rather than string
|
||||
pkg_uri = URI(pkg.packageURI)
|
||||
if pkg_uri.is_absolute_path():
|
||||
pkg_path = str(pkg.packageURI)
|
||||
# Package is installed. This is an upgrade. Check delta.
|
||||
if ctx.installdb.is_installed(pkg.name):
|
||||
(version, release, build) = ctx.installdb.get_version(pkg.name)
|
||||
delta = pkg.get_delta(releaseFrom=release)
|
||||
|
||||
# If delta exists than use the delta uri.
|
||||
if delta:
|
||||
pkg_uri = delta.packageURI
|
||||
else:
|
||||
pkg_uri = pkg.packageURI
|
||||
|
||||
uri = URI(pkg_uri)
|
||||
if uri.is_absolute_path():
|
||||
pkg_path = str(pkg_uri)
|
||||
else:
|
||||
pkg_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
|
||||
str(pkg_uri.path()))
|
||||
str(uri.path()))
|
||||
|
||||
ctx.ui.info(_("Package URI: %s") % pkg_path, verbose=True)
|
||||
|
||||
|
||||
@@ -57,6 +57,13 @@ class Package(specfile.Package):
|
||||
|
||||
t_Source = [ Source, autoxml.optional]
|
||||
|
||||
def get_delta(self, releaseFrom):
|
||||
for delta in self.deltaPackages:
|
||||
if delta.releaseFrom == releaseFrom:
|
||||
return delta
|
||||
else:
|
||||
return None
|
||||
|
||||
def decode_hook(self, node, errs, where):
|
||||
self.version = self.history[0].version
|
||||
self.release = self.history[0].release
|
||||
|
||||
Reference in New Issue
Block a user