diff --git a/xml/Makefile.am b/xml/Makefile.am index a73abef951..12ae9ba5a4 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,76 +1,75 @@ # # 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 next 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) -# Needed? -EXTRA_DIST = $(RNG_SCRIPTS) $(dtd_SCRIPTS) $(xslt_SCRIPTS) +EXTRA_DIST = best-match.sh best_match = $(shell $(top_srcdir)/xml/best-match.sh $(1) $(2)) pacemaker.rng: pacemaker-$(CRM_DTD_VERSION).rng cp $(top_builddir)/xml/$< $@ pacemaker-%.rng: 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 "" >> $@ cat $@ 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/best-match.sh b/xml/best-match.sh index 299df5df82..0b2c8db400 100755 --- a/xml/best-match.sh +++ b/xml/best-match.sh @@ -1,49 +1,46 @@ #!/bin/bash base=$1; shift target=$1; shift destination=$1; shift prefix=$1; shift -echo "$base $target $destination" 1>&2 - best="0.0" candidates=$(ls -1 ${base}-*.rng 2>/dev/null) for rng in $candidates; do case $rng in ${base}-${target}.rng) best=${target} break ;; *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 if [ "x$destination" = x ]; then echo ${base}-${best}.rng else - echo "Saving to $destination" echo "$prefix" >> ${destination} fi fi