diff --git a/buildSrc/src/main/groovy/GenerateDataFromManPages.groovy b/buildSrc/src/main/groovy/GenerateDataFromManPages.groovy index 4a59a592..badffceb 100644 --- a/buildSrc/src/main/groovy/GenerateDataFromManPages.groovy +++ b/buildSrc/src/main/groovy/GenerateDataFromManPages.groovy @@ -5,13 +5,17 @@ import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.Internal import org.w3c.dom.Document +import org.w3c.dom.Element import org.w3c.dom.Node import org.w3c.dom.NodeList import org.w3c.dom.ls.DOMImplementationLS +import org.w3c.dom.ls.LSParser import org.w3c.dom.ls.LSSerializer +import org.xml.sax.InputSource import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory +import javax.xml.transform.OutputKeys import javax.xml.transform.Transformer import javax.xml.transform.TransformerFactory import javax.xml.transform.dom.DOMSource @@ -20,6 +24,7 @@ import javax.xml.transform.stream.StreamSource import javax.xml.xpath.XPath import javax.xml.xpath.XPathConstants import javax.xml.xpath.XPathFactory +import java.util.concurrent.ConcurrentHashMap import java.util.regex.Matcher /** @@ -129,8 +134,116 @@ class GenerateDataFromManPages extends DefaultTask { '[Files] Section Options' : ['Files'], '[Network] Section Options': ['Network'], ] - ]] - + ]], + //cat systemd.netdev.xml | grep "Section Options" | sed -e "s/
" + keyName + " in section " + sectionName + " is not officially supported.
" - + "More information is available here") + if (!html) String.format( + "'%s' in section '%s' is not officially supported", + keyName, + sectionName + ) else ("
" + keyName + " in section " + sectionName + " is not officially supported.
" + "More information is available here") } "moved" -> { val newKeyName = StringUtil.notNullize(options.replacedWithKey, keyName) val newSectionName = StringUtil.notNullize(options.replacedWithSection, sectionName) - val semanticsNote = if (!html) "" else ("
NOTE: The semantics of the new value may not match the existing value.
" - + "More information is available here") + val semanticsNote = if (!html) "" else ("
NOTE: The semantics of the new value may not match the existing value.
" + "More information is available here") if (newSectionName == sectionName) { LOG.assertTrue(newKeyName != keyName, String.format("Meaningless move/rename of %s.%s", sectionName, keyName)) return if (!html) { String.format("'%s' in section '%s' has been renamed to '%s'", keyName, sectionName, newKeyName) - } else ("
The key " + keyName + " in section " + sectionName + " has been renamed to " - + "" + newKeyName + "" + semanticsNote) + } else ("
The key " + keyName + " in section " + sectionName + " has been renamed to " + "" + newKeyName + "" + semanticsNote) } if (newKeyName == keyName) { return if (!html) { String.format("'%s' has been moved to section '%s'", keyName, newSectionName) - } else ("
The key " + keyName + " in section " + sectionName + " has been moved to " - + "section " + newSectionName + "" + semanticsNote) + } else ("
The key " + keyName + " in section " + sectionName + " has been moved to " + "section " + newSectionName + "" + semanticsNote) } if (!html) { String.format("'%s' in section '%s' has been moved to '%s' in section '%s'", keyName, sectionName, newKeyName, newSectionName) - } else ("
The key " + keyName + " in section " + sectionName + " has been moved to " - + "" + newKeyName + " in section " + newSectionName + "" - + semanticsNote) + } else ("
The key " + keyName + " in section " + sectionName + " has been moved to " + "" + newKeyName + " in section " + newSectionName + "" + semanticsNote)
}
"manual" -> {
@@ -423,7 +634,7 @@ unit types. These options are documented in {
- val completeSections = when(getUnitType(fileName)) {
- "Automount" -> setOf("Unit", "Install", "Automount")
+ val completeSections = when (getUnitType(fileName)) {
+ "Automount" -> setOf("Unit", "Install", "Automount")
"Device", "Target" -> setOf("Unit", "Install")
- "Mount" -> setOf("Unit", "Install", "Mount")
+ "Mount" -> setOf("Unit", "Install", "Mount")
"Path" -> setOf("Unit", "Install", "Path")
"Service" -> setOf("Unit", "Install", "Service")
"Slice" -> setOf("Unit", "Install", "Slice")
"Socket" -> setOf("Unit", "Install", "Socket")
- "Swap" -> setOf("Unit", "Install", "Swap")
+ "Swap" -> setOf("Unit", "Install", "Swap")
"Timer" -> setOf("Unit", "Install", "Timer")
"Nspawn" -> setOf("Exec", "Files", "Network")
+ "Network" -> setOf(
+ "Address", "BandMultiQueueing", "BFIFO", "Bridge", "BridgeFDB", "BridgeMDB", "BridgeVLAN", "CAKE", "CAN", "ClassfulMultiQueueing", "ControlledDelay", "DeficitRoundRobinScheduler", "DeficitRoundRobinSchedulerClass", "DHCPPrefixDelegation", "DHCPServer",
+ "DHCPServerStaticLease", "DHCPv4", "DHCPv6", "EnhancedTransmissionSelection", "FairQueueing", "FairQueueingControlledDelay", "FlowQueuePIE", "GenericRandomEarlyDetection", "HeavyHitterFilter", "HierarchyTokenBucket", "HierarchyTokenBucketClass",
+ "IPoIB", "IPv6AcceptRA", "IPv6AddressLabel", "IPv6PREF64Prefix", "IPv6Prefix", "IPv6RoutePrefix", "IPv6SendRA", "Link", "LLDP", "Match", "Neighbor",
+ "Network", "NetworkEmulator", "NextHop", "PFIFO", "PFIFOFast", "PFIFOHeadDrop", "PIE", "QDisc", "QuickFairQueueing",
+ "QuickFairQueueingClass", "Route", "RoutingPolicyRule", "StochasticFairBlue", "StochasticFairnessQueueing", "TokenBucketFilter", "TrivialLinkEqualizer",
+ )
+ "Link" -> setOf(
+ "Link", "Match", "SR-IOV",
+ )
+ "Netdev" -> setOf(
+ "BareUDP", "BatmanAdvanced", "Bond", "Bridge", "FooOverUDP", "GENEVE", "IPoIB", "IPVLAN", "IPVTAP",
+ "L2TP", "L2TPSession", "MACsec", "MACsecReceiveAssociation", "MACsecReceiveChannel", "MACsecTransmitAssociation", "MACVLAN",
+ "MACVTAP", "Match", "NetDev", "Peer", "Tap", "Tun", "Tunnel", "VLAN",
+ "VRF", "VXCAN", "VXLAN", "WireGuard", "WireGuardPeer", "WLAN", "Xfrm", "NetDev"
+ )
else -> setOf()
}
@@ -495,23 +722,20 @@ unit types. These options are documented in
- setOf("Unit.SuccessAction", "Service.ExecStart", "Service.ExecStop")
- "Path" ->
- setOf("Path.PathExists", "Path.PathExistsGlob", "Path.PathChanged", "Path.PathModified", "Path.DirectoryNotEmpty")
- "Timer" ->
- setOf("Timer.OnActiveSec", "Timer.OnBootSec", "Timer.OnStartupSec", "Timer.OnUnitActiveSec", "Timer.OnUnitInactiveSec", "Timer.OnCalendar", "Timer.OnClockChange", "Timer.OnTimezoneChange")
- "Swap" ->
- setOf("Swap.What")
- "Mount" ->
- // Both of these are required, but we only error out on one :(
+ return when (unitType) {
+ "Service" -> setOf("Unit.SuccessAction", "Service.ExecStart", "Service.ExecStop")
+ "Path" -> setOf("Path.PathExists", "Path.PathExistsGlob", "Path.PathChanged", "Path.PathModified", "Path.DirectoryNotEmpty")
+ "Timer" -> setOf("Timer.OnActiveSec", "Timer.OnBootSec", "Timer.OnStartupSec", "Timer.OnUnitActiveSec", "Timer.OnUnitInactiveSec", "Timer.OnCalendar", "Timer.OnClockChange", "Timer.OnTimezoneChange")
+ "Swap" -> setOf("Swap.What")
+ "Mount" -> // Both of these are required, but we only error out on one :(
// systemd-analyze only complains about what though, so ... we can ignore it until a bug comes.
setOf("Mount.What", "Mount.Where")
- "Socket" ->
- setOf("Socket.ListenStream", "Socket.ListenDatagram", "Socket.ListenSequentialPacket", "Socket.ListenFIFO", "Socket.ListenSpecial", "Socket.ListenNetlink", "Socket.ListenMessageQueue", "Socket.ListenUSBFunction")
- "Automount" ->
- setOf("Automount.Where")
+
+ "Socket" -> setOf("Socket.ListenStream", "Socket.ListenDatagram", "Socket.ListenSequentialPacket", "Socket.ListenFIFO", "Socket.ListenSpecial", "Socket.ListenNetlink", "Socket.ListenMessageQueue", "Socket.ListenUSBFunction")
+ "Automount" -> setOf("Automount.Where") // NSpawn?
+ // Network
+ // Link
+ // NetDev
else -> setOf()
}
@@ -520,7 +744,7 @@ unit types. These options are documented in [a-zA-Z0-9_-]+)\.(?