[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.46-30-gd2044a4
Holger Levsen
holger at layer-acht.org
Fri Sep 28 09:47:12 UTC 2012
The following commit has been merged in the piatti branch:
commit a42b2c8f4c17e6cf2d563544b789da3999f01a11
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Wed Sep 26 17:17:54 2012 +0200
p: run debsums on the chroot before removing a package
detects any modified or missing shipped files
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/debian/changelog b/debian/changelog
index 44a5811..d4f0714 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ piuparts (0.47) UNRELEASED; urgency=low
- Add to ignored_files/ignored_patterns:
+ /var/log/dbconfig-common/dbc.log
- Print a final message before terminating in the panic() handler.
+ - Add support for running debsums before package removal, enabled by
+ default. May be disabled via --no-debsums.
* piuparts-master.py:
* piuparts-slave.py:
- Detect incomplete piuparts output and ensure such tests fail.
diff --git a/debian/control b/debian/control
index fa66e7d..88603aa 100644
--- a/debian/control
+++ b/debian/control
@@ -23,6 +23,7 @@ Pre-Depends:
dpkg (>= 1.15.7.2~),
Depends:
debootstrap,
+ debsums,
lsb-release,
lsof,
python-debian,
diff --git a/piuparts.1.txt b/piuparts.1.txt
index 835a50d..47d892c 100644
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -122,6 +122,9 @@ The 'components' that are used for a mirror can also be set with this option: a
+
Note that file: addresses works if the directories are made accessible from within the chroot with '--bindmount'.
+*--no-debsums*::
+ Don't run debsums to check for modified or missing files.
+
*--no-diversions*::
Don't check for broken diversions.
diff --git a/piuparts.py b/piuparts.py
index 87eff97..dab73dc 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -161,6 +161,7 @@ class Settings:
self.extra_old_packages = []
self.skip_cronfiles_test = False
self.skip_logrotatefiles_test = False
+ self.check_debsums = True
self.check_broken_diversions = True
self.check_broken_symlinks = True
self.warn_broken_symlinks = True
@@ -1131,6 +1132,16 @@ class Chroot:
added = [ln for ln in post_install_diversions if not ln in pre_install_diversions]
return (removed, added)
+ def check_debsums(self, ignore_errors=False):
+ if not settings.check_debsums:
+ return
+ (status, output) = run(["debsums", "--root", self.name, "-ac"], ignore_errors=True)
+ if status != 0:
+ logging.error("FAIL: debsums reports modifications inside the chroot:\n%s" %
+ indent_string(output.replace(self.name, "")))
+ if not ignore_errors:
+ panic()
+
def remove_packages(self, packages):
"""Remove packages in a chroot."""
if packages:
@@ -1169,6 +1180,8 @@ class Chroot:
deps_to_install = [name for name, state in deps.iteritems()
if state == "install"]
+ self.check_debsums()
+
# Run custom scripts before removing all packages.
self.run_scripts("pre_remove")
@@ -2492,6 +2505,10 @@ def parse_command_line():
action="store_true", default=False,
help="Skip testing the output from the logrotate files.")
+ parser.add_option("--no-debsums",
+ action="store_true", default=False,
+ help="Skip running debsums in the chroot.")
+
parser.add_option("--skip-minimize",
action="store_true", default=True,
help="Skip minimize chroot step. This is the default now.")
@@ -2581,6 +2598,7 @@ def parse_command_line():
[settings.extra_old_packages.extend([i.strip() for i in csv.split(",")]) for csv in opts.extra_old_packages]
settings.skip_cronfiles_test = opts.skip_cronfiles_test
settings.skip_logrotatefiles_test = opts.skip_logrotatefiles_test
+ settings.check_debsums = not opts.no_debsums
settings.check_broken_diversions = not opts.no_diversions
settings.check_broken_symlinks = not opts.no_symlinks
settings.warn_broken_symlinks = not opts.fail_on_broken_symlinks
--
piuparts git repository
More information about the Piuparts-commits
mailing list