* [MERGE] forward port changes in pisi-delta trunk.
This commit is contained in:
@@ -69,7 +69,7 @@ class Install(AtomicOperation):
|
||||
# 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)
|
||||
delta = pkg.get_delta(buildFrom=build)
|
||||
|
||||
# If delta exists than use the delta uri.
|
||||
if delta:
|
||||
@@ -295,7 +295,22 @@ class Install(AtomicOperation):
|
||||
oldconfig = path + '.old'
|
||||
if os.path.exists(newconfig):
|
||||
os.unlink(newconfig)
|
||||
os.rename(path, newconfig)
|
||||
|
||||
# In the case of delta packages: the old package and the new package
|
||||
# may contain same config typed files with same hashes, so the delta
|
||||
# package will not have that config file. In order to protect user
|
||||
# changed config files, they are renamed with ".old" prefix in case
|
||||
# of the hashes of these files on the filesystem and the new config
|
||||
# file that is coming from the new package. But in delta package case
|
||||
# with the given scenario there wont be any, so we can pass this one.
|
||||
# If the config files were not be the same between these packages the
|
||||
# delta package would have it and extract it and the path would point
|
||||
# to that new config file. If they are same and the user had changed
|
||||
# that file and using the changed config file, there is no problem
|
||||
# here.
|
||||
if os.path.exists(path):
|
||||
os.rename(path, newconfig)
|
||||
|
||||
os.rename(oldconfig, path)
|
||||
|
||||
# Delta package does not contain the files that have the same hash as in
|
||||
@@ -347,6 +362,9 @@ class Install(AtomicOperation):
|
||||
# there may be left over config files
|
||||
check_config_changed(file)
|
||||
|
||||
if self.package_fname.endswith(ctx.const.delta_package_suffix):
|
||||
relocate_files()
|
||||
|
||||
self.package.extract_install(ctx.config.dest_dir())
|
||||
|
||||
if config_changed:
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ def create_delta_package(old_package, new_package):
|
||||
tar.unpack_dir(newpkg_path)
|
||||
|
||||
# Create delta package
|
||||
deltaname = "%s-%s-%s%s" % (oldmd.package.name, oldmd.package.release, newmd.package.release, ctx.const.delta_package_suffix)
|
||||
deltaname = "%s-%s-%s%s" % (oldmd.package.name, oldmd.package.build, newmd.package.build, ctx.const.delta_package_suffix)
|
||||
|
||||
outdir = ctx.get_option("output_dir")
|
||||
if outdir:
|
||||
|
||||
+2
-2
@@ -166,8 +166,8 @@ class Index(XmlFile):
|
||||
delta.packageURI = util.removepathprefix(repo_uri, delta_path)
|
||||
delta.packageSize = os.path.getsize(delta_path)
|
||||
delta.packageHash = util.sha1_file(delta_path)
|
||||
name, relFrom, relTo = util.parse_delta_package_name(delta_path)
|
||||
delta.releaseFrom = relFrom
|
||||
name, buildFrom, buildTo = util.parse_delta_package_name(delta_path)
|
||||
delta.buildFrom = buildFrom
|
||||
md.package.deltaPackages.append(delta)
|
||||
|
||||
self.packages.append(md.package)
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@ class Delta:
|
||||
t_PackageURI = [ autoxml.String, autoxml.optional]
|
||||
t_PackageSize = [ autoxml.Long, autoxml.optional]
|
||||
t_PackageHash = [ autoxml.String, autoxml.optional, "SHA1Sum" ]
|
||||
a_releaseFrom = [autoxml.String, autoxml.optional]
|
||||
a_buildFrom = [autoxml.String, autoxml.optional]
|
||||
|
||||
class Source:
|
||||
__metaclass__ = autoxml.autoxml
|
||||
@@ -58,9 +58,9 @@ class Package(specfile.Package):
|
||||
|
||||
t_Source = [ Source, autoxml.optional]
|
||||
|
||||
def get_delta(self, releaseFrom):
|
||||
def get_delta(self, buildFrom):
|
||||
for delta in self.deltaPackages:
|
||||
if delta.releaseFrom == releaseFrom:
|
||||
if delta.buildFrom == str(buildFrom):
|
||||
return delta
|
||||
else:
|
||||
return None
|
||||
|
||||
+1
-1
@@ -803,7 +803,7 @@ def calculate_download_sizes(order):
|
||||
delta = None
|
||||
if ctx.installdb.is_installed(pkg.name):
|
||||
(version, release, build) = ctx.installdb.get_version(pkg.name)
|
||||
delta = pkg.get_delta(releaseFrom=release)
|
||||
delta = pkg.get_delta(buildFrom=build)
|
||||
|
||||
if delta:
|
||||
fn = os.path.basename(delta.packageURI)
|
||||
|
||||
+4
-4
@@ -645,11 +645,11 @@ def parse_delta_package_name(package_name):
|
||||
example: tasma-5-7.pisi.delta -> (tasma, 5, 7)
|
||||
|
||||
"""
|
||||
name, release = parse_package_name(package_name)
|
||||
release = release[:-len(ctx.const.delta_package_suffix)]
|
||||
releaseFrom, releaseTo = release.split("-")
|
||||
name, build = parse_package_name(package_name)
|
||||
build = build[:-len(ctx.const.delta_package_suffix)]
|
||||
buildFrom, buildTo = build.split("-")
|
||||
|
||||
return name, releaseFrom, releaseTo
|
||||
return name, buildFrom, buildTo
|
||||
|
||||
def filter_latest_packages(package_paths):
|
||||
""" For a given pisi package paths list where there may also be multiple versions
|
||||
|
||||
Reference in New Issue
Block a user