File: Makefile.am

package info (click to toggle)
pacemaker 2.0.1-5%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 55,644 kB
  • sloc: xml: 130,752; ansic: 96,958; python: 5,692; sh: 4,852; makefile: 1,082
file content (176 lines) | stat: -rw-r--r-- 6,805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# 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

RNGdir			= $(CRM_SCHEMA_DIRECTORY)

xsltdir			= $(RNGdir)
dist_xslt_DATA		= $(top_srcdir)/xml/upgrade-1.3.xsl \
			  $(top_srcdir)/xml/upgrade-2.10.xsl \
			  $(top_srcdir)/xml/upgrade-*enter.xsl \
			  $(top_srcdir)/xml/upgrade-*leave.xsl

noinst_DATA		= context-of.xsl

# See Readme.md for details on updating schema files

# Sorted list of available numeric RNG versions,
# extracted from filenames like NAME-MAJOR[.MINOR][.MINOR-MINOR].rng
RNG_numeric_versions    = $(shell ls -1 $(top_srcdir)/xml/*.rng \
			  | sed -n -e 's/^.*-\([0-9][0-9.]*\).rng$$/\1/p' \
			  | sort -u -t. -k 1,1n -k 2,2n -k 3,3n)

# The highest numeric version
RNG_max			?= $(lastword $(RNG_numeric_versions))

# A sorted list of all RNG versions (numeric and "next")
RNG_versions		= next $(RNG_numeric_versions)
RNG_version_pairs	= $(join \
			    ${RNG_numeric_versions},$(addprefix \
			      -,$(wordlist \
			        2,$(words ${RNG_numeric_versions}),${RNG_numeric_versions} \
			      ) next \
			    ) \
			  )
RNG_version_pairs_cnt	= $(words ${RNG_version_pairs})
RNG_version_pairs_last  = $(wordlist \
			    $(words \
			      $(wordlist \
			        2,${RNG_version_pairs_cnt},${RNG_version_pairs} \
			      ) \
			    ),${RNG_version_pairs_cnt},${RNG_version_pairs} \
			  )

RNG_generated		= pacemaker.rng $(foreach base,$(RNG_versions),pacemaker-$(base).rng) versions.rng

RNG_cfg_base		= options nodes resources constraints fencing acls tags alerts
RNG_base		= cib $(RNG_cfg_base) status score rule nvset
RNG_files		= $(foreach base,$(RNG_base),$(wildcard $(base).rng $(base)-*.rng))

# List of non-Pacemaker RNGs
RNG_extra		= crm_mon.rng

dist_RNG_DATA		= $(RNG_files) $(RNG_extra)
nodist_RNG_DATA		= $(RNG_generated)

EXTRA_DIST		= best-match.sh

versions:
	echo "Max: $(RNG_max)"
	echo "Available: $(RNG_versions)"

versions.rng: Makefile.am
	echo "  RNG      $@"
	echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
	echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@
	echo '  <start>' >> $@
	echo '   <interleave>' >> $@
	echo '    <optional>' >> $@
	echo '      <attribute name="validate-with">' >> $@
	echo '        <choice>' >> $@
	echo '          <value>none</value>' >> $@
	echo '          <value>pacemaker-0.6</value>' >> $@
	echo '          <value>transitional-0.6</value>' >> $@
	echo '          <value>pacemaker-0.7</value>' >> $@
	echo '          <value>pacemaker-1.1</value>' >> $@
	for rng in $(RNG_versions); do echo "          <value>pacemaker-$$rng</value>" >> $@; done
	echo '        </choice>' >> $@
	echo '      </attribute>' >> $@
	echo '    </optional>' >> $@
	echo '    <attribute name="admin_epoch"><data type="nonNegativeInteger"/></attribute>' >> $@
	echo '    <attribute name="epoch"><data type="nonNegativeInteger"/></attribute>' >> $@
	echo '    <attribute name="num_updates"><data type="nonNegativeInteger"/></attribute>' >> $@
	echo '   </interleave>' >> $@
	echo '  </start>' >> $@
	echo '</grammar>' >> $@

pacemaker.rng: pacemaker-$(RNG_max).rng
	echo "  RNG      $@"
	cp $(top_builddir)/xml/$< $@

pacemaker-%.rng: $(RNG_files) best-match.sh Makefile.am
	echo "  RNG      $@"
	echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
	echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@
	echo '  <start>' >> $@
	echo '    <element name="cib">' >> $@
	$(top_srcdir)/xml/best-match.sh cib $(*) $(@) "      "
	echo '      <element name="configuration">' >> $@
	echo '        <interleave>' >> $@
	for rng in $(RNG_cfg_base); do $(top_srcdir)/xml/best-match.sh $$rng $(*) $(@) "          " || :; done
	echo '        </interleave>' >> $@
	echo '      </element>' >> $@
	echo '      <optional>' >> $@
	echo '        <element name="status">' >> $@
	$(top_srcdir)/xml/best-match.sh status $(*) $(@) "          "
	echo '        </element>' >> $@
	echo '      </optional>' >> $@
	echo '    </element>' >> $@
	echo '  </start>' >> $@
	echo '</grammar>' >> $@

# diff fails with ec=2 if no predecessor is found;
# this uses '=' GNU extension to sed, if that's not available,
# one can use: hline=`echo "$${p}" | grep -Fn "$${hunk}" | cut -d: -f1`;
# XXX: use line information from hunk to avoid "not detected" for ambiguity
version_diff = \
	@for p in $(1); do \
	  set `echo "$${p}" | tr '-' ' '`; \
	  echo "\#\#\# *-$$2.rng vs. predecessor"; \
	  for v in *-$$2.rng; do \
	    echo "\#\#\#\# $${v} vs. predecessor"; b=`echo "$${v}" | cut -d- -f1`; \
	    old=`./best-match.sh $${b} $$1`; \
	    p=`diff -u "$${old}" "$${v}" 2>/dev/null`; \
	    case $$? in \
	    1) echo "$${p}" | sed -n -e '/^@@ /!d;=;p' \
	       -e ':l;n;/^\([- ]\|+.*<[^ />]\+\([^/>]\+="ID\|>$$\)\)/bl;s/^[+ ]\(.*\)/\1/p' \
	       | while read hline; do \
	           read h && read i || break; \
	           iline=`grep -Fn "$${i}" "$${v}" | cut -d: -f1`; \
	           ctxt="(not detected)"; \
	           if test `echo "$${iline}" | wc -l` -eq 1; then \
	             ctxt=`{ sed -n -e "1,$$(($${iline}-1))p" "$${v}"; \
	                     echo "<inject id=\"GOAL\"/>$${i}"; \
	                     sed -n -e "$$(($${iline}+1)),$$ p" "$${v}"; \
	                   } | $(XSLTPROC) --param skip 1 context-of.xsl -`; \
	           fi; \
	           echo "$${p}" | sed -n -e "$$(($${hline}-2)),$${hline}!d" \
	             -e '/^\(+++\|---\)/p'; \
	           echo "$${h} context: $${ctxt}"; \
	           echo "$${p}" | sed -n -e "1,$${hline}d" \
	             -e '/^\(---\|@@ \)/be;p;d;:e;n;be'; \
	           done; \
	       ;; \
	    2) echo "\#\#\#\#\# $${v} has no predecessor";; \
	    esac; \
	  done; \
	done

diff: best-match.sh
	@echo "#  Comparing changes in + since $(RNG_max)"
	$(call version_diff,${RNG_version_pairs_last})

fulldiff: best-match.sh
	@echo "#  Comparing all changes across all the subsequent increments"
	$(call version_diff,${RNG_version_pairs})

sync:
	git rm -f $(wildcard *-next.rng)
	make pacemaker-next.rng

CLEANFILES = $(RNG_generated)