keep config file's stat info while taking snapshot
This commit is contained in:
@@ -44,7 +44,7 @@ class HistoryDB(lazydb.LazyDB):
|
|||||||
self.history.add(pkgBefore, pkgAfter, operation)
|
self.history.add(pkgBefore, pkgAfter, operation)
|
||||||
|
|
||||||
def load_config(self, 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):
|
if os.path.exists(hist_dir):
|
||||||
import distutils.dir_util as dir_util
|
import distutils.dir_util as dir_util
|
||||||
dir_util.copy_tree(hist_dir, "/")
|
dir_util.copy_tree(hist_dir, "/")
|
||||||
@@ -56,7 +56,7 @@ class HistoryDB(lazydb.LazyDB):
|
|||||||
return
|
return
|
||||||
|
|
||||||
destdir = os.path.join(hist_dir, config_file[1:])
|
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):
|
def update_history(self):
|
||||||
self.history.update()
|
self.history.update()
|
||||||
|
|||||||
@@ -146,5 +146,3 @@ def takeback(operation):
|
|||||||
pisi.operations.remove.remove(beremoved)
|
pisi.operations.remove.remove(beremoved)
|
||||||
|
|
||||||
historydb.load_config(operation)
|
historydb.load_config(operation)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -310,6 +310,12 @@ def copy_file(src,dest):
|
|||||||
check_dir(os.path.dirname(dest))
|
check_dir(os.path.dirname(dest))
|
||||||
shutil.copyfile(src, 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):
|
def is_ar_file(file_path):
|
||||||
return open(file_path).read(8) == '!<arch>\n'
|
return open(file_path).read(8) == '!<arch>\n'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user