[Piuparts-commits] [piuparts] 01/04: p: add is_testable_* custom scripts
Holger Levsen
holger at layer-acht.org
Wed Dec 21 09:54:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 48e83e83a3e5861498d4031e3bd4059fa8aec2f2
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Dec 21 02:16:25 2016 +0100
p: add is_testable_* custom scripts
non-zero return code excludes packages from being tested
while reporting the test as successful
Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
README.txt | 8 ++++++++
debian/changelog | 5 +++++
piuparts.py | 23 ++++++++++++++++++-----
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/README.txt b/README.txt
index 9c7e4d8..d90b4ee 100644
--- a/README.txt
+++ b/README.txt
@@ -222,6 +222,14 @@ Before metadata of the chroot is recorded for later comparison.
'pre_test_' - at the beginning of each test. After metadata of
the chroot was recorded for later comparison.
+'is_testable_' - before *installing* your package. If this script
+returns a non-zero return value, the installation of the package
+will be skipped, but the test will be reported as successful.
+Use this to flag packages that cannot be be tested with piuparts
+by design (e.g. usrmerge), require not publicly available external
+ressources (e.g. some downloader packages) or are broken beyond
+repair (e.g. buggy packages in archived releases).
+
'pre_install_' - before *installing* your package. Depending on
the test, this may be run multiple times. The PIUPARTS_TEST and
PIUPARTS_PHASE variables can be used to distinguish the cases.
diff --git a/debian/changelog b/debian/changelog
index a329ecc..80664c4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,10 @@
piuparts (0.74) UNRELEASED; urgency=medium
+ * piuparts.py:
+ - Add new class of is_testable_* custom scripts: A non-zero return value
+ makes the test succeed without actually installing the package. Use for
+ packages that cannot be tested with piuparts by design or are broken in
+ an unfixable way. (Closes: #682739)
* piuparts.conf:
- New section [sid-strict], testing with --install-remove-install and
failing on leftover files.
diff --git a/piuparts.py b/piuparts.py
index b6d83c6..11e1c9b 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -765,7 +765,7 @@ class Chroot:
for sdir in settings.scriptsdirs:
logging.debug("Copying scriptsdir %s to %s" % (sdir, dest))
for sfile in os.listdir(sdir):
- if (sfile.startswith("post_") or sfile.startswith("pre_")) \
+ if (sfile.startswith("post_") or sfile.startswith("pre_") or sfile.startswith("is_testable_")) \
and not ".dpkg-" in sfile \
and os.path.isfile(os.path.join(sdir, sfile)):
shutil.copy(os.path.join(sdir, sfile), dest)
@@ -1729,7 +1729,7 @@ class Chroot:
if failed:
panic()
- def run_scripts(self, step):
+ def run_scripts(self, step, ignore_errors=False):
""" Run custom scripts to given step post-install|remove|purge"""
if not settings.scriptsdirs:
@@ -1740,10 +1740,13 @@ class Chroot:
logging.error("Scripts directory %s does not exist" % basepath)
panic()
list_scripts = sorted(os.listdir(basepath))
+ errorcodes=0
for vfile in list_scripts:
if vfile.startswith(step):
script = os.path.join("tmp/scripts", vfile)
- self.run([script])
+ errorcode, output = self.run([script], ignore_errors=ignore_errors)
+ errorcodes = errorcodes | errorcode
+ return errorcodes
class VirtServ(Chroot):
@@ -2606,6 +2609,11 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
chroot.check_for_no_processes(fail=True)
+ if chroot.run_scripts("is_testable", ignore_errors=True) != 0:
+ logging.info("SKIP: All tests. Package cannot be tested with piuparts: %s.", " ".join(packages))
+ chroot.remove()
+ return True
+
chroot.run_scripts("pre_test")
os.environ["PIUPARTS_PHASE"] = "install"
@@ -3149,7 +3157,12 @@ def process_packages(package_list):
chroot_state["selections"] = chroot.get_selections()
chroot_state["diversions"] = chroot.get_diversions()
- if not settings.no_install_purge_test:
+ testable = True
+ if chroot.run_scripts("is_testable", ignore_errors=True) != 0:
+ logging.info("SKIP: All tests. Package cannot be tested with piuparts: %s.", " ".join(packages))
+ testable = False
+
+ if testable and not settings.no_install_purge_test:
extra_packages = chroot.get_known_packages(settings.extra_old_packages)
if not install_purge_test(chroot, chroot_state,
package_files, packages, extra_packages):
@@ -3157,7 +3170,7 @@ def process_packages(package_list):
panic()
logging.info("PASS: Installation and purging test.")
- if not settings.no_upgrade_test:
+ if testable and not settings.no_upgrade_test:
if not settings.args_are_package_files and not settings.testdebs_repo:
logging.info("Can't test upgrades: -a or --apt option used.")
else:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list