[PATCH] maint: make syntax-check default to a no-op on maint branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maintenance branches cherry-pick some, but not all patches, and
sometimes in different order, which means that 'make syntax-check'
is likely to fail for hard-to-predict reasons.  Yet having a
common workflow makes it easier to switch between branches.  This
patch sets up a filter so that 'make syntax-check' is a no-op
other than to print a warning if it detects that the user is
running in a git checkout that branches from some place earlier
than origin; 'make -k syntax-check force-syntax-check=1' can be
used to override the heuristics.

Tested on master (no change in behavior) and v1.1.2-maint (where
the syntax check was indeed suppressed).  Based on a report by
Cole Robinson.

* cfg.mk (syntax-check): Add some conditional filtering.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---

If approved, I'll backport this to all the v*-maint branches.

 cfg.mk | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/cfg.mk b/cfg.mk
index dad8a90..47709b5 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -88,6 +88,24 @@ else
 distdir: sc_vulnerable_makefile_CVE-2012-3386.z
 endif

+# If it looks like we are on a maintenance branch (that is, if our
+# merge point with origin is somewhere other than origin), then
+# skip syntax checks by default.  When backporting only a subset of
+# patches, it's difficult, if not impossible, to have syntax-check
+# pass by default.  Borrows some ideas from public-submodule-commit.
+ifeq ($(filter syntax-check, $(MAKECMDGOALS))$(MAKELEVEL),syntax-check0)
+  ifneq ($(shell if test -d $(srcdir)/.git; then		\
+	   cd $(srcdir) && git rev-parse origin; fi),		\
+         $(shell if test -d $(srcdir)/.git; then		\
+           cd $(srcdir) && git merge-base origin HEAD; fi))
+    ifeq ($(force-syntax-check),)
+      $(info warning: it looks like you are on a maint branch; to force, use:)
+      $(info $(NULL)  make -k syntax-check force-syntax-check=1)
+      local-checks-to-skip += $(syntax-check-rules)
+    endif
+  endif
+endif
+
 # Files that should never cause syntax check failures.
 VC_LIST_ALWAYS_EXCLUDE_REGEX = \
   (^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]