GNOME Bugzilla – Bug 378739
darwin's awk craps out on gnome-doc-xslt.xml
Last modified: 2007-12-26 01:56:19 UTC
in doc/xslt # make -n incs=`awk ' /<\!--BEGIN-->/ { inc=1; } /<\!--END-->/ { inc=0; } inc { if (match($0, /<include href="([^"]*)\.xml"/, arr)) { print arr[1]; } }' "/Source/gnome-doc-utils/gnome-doc-utils/doc/xslt/C/gnome-doc-xslt.xml" | sort`; \ xmls=`echo db-chunk db-common db-label db-title db-xref db2html db2html-admon db2html-autotoc db2html-bibliography db2html-block db2html-callout db2html-classsynopsis db2html-cmdsynopsis db2html-css db2html-division db2html-ebnf db2html-footnote db2html-funcsynopsis db2html-info db2html-inline db2html-l10n db2html-list db2html-media db2html-qanda db2html-refentry db2html-table db2html-title db2html-xref db2omf gettext l10n-numbers | sed -e 's/ /\n/g' | sort`; \ if [ "$incs" != "$xmls" ]; then \ echo "gnome-doc-xslt.xml does not include all reference pages" 1>&2; \ exit 1; \ fi # make awk: syntax error at source line 1 context is /<\!--BEGIN-->/ { inc=1; } /<\!--END-->/ { inc=0; } inc { if (match($0, /<include >>> href="([^"]*)\.xml"/, <<< awk: illegal statement at source line 1 awk: syntax error at source line 1 gnome-doc-xslt.xml does not include all reference pages make: *** [gnome-doc-xslt-check] Error 1 Exit 2
Fixed in HEAD. Thanks for catching this.
unfortunately, the darwin's awk dislike's that as well so, i came up with this awk ' /<\!--BEGIN-->/ { inc=1; } /<\!--END-->/ { inc=0; } inc { { print;} }' /Source/gnome-doc-utils/gnome-doc-utils/doc/xslt/C/gnome-doc-xslt.xml | grep href | sed 's,^.*<include href=",,;s,\.xml".*$,,' | sort it's messy, but i think portable
after many hours of soul searching, i decided it might be a grand idea to give you the error the current head gives # make -n incs=`awk -W compat ' /<\!--BEGIN-->/ { inc=1; } /<\!--END-->/ { inc=0; } inc { if (match($0, /<include href="[^"]*\.xml"/)) { base = $0; sub(/.*<include href="/, "", base); sub(/\.xml".*/, "", base); print base; } }' "/Source/gnome-doc-utils/gnome-doc-utils/doc/xslt/C/gnome-doc-xslt.xml" | sort`; \ xmls=`echo db-chunk db-common db-label db-title db-xref db2html db2html-admon db2html-autotoc db2html-bibliography db2html-block db2html-callout db2html-classsynopsis db2html-cmdsynopsis db2html-css db2html-division db2html-ebnf db2html-footnote db2html-funcsynopsis db2html-info db2html-inline db2html-l10n db2html-list db2html-media db2html-qanda db2html-refentry db2html-table db2html-title db2html-xref db2omf gettext l10n-numbers | tr '\ ' '\n' | sort`; \ if [ "$incs" != "$xmls" ]; then \ echo "gnome-doc-xslt.xml does not include all reference pages" 1>&2; \ exit 1; \ fi # make awk: unknown option -W ignored awk: can't open file /<\!--BEGIN-->/ { inc=1; } /<\!--END-->/ { inc=0; } inc { if (match($0, /<include href="[^"]*\.xml"/)) { base = $0; sub(/.*<include href="/, "", base); sub(/\.xml".*/, "", base); print base; } } source line number 1 gnome-doc-xslt.xml does not include all reference pages make: *** [gnome-doc-xslt-check] Error 1
Oops, I accidentally left in the "-W compat" that I used to disable gawk extensions for testing. Looks like that's not the problem though. I'll look into this and run it on my friend's Mac.
awk -W compat -f "/Source/gnome-doc-utils/gnome-doc-utils/doc/xslt/xsldoc.awk" "/Source/gnome-doc-utils/gnome-doc-utils/xslt/docbook/common/db-chunk.xsl" | xsltproc -o "C/db-chunk.xml" --stringparam basename "db-chunk" --stringparam xsl_file "/Source/gnome-doc-utils/gnome-doc-utils/xslt/docbook/common/db-chunk.xsl" "/Source/gnome-doc-utils/gnome-doc-utils/doc/xslt/xsldoc.xsl" - awk: unknown option -W ignored awk: can't open file -f source line number 1 -:1: parser error : Document is empty ^ -:1: parser error : Start tag expected, '<' not found ^ unable to parse - still broken
oh well, it does work without the -W compat