summaryrefslogtreecommitdiffstats
path: root/xml/version-diff.sh.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
commit07d7f4cfa4b10de87a31b68191036ff446add675 (patch)
tree7162524d8aaf1aef62d2f4fa51f595ed113981ff /xml/version-diff.sh.in
parentAdding upstream version 2.1.6. (diff)
downloadpacemaker-0d560556df519c6626cda7660f843a815b3c227e.tar.xz
pacemaker-0d560556df519c6626cda7660f843a815b3c227e.zip
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xml/version-diff.sh.in')
-rw-r--r--xml/version-diff.sh.in60
1 files changed, 60 insertions, 0 deletions
diff --git a/xml/version-diff.sh.in b/xml/version-diff.sh.in
new file mode 100644
index 0000000..1ece3b3
--- /dev/null
+++ b/xml/version-diff.sh.in
@@ -0,0 +1,60 @@
+#!@BASH_PATH@
+#
+# Copyright 2016-2023 the Pacemaker project contributors
+#
+# The version control history for this file may have further details.
+#
+# This source code is licensed under the GNU General Public License version 2
+# or later (GPLv2+) WITHOUT ANY WARRANTY.
+#
+
+# 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
+for p in $*; 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 -r hline; do
+ if read -r h; then
+ read -r i
+ else
+ break
+ fi
+
+ iline=$(grep -Fn "$i" "$v" | cut -d: -f1)
+
+ if [ "$(echo "$iline" | wc -l)" = "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 -)
+ else
+ ctxt="(not detected)"
+ 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