[master] e10d234 Relax the vmod abi check if we are not in master

Federico G. Schwindt fgsch at lodoss.net
Thu Sep 4 20:20:50 CEST 2014


commit e10d234cfea61acbdbc8a56e8ed6450850dd051c
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu Sep 4 19:14:22 2014 +0100

    Relax the vmod abi check if we are not in master
    
    For master we retain the more strict check in case we forget to bump
    the API version as discussed on irc.  Implementation idea from scoof.
    
    Fixes #1538

diff --git a/include/Makefile.am b/include/Makefile.am
index 766eb9a..09c237d 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -96,6 +96,7 @@ MAINTAINERCLEANFILES = vcs_version.h
 vcs_version.h: FORCE
 	@if [ -d "$(top_srcdir)/.git" ]; then \
 		V="$$(git show -s --pretty=format:%h)" \
+		B="$$(git rev-parse --abbrev-ref HEAD)" \
 		H="$$(head -n 1 vcs_version.h 2>/dev/null || true)"; \
 		if [ "/* $$V */" != "$$H" ]; then \
 		( \
@@ -108,7 +109,8 @@ vcs_version.h: FORCE
 		  echo ' */' ;\
 		  echo "/* $$V */" ;\
 		  echo '' ;\
-		  echo "#define VCS_Version \"$$V\"" \
+		  echo "#define VCS_Version \"$$V\"" ; \
+		  echo "#define VCS_Branch \"$$B\"" \
 		) > vcs_version.h ; \
 		fi \
 	else \
@@ -116,7 +118,8 @@ vcs_version.h: FORCE
 		( \
 		  echo "/* NOGIT */" ; \
 		  echo '/* No git commit ID available, see include/Makefile.am for explanation */' ; \
-		  echo '#define VCS_Version "NOGIT"' \
+		  echo '#define VCS_Version "NOGIT"' ; \
+		  echo '#define VCS_Branch "NOGIT"' \
 		) >  vcs_version.h ; \
 		fi \
 	fi
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index 4f139de..7644621 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -34,6 +34,8 @@
 
 #include "vcc_compile.h"
 
+#include "vcs_version.h"
+
 #include "vmod_abi.h"
 #include "vrt.h"
 
@@ -123,6 +125,15 @@ vcc_ParseImport(struct vcc *tl)
 		vcc_ErrWhere(tl, mod);
 		return;
 	}
+	if (strcmp(VCS_Branch, "master") == 0 &&
+	    strcmp(vmd->abi, VMOD_ABI_Version) != 0) {
+		VSB_printf(tl->sb, "Incompatible VMOD %.*s\n", PF(mod));
+		VSB_printf(tl->sb, "\tFile name: %s\n", fn);
+		VSB_printf(tl->sb, "\tABI mismatch, expected <%s>, got <%s>\n",
+			   VMOD_ABI_Version, vmd->abi);
+		vcc_ErrWhere(tl, mod);
+		return;
+	}
 	if (vmd->vrt_major != VRT_MAJOR_VERSION ||
 	    vmd->vrt_minor > VRT_MINOR_VERSION) {
 		VSB_printf(tl->sb, "Incompatible VMOD %.*s\n", PF(mod));
@@ -154,15 +165,6 @@ vcc_ParseImport(struct vcc *tl)
 		return;
 	}
 
-	if (strcmp(vmd->abi, VMOD_ABI_Version) != 0) {
-		VSB_printf(tl->sb, "Incompatible VMOD %.*s\n", PF(mod));
-		VSB_printf(tl->sb, "\tFile name: %s\n", fn);
-		VSB_printf(tl->sb, "\tABI mismatch, expected <%s>, got <%s>\n",
-			   VMOD_ABI_Version, vmd->abi);
-		vcc_ErrWhere(tl, mod);
-		return;
-	}
-
 	ifp = New_IniFin(tl);
 
 	VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(&VGC_vmod_%.*s,\n", PF(mod));



More information about the varnish-commit mailing list