diff --git a/xml/Makefile.am b/xml/Makefile.am index d4ffdfa22c..e9cd875ca1 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,59 +1,72 @@ # # Copyright (C) 2004 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in - dtddir = $(CRM_DTD_DIRECTORY) +dtd_SCRIPTS = crm.dtd crm-transitional.dtd -VERSIONED_RNG_FILES = pacemaker.rng constraints.rng resources.rng acls.rng - -RNG_FILES_10 = $(foreach rng,pacemaker constraints resources,$(rng)-1.0.rng) -RNG_FILES_12 = $(foreach rng,pacemaker cib options nodes resources constraints fencing acls status,$(rng)-1.2.rng) -RNG_FILES = $(RNG_FILES_10) $(RNG_FILES_12) \ - $(VERSIONED_RNG_FILES:%.rng=%-next.rng) \ - pacemaker.rng versions.rng score.rng rule.rng nvset.rng +schema_VERSIONS = 1.2 next +schema_GENERATED = pacemaker.rng $(foreach base,$(schema_VERSIONS),pacemaker-$(base).rng) -EXTRA_DIST = crm-1.0.dtd $(dtd_SCRIPTS) -dtd_SCRIPTS = crm.dtd $(RNG_FILES) upgrade06.xsl upgrade11.xsl crm-transitional.dtd +schemadir = $(CRM_DTD_DIRECTORY) +RNG_cfg_files = options nodes resources constraints fencing acls unused +RNG_files = cib $(RNG_cfg_files) status versions score rule nvset +schema_SCRIPTS = $(foreach base,$(RNG_files),$(wildcard $(base)*.rng)) $(schema_GENERATED) \ + pacemaker-1.0.rng upgrade06.xsl upgrade11.xsl -NEXT ?= $(shell echo $(CRM_DTD_VERSION) | awk -F. '/[0-9]+\./{$$2+=1;OFS=".";print $$1,$$2}') +EXTRA_DIST = $(schema_SCRIPTS) $(dtd_SCRIPTS) -next: - echo $(NEXT) +# See Readme.md for details on updating schema files -diff: - for c in `ls -1 *-$(CRM_DTD_VERSION).rng | sed 's/-$(CRM_DTD_VERSION).rng//'`; do diff -u $$c-$(CRM_DTD_VERSION).rng $$c-next.rng ; done +best_match = $(shell $(top_srcdir)/xml/best-match.sh $(1) $(2)) -clone: - for c in `ls -1 *-$(CRM_DTD_VERSION).rng | sed 's/-$(CRM_DTD_VERSION).rng//'`; do cp $$c-$(CRM_DTD_VERSION).rng $$c-$(NEXT).rng; sed -i 's/$(CRM_DTD_VERSION).rng/$(NEXT).rng/g' $$c-$(NEXT).rng; git add $$c-$(NEXT).rng ; done +pacemaker.rng: pacemaker-$(CRM_DTD_VERSION).rng + cp $(top_builddir)/xml/$< $@ -sync: - for c in `ls -1 *-$(CRM_DTD_VERSION).rng | sed 's/-$(CRM_DTD_VERSION).rng//'`; do cp $$c-$(CRM_DTD_VERSION).rng $$c-next.rng; sed -i 's/$(CRM_DTD_VERSION).rng/next.rng/g' $$c-next.rng; git add $$c-next.rng ; done +pacemaker-%.rng: + echo "" > $@ + echo "" >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo -e " "$(foreach rng,$(RNG_cfg_files)," \n") >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo " " >> $@ + echo "" >> $@ -# Fake versioned subschemas not used by anything... -acls-1.0.rng: - touch $@ + echo "Created $@" -crm.dtd: crm-1.0.dtd - cp $(top_srcdir)/xml/crm-1.0.dtd crm.dtd +rng_next = $(shell echo $(wildcard *-next.rng) | sed 's/-next.rng//g') +diff: + echo "Comparing changes to: $(rng_next)" + for rng in $(rng_next); do echo "### $${rng}"; diff -u $${rng}-$(CRM_DTD_VERSION).rng $${rng}-next.rng; done + echo "Done" -pacemaker.rng: pacemaker-$(CRM_DTD_VERSION).rng - cp $(top_builddir)/xml/$< $@ +sync: + git rm -f $(wildcard *-next.rng) + make pacemaker-next.rng clean: - rm -f crm.dtd pacemaker.rng + rm -f $(schema_GENERATED) diff --git a/xml/Readme.md b/xml/Readme.md new file mode 100644 index 0000000000..1b25bcc7a7 --- /dev/null +++ b/xml/Readme.md @@ -0,0 +1,16 @@ + +# Updating schema files # + +## Experimental features ## + +Experimental features go into `${base}-next.rng` + +Create from the most recent `${base}-${X}.${Y}.rng` if it does not already exist + +## Stable features ## + +For stable features, copy the most recent version to `${base}-${X}.${Y}.rng` + +Bump `${X}` for removals, bump `${Y}` for additions and update `CRM_DTD_VERSION` in `configure.ac` + + diff --git a/xml/acls-1.2.rng b/xml/acls-1.2.rng index 22cc6310e8..4be040509d 100644 --- a/xml/acls-1.2.rng +++ b/xml/acls-1.2.rng @@ -1,66 +1,68 @@ + + diff --git a/xml/acls-next.rng b/xml/acls-next.rng deleted file mode 100644 index 22cc6310e8..0000000000 --- a/xml/acls-next.rng +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml/best-match.sh b/xml/best-match.sh new file mode 100755 index 0000000000..f6e3dc8a5a --- /dev/null +++ b/xml/best-match.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +base=$1; shift +target=$1; shift +best="0.0" +candidates=$(ls -1 ${base}-*.rng 2>/dev/null) +for rng in $candidates; do + case $rng in + ${base}-${target}.rng) + echo $rng + exit + ;; + *next*) + : skipping $rng + ;; + *) + v=$(echo $rng | sed -e "s/${base}-//" -e 's/.rng//') + : comparing $v with $target + + rc=$(echo "$v > ${best}" | bc) + if [ $rc = 1 ]; then + : $v beats the previous ${best} for $target + if [ ${target} = next ]; then + best=$v + else + rc=$(echo "$v < ${target}" | bc) + if [ $rc = 1 ]; then + : $v is still less than $target, using + best=$v + fi + fi + fi + ;; + esac +done +if [ "x${best}" != "x0.0" ]; then + echo ${base}-${best}.rng +else + echo "empty.rng" +fi diff --git a/xml/constraints-1.2.rng b/xml/constraints-1.2.rng index 35756f0119..85fcf48b20 100644 --- a/xml/constraints-1.2.rng +++ b/xml/constraints-1.2.rng @@ -1,226 +1,228 @@ + + stop demote fence freeze start promote demote stop Stopped Started Master Slave Optional Mandatory Serialize diff --git a/xml/constraints-next.rng b/xml/constraints-next.rng index fff0fb7a03..9e866dd19b 100644 --- a/xml/constraints-next.rng +++ b/xml/constraints-next.rng @@ -1,246 +1,248 @@ + + stop demote fence freeze start promote demote stop Stopped Started Master Slave Optional Mandatory Serialize diff --git a/xml/crm-1.0.dtd b/xml/crm.dtd similarity index 100% rename from xml/crm-1.0.dtd rename to xml/crm.dtd diff --git a/xml/fencing-1.2.rng b/xml/fencing-1.2.rng index 87de5a8b05..c173cecaab 100644 --- a/xml/fencing-1.2.rng +++ b/xml/fencing-1.2.rng @@ -1,29 +1,31 @@ + + ([a-zA-Z0-9_\.\-]+)(,[a-zA-Z0-9_\.\-]+)* diff --git a/xml/nodes-1.2.rng b/xml/nodes-1.2.rng index d82f68711c..28dae6262e 100644 --- a/xml/nodes-1.2.rng +++ b/xml/nodes-1.2.rng @@ -1,42 +1,44 @@ + normal member ping + diff --git a/xml/pacemaker-1.2.rng b/xml/pacemaker-1.2.rng deleted file mode 100644 index dc88069f33..0000000000 --- a/xml/pacemaker-1.2.rng +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml/pacemaker-next.rng b/xml/pacemaker-next.rng deleted file mode 100644 index b02c109149..0000000000 --- a/xml/pacemaker-next.rng +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - normal - member - ping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml/resources-1.2.rng b/xml/resources-1.2.rng index 81a8f824a8..7e941399fa 100644 --- a/xml/resources-1.2.rng +++ b/xml/resources-1.2.rng @@ -1,225 +1,227 @@ + + ocf lsb heartbeat stonith upstart service systemd nagios ocf lsb heartbeat stonith upstart Stopped Started Slave Master nothing quorum fencing ignore block stop restart standby fence restart-container diff --git a/xml/resources-next.rng b/xml/resources-next.rng deleted file mode 100644 index 81a8f824a8..0000000000 --- a/xml/resources-next.rng +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - ocf - - - - - lsb - heartbeat - stonith - upstart - service - systemd - nagios - - - - - - - - - - - - - - - - - - - - - - - - - - - - ocf - - - - - lsb - heartbeat - stonith - upstart - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Stopped - Started - Slave - Master - - - - - - - nothing - quorum - fencing - - - - - - - ignore - block - stop - restart - standby - fence - restart-container - - - - - - - - - - -