diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
commit | 07d7f4cfa4b10de87a31b68191036ff446add675 (patch) | |
tree | 7162524d8aaf1aef62d2f4fa51f595ed113981ff /xml/version-diff.sh.in | |
parent | Adding upstream version 2.1.6. (diff) | |
download | pacemaker-upstream/2.1.7.tar.xz pacemaker-upstream/2.1.7.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.in | 60 |
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 |