[Piuparts-commits] rev 54 - in trunk: . debian
Ana Beatriz Guerrero López
ana at alioth.debian.org
Mon Jul 9 21:22:16 UTC 2007
Author: ana
Date: 2007-07-09 21:22:16 +0000 (Mon, 09 Jul 2007)
New Revision: 54
Modified:
trunk/debian/changelog
trunk/piuparts.py
Log:
* Add option --list-installed-files, that list files added/removed/modified
to the chroot after the package's installation. (Closes: #431821)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2007-07-09 17:22:49 UTC (rev 53)
+++ trunk/debian/changelog 2007-07-09 21:22:16 UTC (rev 54)
@@ -1,6 +1,8 @@
piuparts (0.23) UNRELEASED; urgency=low
* Cosmetic change, now file owner and file are shown in the same line.
+ * Add option --list-installed-files, that list files added/removed/modified
+ to the chroot after the package's installation. (Closes: #431821)
-- Ana Beatriz Guerrero Lopez <ana at debian.org> Sat, 07 Jul 2007 01:17:47 +0200
Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py 2007-07-09 17:22:49 UTC (rev 53)
+++ trunk/piuparts.py 2007-07-09 21:22:16 UTC (rev 54)
@@ -68,6 +68,7 @@
self.warn_on_others = False
self.keep_sources_list = False
self.skip_minimize = False
+ self.list_installed_files = False
self.check_broken_symlinks = True
self.ignored_files = [
"/dev/MAKEDEV",
@@ -555,14 +556,47 @@
logging.error("Error copying %s to %s: %s" %
(source_name, target_name, detail))
panic()
+
+ def list_installed_files (self, pre_info, post_info):
+ """List the new files installed, removed and modified between two dir trees.
+ Actually, it is a nice output of the funcion diff_meta_dat."""
+ (new, removed, modified) = diff_meta_data(pre_info, post_info)
+ file_owners = self.get_files_owned_by_packages()
+ if new:
+ logging.debug("New installed files on system:\n" + file_list(new, file_owners))
+ else:
+ logging.debug("The package did not install any file!\n" + file_list(new, file_owners))
+
+ if removed:
+ logging.debug("The following files have disappeared:\n" +
+ file_list(new, file_owners))
+
+ if modified:
+ logging.debug("The following files have been modified:\n" +
+ file_list(new, file_owners))
+
+
def install_package_files(self, filenames):
if filenames:
self.copy_files(filenames, "tmp")
tmp_files = [os.path.basename(a) for a in filenames]
tmp_files = [os.path.join("tmp", name) for name in tmp_files]
- self.run(["dpkg", "-i"] + tmp_files, ignore_errors=True)
- self.run(["apt-get", "-yf", "--no-remove", "install"])
+
+ if settings.list_installed_files:
+ pre_info = self.save_meta_data()
+
+ self.run(["dpkg", "-i"] + tmp_files, ignore_errors=True)
+ self.list_installed_files (pre_info, self.save_meta_data())
+
+ self.run(["apt-get", "-yf", "--no-remove", "install"])
+ self.list_installed_files (pre_info, self.save_meta_data())
+
+ else:
+ self.run(["dpkg", "-i"] + tmp_files, ignore_errors=True)
+ self.run(["apt-get", "-yf", "--no-remove", "install"])
+
+
self.run(["apt-get", "clean"])
remove_files([os.path.join(self.name, name)
for name in tmp_files])
@@ -768,10 +802,12 @@
meta_infos.sort()
list = []
for name, data in meta_infos:
-
+ list.append(" %s\t" % name)
if name in file_owners:
- list.append(" owned by: %s\t" % ", ".join(file_owners[name]))
- list.append(" %s\n" % name)
+ list.append(" owned by: %s\n" % ", ".join(file_owners[name]))
+ else:
+ list.append(" not owned\n")
+
return "".join(list)
@@ -1076,7 +1112,12 @@
parser.add_option("--skip-minimize",
action="store_true", default=False,
help="Skip minimize chroot step.")
-
+
+ parser.add_option("--list-installed-files",
+ action="store_true", default=False,
+ help="List files added to the chroot after the " +
+ "installation of the package")
+
parser.add_option("-l", "--log-file", metavar="FILENAME",
help="Write log file to FILENAME in addition to " +
"the standard output.")
@@ -1123,6 +1164,7 @@
settings.keep_tmpdir = opts.keep_tmpdir
settings.keep_sources_list = opts.keep_sources_list
settings.skip_minimize = opts.skip_minimize
+ settings.list_installed_files = opts.list_installed_files
log_file_name = opts.log_file
settings.debian_mirrors = [parse_mirror_spec(x,
["main",
More information about the Piuparts-commits
mailing list