[sagemath] 01/01: Split arch-dep vs arch-indep build and test targets more efficiently

Ximin Luo infinity0 at debian.org
Fri Aug 11 07:51:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository sagemath.

commit 02582988b0d6861b868f767a5bcec96a3f1eda0a
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Aug 11 09:50:06 2017 +0200

    Split arch-dep vs arch-indep build and test targets more efficiently
    
    This is needed because the docbuild is properly failing due to OOM on 32-bit
    buildds, despite our attempts to ignore such errors.
---
 debian/changelog |  1 +
 debian/rules     | 85 ++++++++++++++++++++++++++++----------------------------
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1891c09..ed6eb58 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -41,6 +41,7 @@ sagemath (8.0-0~sage1) UNRELEASED; urgency=medium
 
   [ Ximin Luo ]
   * Update to latest Standards-Version; no changes required.
+  * Split arch-dep vs arch-indep build and test targets more efficiently.
 
  -- Tobias Hansen <thansen at debian.org>  Mon, 24 Jul 2017 21:11:28 +0100
 
diff --git a/debian/rules b/debian/rules
index 9194f76..d807bac 100755
--- a/debian/rules
+++ b/debian/rules
@@ -81,54 +81,56 @@ prune: debian/control
 	cd sage && python ../debian/pruner/pruner.py || $(is_prerelease)
 	touch prune
 
-ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
-DEB_BUILD_TARGET = build
-else
-DEB_BUILD_TARGET = all
-endif
-dh_auto_build-stamp: prune
+run_build = \
 	MAKE='make -j$(NUMJOBS)' PREREQ_OPTIONS="--prefix=$(SAGE_LOCAL)" \
-	  $(MAKE) --directory=sage $(DEB_BUILD_TARGET)
-	touch dh_auto_build-stamp
+	  $(MAKE) --directory=sage
 
-check-dochtml-log:
-	# Sometimes, parts of the docbuild fail with MemoryError or OSError but
-	# Sage doesn't detect this. Here we detect it and fail the build if so.
-	# Also filter out some false positives that are not hard errors.
-	! (grep Error sage/logs/dochtml.log | grep -v "citation not found: .*Error.*")
+override_dh_auto_configure: prune
 
-# We build everything in both -arch and -indep because the tests need the docs.
-# TODO: as described in #849150, we can make this more efficient if we figure
-# out how to disable the tests that need the docs.
-override_dh_auto_build-arch: dh_auto_build-stamp
-# Only run check-dochtml-log if we will actually build the doc packages.
-# Otherwise we get spurious failures on some low-memory arch-any buildds.
-override_dh_auto_build-indep: dh_auto_build-stamp check-dochtml-log
-
-LOGFILE = sage/logs/ptestlong.log
-run_tests = cd sage && ./sage -t -p $(NUMJOBS) --all --long --logfile=logs/ptestlong.log
-override_dh_auto_test:
+override_dh_auto_build-arch:
+	$(run_build) build
 	cd sage && src/bin/sage-starts
-ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	# We do the below instead of `$(MAKE) --directory=sage ptestlong` because
-	# it has a bug where it can't detect a previous successful build. So it
-	# will try to rebuild some sagelib files, then the docbuild, then those
-	# files again, even after a "make all" that was previously successful. This
-	# is not incorrect, but is a massive waste of time. OTOH debhelper is able
-	# to detect a previous successful (override_)dh_auto_build, so if we run
-	# `debian/rules build` twice it will go directly to (override_)dh_auto_test
-	# (and then this target) without trying (override_)dh_auto_build again.
-	$(run_tests) || true
-	# If tests fail but not by too many more, then retry them once not in parallel
-	# i386 seems to have issues running parallel tests - TODO: investigate this in more detail
+
+override_dh_auto_build-indep:
+ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
+	$(run_build) doc
+endif
+
+run_tests = \
+	cd sage && ./sage -t -p $(NUMJOBS) --long --logfile=logs/ptestlong-$(1).log $(2)
+# If tests fail but not by too many more, then retry them once not in parallel
+# i386 seems to have issues running parallel tests - TODO: investigate this in more detail
+check_test_log = debian/rules -s LOGFILE=sage/logs/ptestlong-$(1).log
+run_tests_with_retry = \
+	$(run_tests); \
 	if $(is_prerelease); then :; \
-	elif debian/rules -s had-few-failures; then :; else \
-	  debian/rules -s had-not-too-many-failures && \
-	  mv $(LOGFILE) $(LOGFILE).1 && \
-	  { $(run_tests) -f -p 1; cd "$(CURDIR)" && debian/rules -s had-few-failures; }; \
+	elif check_test_log had-few-failures; then :; else \
+	  check_test_log had-not-too-many-failures && \
+	  mv sage/logs/ptestlong-$(1).log sage/logs/ptestlong-$(1).log.1 && \
+	  { $(run_tests) -p 1 -f; cd "$(CURDIR)" && check_test_log had-few-failures; }; \
 	fi
+
+override_dh_auto_test-arch:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	$(call run_tests_with_retry,arch,src/sage /usr/lib/python2.7/dist-packages/sagenb/)
 endif
 
+override_dh_auto_test-indep:
+ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	# These tests never fail so don't bother with the retry logic
+	$(call run_tests,indep,src/doc)
+	# Sometimes, parts of the docbuild fail with MemoryError or OSError but
+	# Sage doesn't detect this. Here we detect it and fail the build if so.
+	# Also filter out some false positives that are not hard errors.
+	! (grep Error sage/logs/dochtml.log | grep -v "citation not found: .*Error.*")
+endif
+endif
+
+# manual target to re-run only failed tests
+check-failed:
+	$(call run_tests,all,--all -f)
+
 TESTS_MK = $(MAKE) -s --no-print-directory -f debian/tests.mk LOGFILE=$(LOGFILE)
 failed-tests%:
 	@$(TESTS_MK) "$@"
@@ -147,9 +149,6 @@ had-not-too-many-failures:
 	test -f $(LOGFILE)
 	test "$$($(TESTS_MK) failed-tests-total-normal)" -lt 80
 
-check-failed:
-	$(run_tests) -f
-
 override_dh_auto_install:
 	rm -rf debian/build/usr/var/tmp/sage/build
 # We built .pyo to make the docbuild/tests go faster, but as per Debian policy

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list