* fix rename_configs() indent error
* make upgrade config code human readable.
This commit is contained in:
+13
-13
@@ -294,23 +294,23 @@ class Install(AtomicOperation):
|
|||||||
Remove.remove_file( old_fileinfo[path] )
|
Remove.remove_file( old_fileinfo[path] )
|
||||||
|
|
||||||
if self.reinstall:
|
if self.reinstall:
|
||||||
new = set(map(lambda x: str(x.path), self.files.list))
|
# get 'config' typed file objects
|
||||||
old = set(map(lambda x: str(x.path), self.old_files.list))
|
new = filter(lambda x: x.type == 'config', self.files.list)
|
||||||
|
old = filter(lambda x: x.type == 'config', self.old_files.list)
|
||||||
|
|
||||||
# handle special cases for upgrades
|
# get config path lists
|
||||||
overlap = old & new
|
newconfig = set(map(lambda x: str(x.path), new))
|
||||||
self.files.list.sort(key=lambda x:x.path)
|
oldconfig = set(map(lambda x: str(x.path), old))
|
||||||
self.old_files.list.sort(key=lambda x:x.path)
|
|
||||||
def get_upgrades(list):
|
config_overlaps = newconfig & oldconfig
|
||||||
return filter(lambda x : str(x.path) in overlap, list)
|
if config_overlaps:
|
||||||
(upgrade_new, upgrade_old) = map(get_upgrades, [self.files.list, self.old_files.list])
|
files = filter(lambda x: x.path in config_overlaps, old)
|
||||||
for newf, oldf in zip(upgrade_new, upgrade_old):
|
for file in files:
|
||||||
assert newf.path == oldf.path
|
check_config_changed(file)
|
||||||
if newf.type == 'config' and oldf.type == 'config': # config upgrade
|
|
||||||
check_config_changed(oldf)
|
|
||||||
else:
|
else:
|
||||||
for file in self.files.list:
|
for file in self.files.list:
|
||||||
if file.type == 'config':
|
if file.type == 'config':
|
||||||
|
# there may be left over config files
|
||||||
check_config_changed(file)
|
check_config_changed(file)
|
||||||
|
|
||||||
self.package.extract_install(ctx.config.dest_dir())
|
self.package.extract_install(ctx.config.dest_dir())
|
||||||
|
|||||||
Reference in New Issue
Block a user