* [MERGE] forward port changes in pisi-delta trunk.

This commit is contained in:
Faik Uygur
2007-03-26 12:14:15 +00:00
parent 4afb4f81d8
commit 50e59b7111
6 changed files with 31 additions and 13 deletions
+19 -1
View File
@@ -69,7 +69,7 @@ class Install(AtomicOperation):
# Package is installed. This is an upgrade. Check delta. # Package is installed. This is an upgrade. Check delta.
if ctx.installdb.is_installed(pkg.name): if ctx.installdb.is_installed(pkg.name):
(version, release, build) = ctx.installdb.get_version(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 exists than use the delta uri.
if delta: if delta:
@@ -295,7 +295,22 @@ class Install(AtomicOperation):
oldconfig = path + '.old' oldconfig = path + '.old'
if os.path.exists(newconfig): if os.path.exists(newconfig):
os.unlink(newconfig) os.unlink(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(path, newconfig)
os.rename(oldconfig, path) os.rename(oldconfig, path)
# Delta package does not contain the files that have the same hash as in # 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 # there may be left over config files
check_config_changed(file) check_config_changed(file)
if self.package_fname.endswith(ctx.const.delta_package_suffix):
relocate_files()
self.package.extract_install(ctx.config.dest_dir()) self.package.extract_install(ctx.config.dest_dir())
if config_changed: if config_changed:
+1 -1
View File
@@ -49,7 +49,7 @@ def create_delta_package(old_package, new_package):
tar.unpack_dir(newpkg_path) tar.unpack_dir(newpkg_path)
# Create delta package # 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") outdir = ctx.get_option("output_dir")
if outdir: if outdir:
+2 -2
View File
@@ -166,8 +166,8 @@ class Index(XmlFile):
delta.packageURI = util.removepathprefix(repo_uri, delta_path) delta.packageURI = util.removepathprefix(repo_uri, delta_path)
delta.packageSize = os.path.getsize(delta_path) delta.packageSize = os.path.getsize(delta_path)
delta.packageHash = util.sha1_file(delta_path) delta.packageHash = util.sha1_file(delta_path)
name, relFrom, relTo = util.parse_delta_package_name(delta_path) name, buildFrom, buildTo = util.parse_delta_package_name(delta_path)
delta.releaseFrom = relFrom delta.buildFrom = buildFrom
md.package.deltaPackages.append(delta) md.package.deltaPackages.append(delta)
self.packages.append(md.package) self.packages.append(md.package)
+3 -3
View File
@@ -33,7 +33,7 @@ class Delta:
t_PackageURI = [ autoxml.String, autoxml.optional] t_PackageURI = [ autoxml.String, autoxml.optional]
t_PackageSize = [ autoxml.Long, autoxml.optional] t_PackageSize = [ autoxml.Long, autoxml.optional]
t_PackageHash = [ autoxml.String, autoxml.optional, "SHA1Sum" ] t_PackageHash = [ autoxml.String, autoxml.optional, "SHA1Sum" ]
a_releaseFrom = [autoxml.String, autoxml.optional] a_buildFrom = [autoxml.String, autoxml.optional]
class Source: class Source:
__metaclass__ = autoxml.autoxml __metaclass__ = autoxml.autoxml
@@ -58,9 +58,9 @@ class Package(specfile.Package):
t_Source = [ Source, autoxml.optional] t_Source = [ Source, autoxml.optional]
def get_delta(self, releaseFrom): def get_delta(self, buildFrom):
for delta in self.deltaPackages: for delta in self.deltaPackages:
if delta.releaseFrom == releaseFrom: if delta.buildFrom == str(buildFrom):
return delta return delta
else: else:
return None return None
+1 -1
View File
@@ -803,7 +803,7 @@ def calculate_download_sizes(order):
delta = None delta = None
if ctx.installdb.is_installed(pkg.name): if ctx.installdb.is_installed(pkg.name):
(version, release, build) = ctx.installdb.get_version(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: if delta:
fn = os.path.basename(delta.packageURI) fn = os.path.basename(delta.packageURI)
+4 -4
View File
@@ -645,11 +645,11 @@ def parse_delta_package_name(package_name):
example: tasma-5-7.pisi.delta -> (tasma, 5, 7) example: tasma-5-7.pisi.delta -> (tasma, 5, 7)
""" """
name, release = parse_package_name(package_name) name, build = parse_package_name(package_name)
release = release[:-len(ctx.const.delta_package_suffix)] build = build[:-len(ctx.const.delta_package_suffix)]
releaseFrom, releaseTo = release.split("-") buildFrom, buildTo = build.split("-")
return name, releaseFrom, releaseTo return name, buildFrom, buildTo
def filter_latest_packages(package_paths): def filter_latest_packages(package_paths):
""" For a given pisi package paths list where there may also be multiple versions """ For a given pisi package paths list where there may also be multiple versions