[Git][NTPsec/ntpsec][master] 2 commits: Provide default subst behavior for manpages

Matt Selsky gitlab at mg.gitlab.com
Mon Jan 15 06:35:22 UTC 2018


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
4e998125 by Richard Laager at 2018-01-14T17:12:16-06:00
Provide default subst behavior for manpages

The manpage build step provides a custom substitution function.
Currently, waf provides no way to chain up to the default beahvior, so
we must copy that code into our custom function.

- - - - -
d91f3fe7 by Richard Laager at 2018-01-14T17:17:29-06:00
Enhance man page header and footer

This adds a section "NTPsec" to the top center of the man pages

It also adds a version to the bottom left.

- - - - -


17 changed files:

- ntpclients/ntpdig-man.txt
- ntpclients/ntpkeygen-man.txt
- ntpclients/ntpleapfetch-man.txt
- ntpclients/ntploggps-man.txt
- ntpclients/ntplogtemp-man.txt
- ntpclients/ntpmon-man.txt
- ntpclients/ntpq-man.txt
- ntpclients/ntpsweep-man.txt
- ntpclients/ntptrace-man.txt
- ntpclients/ntpviz-man.txt
- ntpclients/ntpwait-man.txt
- ntpd/ntp.conf-man.txt
- ntpd/ntp.keys-man.txt
- ntpd/ntpd-man.txt
- ntpfrob/ntpfrob-man.txt
- ntptime/ntptime-man.txt
- wafhelpers/waf.py


Changes:

=====================================
ntpclients/ntpdig-man.txt
=====================================
--- a/ntpclients/ntpdig-man.txt
+++ b/ntpclients/ntpdig-man.txt
@@ -1,5 +1,8 @@
 = ntpdig(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpdig - standard Simple Network Time Protocol client program


=====================================
ntpclients/ntpkeygen-man.txt
=====================================
--- a/ntpclients/ntpkeygen-man.txt
+++ b/ntpclients/ntpkeygen-man.txt
@@ -1,5 +1,8 @@
 = ntpkeygen(8) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpkeygen - create and manage NTP host keys


=====================================
ntpclients/ntpleapfetch-man.txt
=====================================
--- a/ntpclients/ntpleapfetch-man.txt
+++ b/ntpclients/ntpleapfetch-man.txt
@@ -1,5 +1,8 @@
 = ntpleapfetch(8) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME == 
 ntpleapfetch - leap-seconds file manager/updater


=====================================
ntpclients/ntploggps-man.txt
=====================================
--- a/ntpclients/ntploggps-man.txt
+++ b/ntpclients/ntploggps-man.txt
@@ -1,5 +1,8 @@
 = ntploggps(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntploggps - log gpsd data


=====================================
ntpclients/ntplogtemp-man.txt
=====================================
--- a/ntpclients/ntplogtemp-man.txt
+++ b/ntpclients/ntplogtemp-man.txt
@@ -1,5 +1,8 @@
 = ntplogtemp(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntplogtemp - log temperature data


=====================================
ntpclients/ntpmon-man.txt
=====================================
--- a/ntpclients/ntpmon-man.txt
+++ b/ntpclients/ntpmon-man.txt
@@ -1,5 +1,8 @@
 = ntpmon(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpmon - real-time NTP status monitor


=====================================
ntpclients/ntpq-man.txt
=====================================
--- a/ntpclients/ntpq-man.txt
+++ b/ntpclients/ntpq-man.txt
@@ -1,5 +1,8 @@
 = ntpq(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpq - standard NTP query program


=====================================
ntpclients/ntpsweep-man.txt
=====================================
--- a/ntpclients/ntpsweep-man.txt
+++ b/ntpclients/ntpsweep-man.txt
@@ -1,5 +1,8 @@
 = ntpsweep(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpsweep - print various information about given NTP servers


=====================================
ntpclients/ntptrace-man.txt
=====================================
--- a/ntpclients/ntptrace-man.txt
+++ b/ntpclients/ntptrace-man.txt
@@ -1,5 +1,8 @@
 = ntptrace(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntptrace - trace peers of an NTP server


=====================================
ntpclients/ntpviz-man.txt
=====================================
--- a/ntpclients/ntpviz-man.txt
+++ b/ntpclients/ntpviz-man.txt
@@ -1,5 +1,8 @@
 = ntpviz(1) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpviz - make visualizations of offset, jitter, etc. from stats file data


=====================================
ntpclients/ntpwait-man.txt
=====================================
--- a/ntpclients/ntpwait-man.txt
+++ b/ntpclients/ntpwait-man.txt
@@ -1,5 +1,8 @@
 = ntpwait(8) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpwait - wait for ntpd to stabilize the system clock


=====================================
ntpd/ntp.conf-man.txt
=====================================
--- a/ntpd/ntp.conf-man.txt
+++ b/ntpd/ntp.conf-man.txt
@@ -1,5 +1,8 @@
 = ntp.conf(5) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntp.conf - Network Time Protocol (NTP) daemon configuration file format


=====================================
ntpd/ntp.keys-man.txt
=====================================
--- a/ntpd/ntp.keys-man.txt
+++ b/ntpd/ntp.keys-man.txt
@@ -1,5 +1,8 @@
 = ntp.keys(5) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntp.keys - NTP symmetric key file format


=====================================
ntpd/ntpd-man.txt
=====================================
--- a/ntpd/ntpd-man.txt
+++ b/ntpd/ntpd-man.txt
@@ -1,5 +1,8 @@
 = ntpd(8) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpd - Network Time Protocol service daemon


=====================================
ntpfrob/ntpfrob-man.txt
=====================================
--- a/ntpfrob/ntpfrob-man.txt
+++ b/ntpfrob/ntpfrob-man.txt
@@ -1,5 +1,8 @@
 = ntpfrob(8) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntpfrob - frob the clock hardware


=====================================
ntptime/ntptime-man.txt
=====================================
--- a/ntptime/ntptime-man.txt
+++ b/ntptime/ntptime-man.txt
@@ -1,5 +1,8 @@
 = ntptime(8) =
 :doctype: manpage
+:man source: NTPsec
+:man version: @NTPSEC_VERSION@
+:man manual: NTPsec
 
 == NAME ==
 ntptime - read and set kernel time variables


=====================================
wafhelpers/waf.py
=====================================
--- a/wafhelpers/waf.py
+++ b/wafhelpers/waf.py
@@ -1,5 +1,7 @@
+import re
+
 from waflib.Configure import conf
-from waflib.TaskGen import feature, before_method
+from waflib.TaskGen import before_method, feature, re_m4
 
 
 @before_method('apply_incpaths')
@@ -16,8 +18,39 @@ def insert_srcdir(self):
     self.includes += ["%s/include" % srcnode]
 
 
-def manpage_subst_fun(task, text):
-    return text.replace("include::../docs/", "include::../../../docs/")
+def manpage_subst_fun(self, code):
+    # Since we are providing a custom substitution method, we must implement
+    # the default behavior, since we want that too.
+    global re_m4
+
+    # replace all % by %% to prevent errors by % signs
+    code = code.replace('%', '%%')
+
+    # extract the vars foo into lst and replace @foo@ by %(foo)s
+    lst = []
+    def repl(match):
+        g = match.group
+        if g(1):
+            lst.append(g(1))
+            return "%%(%s)s" % g(1)
+        return ''
+    code = getattr(self.generator, 're_m4', re_m4).sub(repl, code)
+
+    try:
+        d = self.generator.dct
+    except AttributeError:
+        d = {}
+        for x in lst:
+            tmp = getattr(self.generator, x, '') or self.env[x] or self.env[x.upper()]
+            try:
+                tmp = ''.join(tmp)
+            except TypeError:
+                tmp = str(tmp)
+            d[x] = tmp
+
+    code = code % d
+
+    return code.replace("include::../docs/", "include::../../../docs/")
 
 
 @conf



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/e6082da9a9ff0aa183fb83c73a87f81098febd00...d91f3fe76a7a10dd72b85acf36fd5f2598c98634

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/e6082da9a9ff0aa183fb83c73a87f81098febd00...d91f3fe76a7a10dd72b85acf36fd5f2598c98634
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180115/4d50684b/attachment.html>


More information about the vc mailing list