From a7f1270e24a77ab8338604ab14ee928a421f89a0 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 7 Apr 2009 14:46:28 -0400 Subject: Fix so publicanized Tapset Reference manual can be generated again. --- doc/Tapset_Reference_Guide/publicanize.sh | 107 +++++++++++++++++++++--------- 1 file changed, 77 insertions(+), 30 deletions(-) (limited to 'doc/Tapset_Reference_Guide/publicanize.sh') diff --git a/doc/Tapset_Reference_Guide/publicanize.sh b/doc/Tapset_Reference_Guide/publicanize.sh index d4da6e02..0d1b134e 100755 --- a/doc/Tapset_Reference_Guide/publicanize.sh +++ b/doc/Tapset_Reference_Guide/publicanize.sh @@ -1,26 +1,74 @@ #!/bin/bash +INFILE="../SystemTap_Tapset_Reference/tapsets.xml" +OUTFILE="en-US/Tapset_Reference_Guide.xml" +TMPFILE='mktemp' || exit 1 +TMPFILE2='mktemp' || exit 1 -#copy the automated tapsets.xml -cp ../SystemTap_Tapset_Reference/tapsets.xml temp.xml ; +do_help() +{ + echo "publicanize.sh: usage: + -?/--help this message + -i/--input=file input file name + -o/--output=file output file name +" >&2 +} + + +#process optional arguments -i -o +while [ "$#" -ne 0 ] +do + arg=`printf %s $1 | awk -F= '{print $1}'` + val=`printf %s $1 | awk -F= '{print $2}'` + shift + if test -z "$val"; then + local possibleval=$1 + printf %s $1 "$possibleval" | grep ^- >/dev/null 2>&1 + if test "$?" != "0"; then + val=$possibleval + if [ "$#" -ge 1 ]; then + shift + fi + fi + fi + + case "$arg" in + -i|--input) + INFILE=$val + ;; + -o|--output) + OUTFILE=$val + ;; + -\?|--help) + do_help + exit 0 + ;; + *) + echo "Unknown option \"$arg\". See opcontrol --help" >&2 + exit 1 + ;; + esac +done + + +#copy the generated tapsets.xml +cp $INFILE $TMPFILE || exit 1 #remove all excess whitespace -sed -i -e 's/^\s*//g' temp.xml ; +sed -i -e 's/^\s*//g' $TMPFILE -#remove marked Intro (starthere to endhere), then copy it to en-US -sed '/starthere/,/endhere/d' temp.xml > Tapset_Reference_Guide.xml -cp Tapset_Reference_Guide.xml en-US/Tapset_Reference_Guide.xml; -rm Tapset_Reference_Guide.xml +#remove marked Intro (starthere to endhere) +sed -i -e '/starthere/,/endhere/d' $TMPFILE #re-convert programlisting tags -sed -i -e 's/<programlisting>//g' en-US/Tapset_Reference_Guide.xml; -sed -i -e 's/<\/programlisting>/<\/programlisting>/g' en-US/Tapset_Reference_Guide.xml; +sed -i -e 's/<programlisting>//g' $TMPFILE +sed -i -e 's/<\/programlisting>/<\/programlisting>/g' $TMPFILE #replace header -cat en-US/Tapset_Reference_Guide.xml | +cat $TMPFILE | perl -p -e 'undef $/;s|\nSystemTap Tapset Reference Manual|\n|msg' | -perl -p -e 'undef $/;s|\n\nWilliam\nCohen\n\n\n
\nwcohen\@redhat.com\n
\n
\n
\n
||msg' | -perl -p -e 'undef $/;s|\n2008, 2009\nRed Hat, Inc.\n||msg' | +perl -p -e 'undef $/;s|\n\nSystemTap\nHackers\n\n||msg' | +perl -p -e 'undef $/;s|\n2008-2009\nRed Hat, Inc. and others\n||msg' | perl -p -e 'undef $/;s|\n\nThis documentation is free software\; you can redistribute\nit and/or modify it under the terms of the GNU General Public\nLicense version 2 as published by the Free Software Foundation.\n||msg' | perl -p -e 'undef $/;s|\nThis program is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\n||msg' | perl -p -e 'undef $/;s|\nYou should have received a copy of the GNU General Public\nLicense along with this program; if not, write to the Free\nSoftware Foundation, Inc., 59 Temple Place, Suite 330, Boston,\nMA 02111-1307 USA\n||msg' | @@ -32,34 +80,33 @@ perl -p -e 'undef $/;s|\n|\nfunction < perl -p -e 'undef $/;s|\n||msg' | perl -p -e 'undef $/;s|\n\n||msg' | perl -p -e 'undef $/;s|\n||msg' | -perl -p -e 'undef $/;s|\n||msg' > clean.xml +perl -p -e 'undef $/;s|\n|
|msg' > $TMPFILE2 #replace Intro with my own -perl -p -i -e 's||\n|g' clean.xml +perl -p -i -e 's||\n|g' $TMPFILE2 #for tapset name format section -#perl -p -i -e 'undef $/;s|\nname:return \(parameters\)\ndefinition\n|\nfunction/probe tapset_name:return \(parameters\)\n|msg' clean.xml -#perl -p -i -e 's|In this guide, tapset definitions appear in the following format:|In this guide, the synopsis of each tapset appears in the following format:|g' clean.xml -#perl -p -i -e 's||\n|g' clean.xml +#perl -p -i -e 'undef $/;s|\nname:return \(parameters\)\ndefinition\n|\nfunction/probe tapset_name:return \(parameters\)\n|msg' $TMPFILE2 +#perl -p -i -e 's|In this guide, tapset definitions appear in the following format:|In this guide, the synopsis of each tapset appears in the following format:|g' $TMPFILE2 +#perl -p -i -e 's||\n|g' $TMPFILE2 -cp clean.xml en-US/Tapset_Reference_Guide.xml -rm clean.xml - # statements change synopsis tags, as they are still currently unfixed in publican-redhat -sed -i -e 's/refsynopsisdiv>/refsect1>/g' en-US/Tapset_Reference_Guide.xml; -sed -i -e 's/refsect1>/refsection>/g' en-US/Tapset_Reference_Guide.xml; -sed -i -e 's/synopsis>/programlisting>\n/g' en-US/Tapset_Reference_Guide.xml; +sed -i -e 's/refsynopsisdiv>/refsect1>/g' $TMPFILE2 +sed -i -e 's/refsect1>/refsection>/g' $TMPFILE2 +sed -i -e 's/synopsis>/programlisting>\n/g' $TMPFILE2 # re-convert tags -sed -i -e 's/<emphasis>//g' en-US/Tapset_Reference_Guide.xml; -sed -i -e 's/<\/emphasis>/<\/emphasis>/g' en-US/Tapset_Reference_Guide.xml; +sed -i -e 's/<emphasis>//g' $TMPFILE2 +sed -i -e 's/<\/emphasis>/<\/emphasis>/g' $TMPFILE2 -sed -i -e 's/<remark>//g' en-US/Tapset_Reference_Guide.xml; -sed -i -e 's/<\/remark>/<\/remark>/g' en-US/Tapset_Reference_Guide.xml; +sed -i -e 's/<remark>//g' $TMPFILE2 +sed -i -e 's/<\/remark>/<\/remark>/g' $TMPFILE2 -sed -i -e 's/<command>//g' en-US/Tapset_Reference_Guide.xml; -sed -i -e 's/<\/command>/<\/command>/g' en-US/Tapset_Reference_Guide.xml; +sed -i -e 's/<command>//g' $TMPFILE2 +sed -i -e 's/<\/command>/<\/command>/g' $TMPFILE2 #useful marker script; moves content between starthere and endhere to file target -#sed -n '/starthere/,/endhere/ s/.*/&/w target' Tapset_Reference_Guide.xml \ No newline at end of file +#sed -n '/starthere/,/endhere/ s/.*/&/w target' $TMPFILE2 + +mv $TMPFILE2 $OUTFILE -- cgit From e5fd85f3a61b3309a0164baf0bac7fbd91789ab4 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Thu, 7 May 2009 21:50:39 -0400 Subject: Correct TMPFILE and TMPFILE2 file names. --- doc/Tapset_Reference_Guide/publicanize.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/Tapset_Reference_Guide/publicanize.sh') diff --git a/doc/Tapset_Reference_Guide/publicanize.sh b/doc/Tapset_Reference_Guide/publicanize.sh index 0d1b134e..7238a89b 100755 --- a/doc/Tapset_Reference_Guide/publicanize.sh +++ b/doc/Tapset_Reference_Guide/publicanize.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/bash -x INFILE="../SystemTap_Tapset_Reference/tapsets.xml" OUTFILE="en-US/Tapset_Reference_Guide.xml" -TMPFILE='mktemp' || exit 1 -TMPFILE2='mktemp' || exit 1 +TMPFILE=`mktemp` || exit 1 +TMPFILE2=`mktemp` || exit 1 do_help() { -- cgit From 8f65d588e2a2e58409bc52363b652eba9a963957 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Thu, 7 May 2009 21:52:28 -0400 Subject: Don't print out the commands. --- doc/Tapset_Reference_Guide/publicanize.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/Tapset_Reference_Guide/publicanize.sh') diff --git a/doc/Tapset_Reference_Guide/publicanize.sh b/doc/Tapset_Reference_Guide/publicanize.sh index 7238a89b..a0ccc9b8 100755 --- a/doc/Tapset_Reference_Guide/publicanize.sh +++ b/doc/Tapset_Reference_Guide/publicanize.sh @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash INFILE="../SystemTap_Tapset_Reference/tapsets.xml" OUTFILE="en-US/Tapset_Reference_Guide.xml" TMPFILE=`mktemp` || exit 1 -- cgit From 7b32c0d6ab200d270a94b1db5714e3a0507f9b20 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Fri, 8 May 2009 13:25:42 +1000 Subject: removed unnecessary perl statements --- doc/Tapset_Reference_Guide/publicanize.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'doc/Tapset_Reference_Guide/publicanize.sh') diff --git a/doc/Tapset_Reference_Guide/publicanize.sh b/doc/Tapset_Reference_Guide/publicanize.sh index a0ccc9b8..a97ae873 100755 --- a/doc/Tapset_Reference_Guide/publicanize.sh +++ b/doc/Tapset_Reference_Guide/publicanize.sh @@ -67,13 +67,13 @@ sed -i -e 's/<\/programlisting>/<\/programlisting>/g' $TMPFILE cat $TMPFILE | perl -p -e 'undef $/;s|\nSystemTap Tapset Reference Manual|\n|msg' | -perl -p -e 'undef $/;s|\n\nSystemTap\nHackers\n\n||msg' | -perl -p -e 'undef $/;s|\n2008-2009\nRed Hat, Inc. and others\n||msg' | -perl -p -e 'undef $/;s|\n\nThis documentation is free software\; you can redistribute\nit and/or modify it under the terms of the GNU General Public\nLicense version 2 as published by the Free Software Foundation.\n||msg' | -perl -p -e 'undef $/;s|\nThis program is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\n||msg' | -perl -p -e 'undef $/;s|\nYou should have received a copy of the GNU General Public\nLicense along with this program; if not, write to the Free\nSoftware Foundation, Inc., 59 Temple Place, Suite 330, Boston,\nMA 02111-1307 USA\n||msg' | -perl -p -e 'undef $/;s|\nFor more details see the file COPYING in the source\ndistribution of Linux.\n\n\n||msg' | -perl -p -e 'undef $/;s|||msg' | +#perl -p -e 'undef $/;s|\n\nSystemTap\nHackers\n\n||msg' | +#perl -p -e 'undef $/;s|\n2008-2009\nRed Hat, Inc. and others\n||msg' | +#perl -p -e 'undef $/;s|\n\nThis documentation is free software\; you can redistribute\nit and/or modify it under the terms of the GNU General Public\nLicense version 2 as published by the Free Software Foundation.\n||msg' | +#perl -p -e 'undef $/;s|\nThis program is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\n||msg' | +#perl -p -e 'undef $/;s|\nYou should have received a copy of the GNU General Public\nLicense along with this program; if not, write to the Free\nSoftware Foundation, Inc., 59 Temple Place, Suite 330, Boston,\nMA 02111-1307 USA\n||msg' | +#perl -p -e 'undef $/;s|\nFor more details see the file COPYING in the source\ndistribution of Linux.\n\n\n||msg' | +#perl -p -e 'undef $/;s|||msg' | perl -p -e 'undef $/;s|\n\n\n\n\n\n\n\n\n\n\n\n\n\n||msg' | perl -p -e 'undef $/;s|\n\n\n\n\n\n\n\n\n\n\n||msg' | perl -p -e 'undef $/;s|\n|\nfunction <\/emphasis>|msg' | -- cgit