[master] 0c74d1b99 Implement a better solution: Prefer a single quoted token for $Module description, and suggest people to do it that way.

Poul-Henning Kamp phk at FreeBSD.org
Tue Nov 27 23:32:08 UTC 2018


commit 0c74d1b99f1f43fc99725fe14322760afa7858ee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 27 22:17:39 2018 +0000

    Implement a better solution:  Prefer a single quoted token for
    $Module description, and suggest people to do it that way.

diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index dd0e9f4dc..0184e5f24 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -120,6 +120,15 @@ CTYPES.update(PRIVS)
 
 #######################################################################
 
+def is_quoted(str):
+    return len(str) > 2 and str[0] == str[-1] and str[0] in ('"', "'")
+
+def unquote(str):
+    assert is_quoted(str)
+    return str[1:-1]
+
+#######################################################################
+
 
 def write_file_warning(fo, a, b, c):
     fo.write(a + "\n")
@@ -600,9 +609,11 @@ class s_module(stanza):
         a = self.line[1].split(None, 2)
         self.vcc.modname = self.toks[1]
         self.vcc.mansection = self.toks[2]
-        # XXX: Find better solution for moddesc
-        self.vcc.moddesc = " ".join(self.toks[2:])
-        self.vcc.moddesc = a[2]
+        if len(self.toks) == 4 and is_quoted(self.toks[3]):
+            self.vcc.moddesc = unquote(self.toks[3])
+        else:
+            print("\nNOTICE: Please put $Module description in quotes.\n")
+            self.vcc.moddesc = " ".join(self.toks[3:])
         self.rstlbl = "vmod_%s(%s)" % (
             self.vcc.modname,
             self.vcc.mansection
diff --git a/lib/libvmod_blob/vmod.vcc b/lib/libvmod_blob/vmod.vcc
index a6514dd2e..1ea3716d4 100644
--- a/lib/libvmod_blob/vmod.vcc
+++ b/lib/libvmod_blob/vmod.vcc
@@ -6,7 +6,7 @@
 #          Geoffrey Simmons <geoffrey.simmons at uplex.de>
 #
 
-$Module blob 3 utilities for the VCL blob type
+$Module blob 3 "Utilities for the VCL blob type"
 
 $ABI strict
 
diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc
index 590971aa1..c4c221a3f 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -26,7 +26,7 @@
 # SUCH DAMAGE.
 #
 
-$Module debug 3 Development, test and debug
+$Module debug 3 "Development, test and debug"
 $ABI strict
 $Prefix xyzzy
 DESCRIPTION
diff --git a/lib/libvmod_directors/vmod.vcc b/lib/libvmod_directors/vmod.vcc
index 8fecc08e7..54b111fba 100644
--- a/lib/libvmod_directors/vmod.vcc
+++ b/lib/libvmod_directors/vmod.vcc
@@ -32,7 +32,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-$Module directors 3 Varnish Directors Module
+$Module directors 3 "Varnish Directors Module"
 $ABI strict
 
 DESCRIPTION
diff --git a/lib/libvmod_proxy/vmod.vcc b/lib/libvmod_proxy/vmod.vcc
index d986b5295..34b1199b2 100644
--- a/lib/libvmod_proxy/vmod.vcc
+++ b/lib/libvmod_proxy/vmod.vcc
@@ -25,7 +25,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-$Module proxy 3 Varnish Module to extract TLV attributes from PROXYv2
+$Module proxy 3 "Varnish Module to extract TLV attributes from PROXYv2"
 $ABI strict
 
 DESCRIPTION
diff --git a/lib/libvmod_purge/vmod.vcc b/lib/libvmod_purge/vmod.vcc
index 25a9cb801..e158aac69 100644
--- a/lib/libvmod_purge/vmod.vcc
+++ b/lib/libvmod_purge/vmod.vcc
@@ -25,7 +25,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-$Module purge 3 Varnish Purge Module
+$Module purge 3 "Varnish Purge Module"
 $ABI strict
 
 DESCRIPTION
diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc
index c30172ed1..fc5ef3736 100644
--- a/lib/libvmod_std/vmod.vcc
+++ b/lib/libvmod_std/vmod.vcc
@@ -25,7 +25,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-$Module std 3 Varnish Standard Module
+$Module std 3 "Varnish Standard Module"
 $ABI strict
 
 DESCRIPTION
diff --git a/lib/libvmod_unix/vmod.vcc b/lib/libvmod_unix/vmod.vcc
index e70a092d3..e227e9f99 100644
--- a/lib/libvmod_unix/vmod.vcc
+++ b/lib/libvmod_unix/vmod.vcc
@@ -5,7 +5,7 @@
 # Authors: Geoffrey Simmons <geoffrey.simmons at uplex.de>
 #
 
-$Module unix 3 utilities for Unix domain sockets
+$Module unix 3 "Utilities for Unix domain sockets"
 
 $ABI strict
 
diff --git a/lib/libvmod_vtc/vmod.vcc b/lib/libvmod_vtc/vmod.vcc
index c521f37da..94f8f75b6 100644
--- a/lib/libvmod_vtc/vmod.vcc
+++ b/lib/libvmod_vtc/vmod.vcc
@@ -25,7 +25,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 
-$Module vtc 3 Utility module for varnishtest
+$Module vtc 3 "Utility module for varnishtest"
 $ABI strict
 
 DESCRIPTION


More information about the varnish-commit mailing list