* simplify a bit

* fix: do not create a ".new" file if an existing config file is the 
same while installing (hersey ismail icin)
This commit is contained in:
Eray Özkural
2006-06-20 10:09:57 +00:00
parent 3c44a51cca
commit 8b8def1b5f
+9 -7
View File
@@ -300,9 +300,7 @@ class Install(AtomicOperation):
if os.path.exists(fpath + '.old'): if os.path.exists(fpath + '.old'):
os.unlink(fpath + '.old') os.unlink(fpath + '.old')
os.rename(fpath, fpath + '.old') os.rename(fpath, fpath + '.old')
else: # otherwise, old config file not changed, overwrite
# old config file not changed, overwrite
pass
except pisi.util.FileError, e: except pisi.util.FileError, e:
pass pass
else: else:
@@ -310,10 +308,14 @@ class Install(AtomicOperation):
if file.type == 'config': if file.type == 'config':
fpath = pisi.util.join_path(ctx.config.dest_dir(), file.path) fpath = pisi.util.join_path(ctx.config.dest_dir(), file.path)
if os.path.exists(fpath): # there is an old config file lying around if os.path.exists(fpath): # there is an old config file lying around
config_changed.append(fpath) try:
if os.path.exists(fpath + '.old'): if pisi.util.sha1_file(fpath) != file.hash:
os.unlink(fpath + '.old') config_changed.append(fpath)
os.rename(fpath, fpath + '.old') if os.path.exists(fpath + '.old'):
os.unlink(fpath + '.old')
os.rename(fpath, fpath + '.old')
except pisi.util.FileError, e:
pass
self.package.extract_install(ctx.config.dest_dir()) self.package.extract_install(ctx.config.dest_dir())