After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 378739 - darwin's awk craps out on gnome-doc-xslt.xml
darwin's awk craps out on gnome-doc-xslt.xml
Status: RESOLVED FIXED
Product: gnome-doc-utils
Classification: Deprecated
Component: docs
CVS HEAD
Other Mac OS
: Normal blocker
: ---
Assigned To: gnome-doc-utils maintainers
gnome-doc-utils maintainers
Depends on:
Blocks:
 
 
Reported: 2006-11-24 06:53 UTC by paul
Modified: 2007-12-26 01:56 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18



Description paul 2006-11-24 06:53:15 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
Comment 1 Shaun McCance 2006-11-26 19:26:57 UTC
Fixed in HEAD.  Thanks for catching this.
Comment 2 paul 2006-11-29 21:38:40 UTC
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
Comment 3 paul 2006-11-30 02:03:16 UTC
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
Comment 4 Shaun McCance 2006-11-30 07:00:39 UTC
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.


Comment 5 paul 2006-12-27 06:09:25 UTC
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
Comment 6 paul 2006-12-27 06:25:01 UTC
oh well, it does work without the -W compat