keep config file's stat info while taking snapshot

This commit is contained in:
Faik Uygur
2008-03-10 19:47:23 +00:00
parent 9afd73108f
commit 6212f0c0e3
3 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ class HistoryDB(lazydb.LazyDB):
self.history.add(pkgBefore, pkgAfter, operation)
def load_config(self, operation):
hist_dir = os.path.join(ctx.config.history_dir(), str(operation))
hist_dir = os.path.join(ctx.config.history_dir(), "%03d" % operation)
if os.path.exists(hist_dir):
import distutils.dir_util as dir_util
dir_util.copy_tree(hist_dir, "/")
@@ -56,7 +56,7 @@ class HistoryDB(lazydb.LazyDB):
return
destdir = os.path.join(hist_dir, config_file[1:])
pisi.util.copy_file(config_file, destdir);
pisi.util.copy_file_stat(config_file, destdir);
def update_history(self):
self.history.update()
-2
View File
@@ -146,5 +146,3 @@ def takeback(operation):
pisi.operations.remove.remove(beremoved)
historydb.load_config(operation)
+6
View File
@@ -310,6 +310,12 @@ def copy_file(src,dest):
check_dir(os.path.dirname(dest))
shutil.copyfile(src, dest)
def copy_file_stat(src,dest):
"""Copy source file to the destination file with all stat info."""
check_file(src)
check_dir(os.path.dirname(dest))
shutil.copy2(src, dest)
def is_ar_file(file_path):
return open(file_path).read(8) == '!<arch>\n'