diff --git a/xml/Makefile.am b/xml/Makefile.am index 385d6a9080..313898c6ee 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,98 +1,103 @@ # # 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 xsltdir = $(dtddir) xslt_SCRIPTS = upgrade06.xsl upgrade11.xsl RNGdir = $(dtddir) # See Readme.md for details on updating schema files -RNG_versions = 1.0 1.2 1.3 next +RNG_max = $(firstword $(shell ls -1 *.rng | sed -e 's/.*-//' -e 's/.rng//' | sort -unr)) +RNG_versions = $(shell ls -1 *.rng | sed -e 's/.*-//' -e 's/.rng//' | sort -un) RNG_generated = pacemaker.rng $(foreach base,$(RNG_versions),pacemaker-$(base).rng) RNG_cfg_base = options nodes resources constraints fencing acls RNG_base = cib $(RNG_cfg_base) status versions score rule nvset RNG_files = $(foreach base,$(RNG_base),$(wildcard $(base)*.rng)) RNG_SCRIPTS = $(RNG_files) $(RNG_generated) EXTRA_DIST = best-match.sh best_match = $(shell $(top_srcdir)/xml/best-match.sh $(1) $(2)) +versions: + echo "Max: $(RNG_max)" + echo "Available: $(RNG_versions)" + versions.rng: Makefile.am echo "" > $@ echo "" >> $@ echo " " >> $@ echo " " >> $@ echo " " >> $@ echo " " >> $@ echo " none" >> $@ echo " pacemaker-0.6" >> $@ echo " transitional-0.6" >> $@ echo " pacemaker-0.7" >> $@ echo " pacemaker-1.1" >> $@ for rng in $(RNG_versions); do echo " pacemaker-$$rng" >> $@; done echo " " >> $@ echo " " >> $@ echo " " >> $@ echo " " >> $@ echo " " >> $@ echo " " >> $@ echo " " >> $@ echo "" >> $@ echo "Built $@" -pacemaker.rng: pacemaker-$(CRM_DTD_VERSION).rng +pacemaker.rng: pacemaker-$(RNG_max).rng cp $(top_builddir)/xml/$< $@ pacemaker-%.rng: $(RNG_files) best-match.sh Makefile.am echo "" > $@ echo "" >> $@ echo " " >> $@ echo " " >> $@ $(top_srcdir)/xml/best-match.sh cib $(*) $(@) " " echo " " >> $@ echo " " >> $@ for rng in $(RNG_cfg_base); do $(top_srcdir)/xml/best-match.sh $$rng $(*) $(@) " "; done echo " " >> $@ echo " " >> $@ echo " " >> $@ $(top_srcdir)/xml/best-match.sh status $(*) $(@) " " echo " " >> $@ echo " " >> $@ echo " " >> $@ echo "" >> $@ echo "Built $@" 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" sync: git rm -f $(wildcard *-next.rng) make pacemaker-next.rng clean: rm -f $(RNG_generated) diff --git a/xml/Readme.md b/xml/Readme.md index 126ae902d9..3dc831f9a9 100644 --- a/xml/Readme.md +++ b/xml/Readme.md @@ -1,58 +1,57 @@ # 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 ## The current stable version is determined from the `known_schemas` array in `lib/common/xml.c`. It will be the entry prior to `pacemaker-next` and has the form `pacemaker-${X}.${Y}`. ### Simple Additions When the new syntax is a simple addition to the previous one, create a new entry with `${Y} = ${Yold} + 1` ### Feature Removal or otherwise Incompatible Changes When the new syntax is not a simple addition to the previous one, create a new entry with `${X} = ${Xold} + 1` and `${Y} = 0`. An XSLT file is also required that converts an old syntax to the new one. See `xml/upgrade06.xsl` for an example. ### General Proceedure 1. Copy the most recent version of `${base}-*.rng` to `${base}-${X}.${Y}.rng` 1. Commit the copy, eg. `"Clone the latest ${base} schema in preparation for changes"`. This way the actual change will be included with the creation of the new schema. 1. Modify `${base}-${X}.${Y}.rng` as required -1. Add the new `${X}.${Y}` to `RNG_versions` in `xml/Makefile.am` 1. Add an XSLT file if required and update `xslt_SCRIPTS` in `xml/Makefile.am` 1. Update `known_schemas` in `lib/common/xml.c`, add it prior to the entry for `pacemaker-next`. The second last field of the previous entry needs to be set to `0`. For example: /* 6 */ { 2, "pacemaker-1.2", NULL, NULL, -1, NULL }, /* - */ { 2, "pacemaker-next", NULL, NULL, -1, NULL }, /* Feature playground */ becomes: /* 6 */ { 2, "pacemaker-1.2", NULL, NULL, 0, NULL }, /* 7 */ { 2, "pacemaker-1.3", NULL, NULL, -1, NULL }, /* - */ { 2, "pacemaker-next", NULL, NULL, -1, NULL }, /* Feature playground */ or for an incompatible change: /* 6 */ { 2, "pacemaker-1.2", NULL, "upgrade12.xsl", 0, NULL }, /* 7 */ { 2, "pacemaker-2.0", NULL, NULL, -1, NULL }, /* - */ { 2, "pacemaker-next", NULL, NULL, -1, NULL }, /* Feature playground */ See https://github.com/beekhof/pacemaker/commit/041ba95 and its parent commit for an example. 1. Commit ## Admin Tasks New features will not be available until the admin 1. Updates all the nodes 1. Runs the equivalent of `cibadmin --upgrade`