diff --git a/xml/Makefile.am b/xml/Makefile.am
index e9cd875ca1..a73abef951 100644
--- a/xml/Makefile.am
+++ b/xml/Makefile.am
@@ -1,72 +1,76 @@
#
# 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
-schema_VERSIONS = 1.2 next
-schema_GENERATED = pacemaker.rng $(foreach base,$(schema_VERSIONS),pacemaker-$(base).rng)
+xsltdir = $(dtddir)
+xslt_SCRIPTS = upgrade06.xsl upgrade11.xsl
-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
-
-EXTRA_DIST = $(schema_SCRIPTS) $(dtd_SCRIPTS)
+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)
best_match = $(shell $(top_srcdir)/xml/best-match.sh $(1) $(2))
pacemaker.rng: pacemaker-$(CRM_DTD_VERSION).rng
cp $(top_builddir)/xml/$< $@
-pacemaker-%.rng:
+pacemaker-%.rng:
echo "" > $@
echo "" >> $@
echo " " >> $@
echo " " >> $@
- echo " " >> $@
+ $(top_srcdir)/xml/best-match.sh cib $(*) $(@) " "
echo " " >> $@
echo " " >> $@
- echo -e " "$(foreach rng,$(RNG_cfg_files)," \n") >> $@
+ for rng in $(RNG_cfg_base); do $(top_srcdir)/xml/best-match.sh $$rng $(*) $(@) " "; done
echo " " >> $@
echo " " >> $@
echo " " >> $@
- echo " " >> $@
+ $(top_srcdir)/xml/best-match.sh status $(*) $(@) " "
echo " " >> $@
echo " " >> $@
echo " " >> $@
echo "" >> $@
-
- echo "Created $@"
+ 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 $(schema_GENERATED)
+ rm -f $(RNG_generated)
diff --git a/xml/best-match.sh b/xml/best-match.sh
index f6e3dc8a5a..299df5df82 100755
--- a/xml/best-match.sh
+++ b/xml/best-match.sh
@@ -1,40 +1,49 @@
#!/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)
- echo $rng
- exit
+ 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
- echo ${base}-${best}.rng
-else
- echo "empty.rng"
+ if [ "x$destination" = x ]; then
+ echo ${base}-${best}.rng
+ else
+ echo "Saving to $destination"
+ echo "$prefix" >> ${destination}
+ fi
fi
diff --git a/xml/cib-1.0.rng b/xml/cib-1.0.rng
new file mode 100644
index 0000000000..b05413df5a
--- /dev/null
+++ b/xml/cib-1.0.rng
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xml/constraints-1.0.rng b/xml/constraints-1.0.rng
index 5a4474a597..e8e04e2832 100644
--- a/xml/constraints-1.0.rng
+++ b/xml/constraints-1.0.rng
@@ -1,180 +1,182 @@
+
+
start
promote
demote
stop
Stopped
Started
Master
Slave
Optional
Mandatory
Serialize
diff --git a/xml/options-1.2.rng b/xml/options-1.0.rng
similarity index 100%
rename from xml/options-1.2.rng
rename to xml/options-1.0.rng
diff --git a/xml/pacemaker-1.0.rng b/xml/pacemaker-1.0.rng
deleted file mode 100644
index 71003932fe..0000000000
--- a/xml/pacemaker-1.0.rng
+++ /dev/null
@@ -1,121 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- normal
- member
- ping
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xml/resources-1.0.rng b/xml/resources-1.0.rng
index 7ea2228aa0..aa456cdf91 100644
--- a/xml/resources-1.0.rng
+++ b/xml/resources-1.0.rng
@@ -1,177 +1,179 @@
+
+
ocf
lsb
heartbeat
stonith
upstart
Stopped
Started
Slave
Master
nothing
quorum
fencing
ignore
block
stop
restart
standby
fence
diff --git a/xml/status-1.2.rng b/xml/status-1.0.rng
similarity index 100%
rename from xml/status-1.2.rng
rename to xml/status-1.0.rng