From e11ee4582aad43d3bcc8a2ba9eaf9f14e976075a Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 25 Oct 2018 06:10:18 +0200 Subject: [PATCH 1/2] docs: fix bashism in tools/check-docs.sh [thaller@redhat.com: fixed issue in original patch] --- tools/check-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check-docs.sh b/tools/check-docs.sh index 9dcdb1ef3b..1d49209757 100755 --- a/tools/check-docs.sh +++ b/tools/check-docs.sh @@ -13,7 +13,7 @@ fi # Check that files that define types that are in public libnm API are included in libnm documentation. # Don't complain about readability or I'll rewrite this in Perl. if (sed -n 's/.*&2; then echo "*** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***" >&2 exit 1 From 7a59cd274485e4c0345c563d48e516967630d7f0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 25 Oct 2018 08:55:08 +0200 Subject: [PATCH 2/2] docs: rework check-docs test script Try to make check-docs.sh script more readable. Also, previously the script would check that one side was a subset of the other side. Tighten this check up, now both sides of the comparison must agree and yield the same lines. --- tools/check-docs.sh | 54 +++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/tools/check-docs.sh b/tools/check-docs.sh index 1d49209757..b7623fed88 100755 --- a/tools/check-docs.sh +++ b/tools/check-docs.sh @@ -1,22 +1,48 @@ -#!/bin/sh +#!/bin/bash -SOURCEDIR=$1 +set -e + +die() { + printf '%s\n' "$@" >&2 + exit 1 +} + +word_regex() { + tr '\n|<>\\' ' ' \ + | sed -e 's, *$,\\>,' \ + -e 's,^ *,\\<,' \ + -e 's, \+,\\>\\|\\<,g' +} + +same_lines() { + diff <(printf "%s\n" "$1" | sed '/^$/d' | sort) \ + <(printf "%s\n%s\n" "$2" "$3" | sed '/^$/d' | sort) >&2 +} + +SOURCEDIR="$1" [ -n "$SOURCEDIR" ] && SOURCEDIR="$SOURCEDIR/" # Check that the D-Bus API docs contain all known interfaces -if (sed -n 's/.*&2; then - echo "*** Error: D-Bus interfaces not included in docs/api/network-manager-docs.xml ***" >&2 - exit 1 +F1="$(sed -n 's,^ $,\1,p' "$SOURCEDIR"docs/api/network-manager-docs.xml)" +F2="$(cd "$SOURCEDIR"introspection; ls -1 *.xml)" +if ! same_lines "$F1" "$F2" ; then + die "*** Error: D-Bus interfaces not included in docs/api/network-manager-docs.xml ***" fi # Check that files that define types that are in public libnm API are included in libnm documentation. -# Don't complain about readability or I'll rewrite this in Perl. -if (sed -n 's/.*&2; then - echo "*** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***" >&2 - exit 1 +F1="$(sed -n 's/.*