[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 9bcbfe0fa48aba1da806fecfea79e3aa2d7bdb27
Andreas Beckmann
debian at abeckmann.de
Fri Dec 2 13:30:29 UTC 2011
The following commit has been merged in the develop branch:
commit ae307587f51f2e572a33e9cc734270c35fbd8ec6
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Tue Nov 29 18:05:16 2011 +0100
archive logs of removed packages
if a package does no longer exist, move its log file to archive/
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/piuparts-report.py b/piuparts-report.py
index 17ccca6..875c264 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -1020,13 +1020,21 @@ class Section:
}))
- def detect_removed_packages(self, logs_by_dir):
+ def archive_logfile(self, vdir, log):
+ archivedir = os.path.join("archive", vdir)
+ if not os.path.exists(archivedir):
+ os.makedirs(archivedir)
+ os.rename(os.path.join(vdir, log), os.path.join("archive", vdir, log))
+
+
+ def cleanup_removed_packages(self, logs_by_dir):
for vdir in logs_by_dir.keys():
for log in sorted(logs_by_dir[vdir]):
if log.endswith(".log"):
package, version = log[:-len(".log")].split("_")
if not self._binary_db.has_package(package):
- logging.debug("Obsolete log file: %s/%s" % (vdir, log))
+ logging.debug("Package %s was removed, archiving %s/%s" % (package, vdir, log))
+ self.archive_logfile(vdir, log)
logs_by_dir[vdir].remove(log)
@@ -1037,8 +1045,8 @@ class Section:
for vdir in dirs:
logs_by_dir[vdir] = find_files_with_suffix(vdir, ".log")
- logging.debug("Detecting removed packages")
- self.detect_removed_packages(logs_by_dir)
+ logging.debug("Archiving logs of obsolete packages")
+ self.cleanup_removed_packages(logs_by_dir)
logging.debug("Copying log files")
copy_logs(logs_by_dir, self._output_directory)
--
piuparts git repository
More information about the Piuparts-commits
mailing list