diff --git a/pisi/db/historydb.py b/pisi/db/historydb.py index 39204274..919ed30a 100644 --- a/pisi/db/historydb.py +++ b/pisi/db/historydb.py @@ -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() diff --git a/pisi/operations/history.py b/pisi/operations/history.py index 3ce8de5b..40cbdf5d 100644 --- a/pisi/operations/history.py +++ b/pisi/operations/history.py @@ -146,5 +146,3 @@ def takeback(operation): pisi.operations.remove.remove(beremoved) historydb.load_config(operation) - - diff --git a/pisi/util.py b/pisi/util.py index 2e9c3653..c8346bab 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -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) == '!\n'