diff --git a/apidox/src/frameworksgendox.sh b/apidox/src/frameworksgendox.sh index b52ff52..23da7aa 100755 --- a/apidox/src/frameworksgendox.sh +++ b/apidox/src/frameworksgendox.sh @@ -1,178 +1,178 @@ #! /bin/bash VERBOSE=1 VERSION="" # Read arguments... test "x--quiet" = "x$1" && { shift ; VERBOSE=0 ; } test "x--version" = "x$1" && { shift ; VERSION="$1" ; shift ; } test -z "$VERSION" && { echo "No version given"; exit 1 ; } # Configuration # APIPATH: top-level for API stuff APIPATH=/srv/www/api.kde.org # OUTPATH: where the final output goes OUTPATH=$APIPATH/apidocs/apidox-$VERSION # TEMPPATH: where the temporary output goes TEMPPATH=/srv/tmp/tempdocs/apidox-$VERSION # TAGPATH: where tag files (i.e, qtX.Y.tag) reside TAGPATH=$HOME/quality-kde-org/apidox/data # BINPATH: where the helper programs (i.e. doxylog2html.pl) reside BINPATH=/home/api/bin # SRCPREFIX: where the top-level KDE source code resides SRCPREFIX=/srv/sources # LOGPATH: where logs get moved LOGPATH=/srv/logs/api/$VERSION # SRCPATH: where the source code for this component resides SRCPATH=$SRCPREFIX/$VERSION # DOXYHOME: where the doxygen stuff livs DOXYHOME=$HOME/kdelibs/doc DOXYSH=$DOXYHOME/api/doxygen.sh test -s "$DOXYSH" || { echo "*** NO DOXYGEN.SH" ; exit ; } DOXDATAPATH=$DOXYHOME/common # Determine the modules we need to build the documentation of... MODULES=`ls $SRCPATH` # If argument given, use it as modules list to run test -n "$1" && MODULES="$1" # Prepare to run.... test -d "$OUTPATH" || { echo "No path $OUTPATH -- creating it" ; mkdir -p $OUTPATH || exit 1 ; } test -d "$TEMPPATH" || { echo "No path $TEMPPATH -- creating it" ; mkdir -p $TEMPPATH || exit 1 ; } test -d "$LOGPATH" || { echo "No path $LOGPATH -- creating it" ; mkdir -p $LOGPATH || exit 1 ; } test -d "$SRCPATH" || { echo "No source path $SRCPATH" ; exit 1 ; } cd "$TEMPPATH" || { echo "Cannot cd into $TEMPPATH" ; exit 1 ; } # Make a nice title component=`echo $VERSION | sed s/kde-// | sed s/kde// | sed 's/^[a-z]/\U&/'` title="KDE $component API Reference" # Log it... if [ $VERBOSE ]; then echo "* Generating APIDOX for $VERSION" echo "* Title \"$title\"" fi # Specify url and path to Qt documentation.... frameworksGen=0 case "$VERSION" in kde-3.5) export QTDOCDIR=http://doc.qt.digia.com/3.3 export QTDOCTAG=$TAGPATH/qt3.3.tag ;; frameworks* ) frameworksGen=1 export QTDOCDIR=https://doc.qt.io/qt-5 export QTDOCTAG=$TAGPATH/5.2 export QTHELPGENERATOR=/usr/lib64/qt5/bin/qhelpgenerator DOXYSH=/home/api/kapidox/src/kapidox_generate test -s "$DOXYSH" || { echo "*** NO KAPIDOX" ; exit ; } ;; * ) - export QTDOCDIR=http://qt-project.org/doc/qt-4.8 + export QTDOCDIR=https://doc.qt.io/archives/qt-4.8 export QTDOCTAG=$TAGPATH/qt4.8.tag ;; esac # Generate the documentation for each module found for module in $MODULES; do if [ $VERBOSE ]; then echo "** Generating APIDOX for $SRCPATH/$module" fi # Cleanup from previous generations.... if [ $frameworksGen -eq 1 ] ; then rm -rf $TEMPPATH/* else rm -rf $TEMPPATH/$module-* rm -f $TEMPPATH/$module.tar.gz $TEMPPATH/$module.log fi # Make sure the sources for this module exist... test -d "$SRCPATH/$module" || { echo "$SRCPATH/$module does not exist, skipping" ; continue ; } # Set the command that does the dox generation if [ $frameworksGen -eq 1 ] ; then DOXCMD="$DOXYSH \ --doxygen $HOME/doxygen-src/bin/doxygen \ --qtdoc-dir $TAGPATH/5.2 \ --qtdoc-link $QTDOCDIR \ --qtdoc-flatten-links \ --qhp \ --qhelpgenerator $QTHELPGENERATOR \ --depdiagram-dot-dir $HOME/depdiagram-output/ \ $SRCPATH/.." else DOXCMD="$DOXYSH \ --installdir=$TEMPPATH \ --doxdatadir=$DOXDATAPATH \ --title=\"$title\" \ --api-searchbox \ --no-cleanup \ --preprocess \ $SRCPATH/$module" fi # Build the documentation! if [ $VERBOSE ]; then echo "** Running $DOXCMD" fi $DOXCMD 2>&1 \ | grep -v '^Error: Unexpected tag `' \ | grep -v '^[Ww]arning: ignoring unsupported tag' \ | grep -v '^[Ww]arning: ignoring unknown tag' \ | sed s+/tempdocs/+/apidocs/+g > "../$module.new" CMDRESULT=$PIPESTATUS # If not 0 (= failure) if [ $CMDRESULT -ne 0 ] ; then echo " ** FATAL ERROR during script: not updated. **" >> "../$module.new" fi mv "../$module.new" "$module.log" # If we need to, log the number of errors.... if [ $VERBOSE ]; then AMT=`grep ^$SRCPATH $module.log | wc -l` expr 0 + "$AMT" > /dev/null 2>&1 || AMT="0" echo "** Number of errors: $AMT" echo "** Number of applications: " `grep 'Creating apidox' "$module.log" | wc -l` echo "** Written to $module.log" fi # clean-up unneeded files ( cd $TEMPPATH; find . -name "*.map" -o -name "*.md5" | xargs rm -f ) # create one big tar file of all the goodies if [ $frameworksGen -eq 1 ] ; then ( cd $TEMPPATH; tar czf $module.tar.gz . ) else ( cd $TEMPPATH; tar czf $module.tar.gz $module-apidocs ) fi # Move the temporary output to the real apidocs location if [ $frameworksGen -eq 1 ] ; then rm -f $LOGPATH/$module.log cat $TEMPPATH/$module.log | grep -v "INFO " > $LOGPATH/$module.log # Move only if result is 0 (success) if [ $CMDRESULT -eq 0 ] ; then if [ -d $OUTPATH/$module-apidocs ]; then rm -rf $OUTPATH/$module-apidocs/* else mkdir -p $OUTPATH/$module-apidocs fi mv -f $TEMPPATH/* $OUTPATH/$module-apidocs else echo "** Got an error somewhere, code not moved" fi else rm -rf $OUTPATH/$module-* mv -f $TEMPPATH/$module-* $OUTPATH rm -f $OUTPATH/$module.tar.gz mv -f $TEMPPATH/$module.tar.gz $OUTPATH rm -f $LOGPATH/$module.log mv -f $TEMPPATH/$module.log $LOGPATH fi done if [ $VERBOSE ]; then echo "* APIDOX Generation complete" fi diff --git a/apidox/src/gendox.sh b/apidox/src/gendox.sh index 17e1b43..224ff22 100755 --- a/apidox/src/gendox.sh +++ b/apidox/src/gendox.sh @@ -1,136 +1,136 @@ #! /bin/bash VERBOSE=1 VERSION="" # Read arguments... test "x--quiet" = "x$1" && { shift ; VERBOSE=0 ; } test "x--version" = "x$1" && { shift ; VERSION="$1" ; shift ; } test -z "$VERSION" && { echo "No version given"; exit 1 ; } # Configuration # APIPATH: top-level for API stuff APIPATH=/srv/www/api.kde.org # OUTPATH: where the final output goes OUTPATH=$APIPATH/apidocs/apidox-$VERSION # TEMPPATH: where the temporary output goes TEMPPATH=/srv/tmp/tempdocs/apidox-$VERSION # TAGPATH: where tag files (i.e, qtX.Y.tag) reside TAGPATH=$HOME/quality-kde-org/apidox/data # BINPATH: where the helper programs (i.e. doxylog2html.pl) reside BINPATH=/home/api/bin # SRCPREFIX: where the top-level KDE source code resides SRCPREFIX=/srv/sources # LOGPATH: where logs get moved LOGPATH=/srv/logs/api/$VERSION # SRCPATH: where the source code for this component resides SRCPATH=$SRCPREFIX/$VERSION # DOXYHOME: where the doxygen stuff livs DOXYHOME=$HOME/kdelibs/doc DOXYSH=$DOXYHOME/api/doxygen.sh test -s "$DOXYSH" || { echo "*** NO DOXYGEN.SH" ; exit ; } DOXDATAPATH=$DOXYHOME/common # Determine the modules we need to build the documentation of... MODULES=`ls $SRCPATH` # If argument given, use it as modules list to run test -n "$1" && MODULES="$1" # Prepare to run.... test -d "$OUTPATH" || { echo "No path $OUTPATH -- creating it" ; mkdir -p $OUTPATH || exit 1 ; } test -d "$TEMPPATH" || { echo "No path $TEMPPATH -- creating it" ; mkdir -p $TEMPPATH || exit 1 ; } test -d "$LOGPATH" || { echo "No path $LOGPATH -- creating it" ; mkdir -p $LOGPATH || exit 1 ; } test -d "$SRCPATH" || { echo "No source path $SRCPATH" ; exit 1 ; } cd "$TEMPPATH" || { echo "Cannot cd into $TEMPPATH" ; exit 1 ; } # Make a nice title component=`echo $VERSION | sed s/kde-// | sed s/kde// | sed 's/^[a-z]/\U&/'` title="KDE $component API Reference" # Log it... if [ $VERBOSE ]; then echo "* Generating APIDOX for $VERSION" echo "* Title \"$title\"" fi # Specify url and path to Qt documentation.... case "$VERSION" in kde-3.5) export QTDOCDIR=http://doc.qt.digia.com/3.3 export QTDOCTAG=$TAGPATH/qt3.3.tag ;; frameworks* ) export QTDOCDIR=http://qt-project.org/doc/qt-5.1 export QTDOCTAG=$TAGPATH/qt5.1.tag ;; * ) - export QTDOCDIR=http://qt-project.org/doc/qt-4.8 + export QTDOCDIR=https://doc.qt.io/archives/qt-4.8 export QTDOCTAG=$TAGPATH/qt4.8.tag ;; esac # Generate the documentation for each module found for i in $MODULES; do if [ $VERBOSE ]; then echo "** Generating APIDOX for $SRCPATH/$i" fi # Cleanup from previous generations.... rm -rf $TEMPPATH/$i-* rm -f $TEMPPATH/$i.tar.gz $TEMPPATH/$i.log # Make sure the sources for this module exist... test -d "$SRCPATH/$i" || { echo "$SRCPATH/$i does not exist, skipping" ; continue ; } # Build the documentation! DOXARGS="$SRCPATH/$i" if [ $VERBOSE ]; then echo ** Running $DOXYSH --installdir=$TEMPPATH \ --doxdatadir=$DOXDATAPATH \ --title=\""$title"\" \ --api-searchbox --no-cleanup --preprocess \ $DOXARGS fi # Using doxygen > 1.8.10 broke the mainpage.dox links: we explicitely ask for 1.8.7 export PATH=$HOME/doxygen-1.8.7/bin:$PATH #pick up our local doxygen build sh $DOXYSH \ --installdir=$TEMPPATH \ --doxdatadir=$DOXDATAPATH \ --title="$title" \ --api-searchbox \ --no-cleanup \ --preprocess \ $DOXARGS 2>&1 \ | grep -v '^Error: Unexpected tag `' \ | grep -v '^[Ww]arning: ignoring unsupported tag' \ | grep -v '^[Ww]arning: ignoring unknown tag' \ | sed s+/tempdocs/+/apidocs/+g > "$i.new" mv "$i.new" "$i.log" # If we need to, log the number of errors.... if [ $VERBOSE ]; then AMT=`grep ^$SRCPATH $i.log | wc -l` expr 0 + "$AMT" > /dev/null 2>&1 || AMT="0" echo "** Number of errors: $AMT" echo "** Number of applications: " `grep 'Creating apidox' "$i.log" | wc -l` echo "** Written to $i.log" fi # clean-up unneeded files ( cd $TEMPPATH; find . -name "*.map" -o -name "*.md5" | xargs rm -f ) # create one big tar file of all the goodies ( cd $TEMPPATH; tar czf $i.tar.gz $i-apidocs ) # Move the temporary output to the real apidocs location rm -rf $OUTPATH/$i-* mv -f $TEMPPATH/$i-* $OUTPATH rm -f $OUTPATH/$i.tar.gz mv -f $TEMPPATH/$i.tar.gz $OUTPATH rm -f $LOGPATH/$i.log mv -f $TEMPPATH/$i.log $LOGPATH done if [ $VERBOSE ]; then echo "* APIDOX Generation complete" fi diff --git a/apidox/src/update-dox.pl b/apidox/src/update-dox.pl index 849613a..c2ec9f8 100644 --- a/apidox/src/update-dox.pl +++ b/apidox/src/update-dox.pl @@ -1,373 +1,373 @@ #! /usr/bin/env perl # Copyright 2010 by Adriaan de Groot # # Driver script that calls nudox with appropriate arguments derived # from a config file. See $usage, below. # # # This file is released under the terms of the GNU General Public License # (GPL) version 2 or, at your option, version 3 or any later version # approved by the membership of KDE e.V. use strict; use Config::IniFiles; use File::Basename; use Getopt::Long; use Template; # Find out where this script lives (needed to find nudox and lib / share # directories as needed. use Cwd 'abs_path'; my $scriptpath = abs_path($0); die '! Cannot find my own path.\n' unless -f $scriptpath; my $prog = 'update-dox'; my $VERSION = '0.1'; my $usage = '# update-dox.pl [--verbose] [--dry-run] # [--sections=s[,s...]] # [--modules=s[,s...]] # [--srcprefix=path] [--destprefix=path] # configfile # # The configfile is an ini-style file with sections [apidox] and # [apidox name] (multiple named sections are possible) as described # in README.apidox. If you pass in --verbose, then the script will # print lots of debugging information. If you pass --dry_run, it # will not execute any commands; use --verbose --dry-run to find out # what the commands would actually be. If you use --sections, you # will generate APIDOX for exactly those named sections (use comma- # separated names as they appear in the configfile), otherwise # those sections that have an enabled=1 key will be generated. # # A section corresponds to a checkout of a whole KDE branch; # it contains SVN modules (like kdelibs or kdebase). # # By default, all modules in a section are processed; pass in # a list of modules if you want to restrict that. For instance, # to generate only kdelibs module from section (collection) trunk, # use --sections=trunk --modules=kdelibs # # Verbose will make the script print out debug messages with a # # Dry_run will make the script print the commands it will execute, # but not run them. Without dry run, verbose will print and run them. '; my $verbose = 0; my $dry_run = 0; # You can enable only specific sections (apidox collections) for generation # by passing in the names. my $section_names; my %sections; my $module_names; my %modules; # Other overrides for config values: my ($srcprefix,$destprefix); die $usage unless GetOptions( 'verbose' => \$verbose, 'dry-run' => \$dry_run, 'sections=s' => \$section_names, 'modules=s' => \$module_names, 'srcprefix=s' => \$srcprefix, 'destprefix=s' => \$destprefix, ); die $usage unless exists $ARGV[0]; my $configfile = $ARGV[0]; die $usage . '! Cannot find configuration file "' . $configfile . '"\n' unless -f $configfile; my $config = new Config::IniFiles( -file => $configfile ); die $usage . '! No [apidox] section in config file.\n' unless $config->SectionExists('apidox'); $verbose += $config->val('apidox','verbose') ? 1 : 0; ### Get the path to the nudox script, either from the configfile ### or in the same directory. my $nudox = $config->val('apidox','nudox'); $nudox = dirname($scriptpath) . '/nudox.pl' unless $nudox; die '! Cannot find a nudox.pl via configuration file or in my own directory.\n' unless -f $nudox; ### Figure out a suitable datadir based on config, idealized install ### location and the source layout. my $datadir = $config->val('apidox','datadir'); $datadir = abs_path($datadir) if $datadir; unless ($datadir) { print "# No datadir set, trying defaults.\n" if $verbose; $datadir = abs_path(dirname($scriptpath) . "/../share/apidox/"); print "# ../share/apidox unsuitable.\n" if $verbose and not $datadir; $datadir = abs_path("./data/") unless $datadir; print "# ./data/ unsuitable.\n" if $verbose and not $datadir; } die ('! Cannot find a suitable datadir.' . $datadir ? "(Tried $datadir)\n" : "\n") unless -d $datadir; ### Find a tagdir, based on config or the datadir. my $tagdir = $config->val('apidox','tagdir'); $tagdir = abs_path($tagdir) if $tagdir; unless ($tagdir) { print "# Setting tagdir to datadir ($datadir)\n" if $verbose; $tagdir = $datadir; } die '! Tag directory ' . $tagdir . " is not a directory.\n" unless -d $tagdir; $srcprefix = $config->val('apidox','srcprefix') unless $srcprefix; $destprefix = $config->val('apidox','destprefix') unless $destprefix; ### Inform the use what we've found so far print "# script = $nudox\n" if $verbose; print "# datadir = $datadir\n" if $verbose; print "# tagdir = $tagdir\n" if $verbose; ### If --sections is used, convert to a list of section names, ### normalise to [apidox name] and store those as the acceptable ### sections; otherwise go through the config and find the ones ### that are enabled. my $s; if ($section_names) { for $s (split /,/,$section_names) { print "# Enabling section $s\n" if $verbose; if ($s =~ /^apidox /) { $sections{$s}=1; } else { $sections{"apidox $s"}=1; } } } else { for $s ($config->GroupMembers('apidox')) { $sections{$s}=1 if $config->val($s,'enabled'); } } if ($module_names) { for $s (split /,/,$module_names) { print "# Enabling module $s\n" if $verbose; $modules{$s}=1; } } ### Preliminaries: list, check suitability, create directories. &listSections() if $verbose; my %commands = &checkSections(); ### Do the actual work: generate shell commands and execute them. my ($i,@cs,$cmd); for $i (keys %commands) { @cs = &produceCommand($commands{$i}); for $cmd (@cs) { print "$cmd\n" if $verbose; system($cmd) unless $dry_run; } } # If we processed the entire collection, then generate an index, too. &createIndex() unless $module_names; # Just print out the modules from the config file, listing them # with a * if they are enabled. Debugging / verbose purposes only. sub listSections() { my $first = 1; my $i; my ($enabled, $name); for $i ($config->GroupMembers('apidox')) { print $first ? '# modules = ' : '# '; $enabled = acceptSection($i) ? '* ' : ' '; $name = $i; $name =~ s/^apidox //; print $enabled . $name . "\n"; $first = 0; } } # Look in $section for $key; if that is not there, fall back # to the name of the section (with apidox removed and characters # cleaned up). Then modify relative directories to use the given # prefix. sub getDirectoryWithPrefix($$$$) { my ($config,$section,$key,$prefix) = @_; my $v; $v = $config->val($section,$key); unless ($v) { my $name = $section; $name =~ s/apidox //; $name =~ s/[^-a-zA-Z0-9_]//g; $v = $name; } unless ($v =~ /^\//) { # This is a relative path, so prepend the prefix $v = $prefix . '/' . $v; } return $v; } # Check that each section is defined sensibly. Checks if files # and directories exist, creates directories as needed, and dies # if something goes wrong. Returns a hash keyed by section name, # with lists as values; each list starts with the source, destination # directories and the tag file, followed by the names of the modules # under that directory. sub checkSections() { my $i; my $fail = 0; my %commands = (); for $i ($config->GroupMembers('apidox')) { next unless acceptSection($i); my ($src,$dest,$tag); $src = getDirectoryWithPrefix($config,$i,'srcdir',$srcprefix); unless (-d $src) { print "! $src is not a directory in $i.\n"; print "! ... no valid source directory found.\n"; $fail = 1; next; } $dest = getDirectoryWithPrefix($config,$i,'destdir',$destprefix); if (-e $dest and ! -d $dest) { print "! Destination $dest is not a directory.\n"; $fail = 1; next; } mkdir $dest; unless (-d $dest) { print "! Destination $dest is not a directory.\n"; $fail = 1; next; } $tag = $config->val($i,'qttag'); unless ($tag) { print "# No explicit Qt tag for $i, using default.\n" if $verbose; $tag = $config->val('apidox','qttag'); unless ($tag) { print "! No default value for qttag given in apidox, needed for $i.\n"; $fail = 1; next; } } unless (-f $tag) { # Adjust the tag against the tagdir $tag = $tagdir . '/' . $tag; } # Using the possibly adjusted value unless (-f $tag) { print "! No tag file found for $i.\n"; $fail = 1; next; } my @c = ($src,$dest,$tag); print "# Checking for modules under $src.\n" if $verbose; # Now find the sub-modules of that top-level directory to # determine all of the nudox invocations that we'll need. my @subdirs = &scansubdirsforfile($src,'Mainpage.dox',%modules); push @c,@subdirs; $commands{$i}=\@c; } die "! Errors found in configuration.\n" if $fail; return %commands; } sub scansubdirsforfile($$$) { my ($dir,$filename,%filter) = @_; my @subdirs = (); unless (opendir(DIR, $dir)) { print "! Cannot read $dir to find modules.\n"; return @subdirs; } @subdirs = grep { -f "$dir/$_/$filename" and not $_ =~ /^\./ } readdir(DIR); closedir(DIR); print "# ... " . (0+@subdirs) . " candidate modules.\n" if $verbose; if (%filter) { @subdirs = grep { $filter{$_} } @subdirs; print "# ... filtered down to " . (0+@subdirs) . " modules.\n" if $verbose; } return @subdirs; } # Turn the list ($src,$dest,$tag,...) into a list of nudox commands # that will do the actual generation. sub produceCommand { my(@a) = @{$_[0]}; my ($src,$dest,$tag) = ($a[0],$a[1],$a[2]); my @commands = (); my $verbose_arg = $verbose ? '--verbose' : ''; my $i = 3; # Skip the src, dest, tag items in the list while ($i <= $#a) { - push @commands,("cd '$dest' ; perl '$nudox' $verbose_arg --qtdocdir=http://qt-project.org/doc/qt-4.8 --qtdoctag='$tag' --doxdatadir='$datadir' '$src/$a[$i]'"); + push @commands,("cd '$dest' ; perl '$nudox' $verbose_arg --qtdocdir=https://doc.qt.io/archives/qt-4.8 --qtdoctag='$tag' --doxdatadir='$datadir' '$src/$a[$i]'"); $i++; } return @commands; } # Use the globally-populated %sections hash to check if the given # section (e.g. [apidox trunk]) is enabled for generation. sub acceptSection($) { my $name = $_[0]; return $sections{$name}; } sub createIndex() { my $tt; for $i ($config->GroupMembers('apidox')) { next unless acceptSection($i); print "# Creating index page for $i.\n" if $verbose; my $section_name = $i; $section_name =~ s/apidox //; my $dest; $dest = getDirectoryWithPrefix($config,$i,'destdir',$destprefix); # Look for modules generated there my @subdirs = &scansubdirsforfile($dest,'index.html',%modules); $tt = Template->new({ OUTPUT_PATH => $dest, RELATIVE => 1, ABSOLUTE => 1, STRICT => 1, DEBUG => 'undef', PRE_PROCESS => "$datadir/capacity-index-header.html", POST_PROCESS => "$datadir/capacity-index-footer.html", }) || die "! ", Template->error(), "\n"; my $date = gmtime; my $vars = { date => $date, site => "http://www.kde.org", collection => $section_name, modules => \@subdirs, }; unless ($tt->process( "$datadir/capacity-index-content.html", $vars, "index.html" )) { die "! ", $tt->error(), "\n"; } } } diff --git a/tools/parsedoxlog.sh b/tools/parsedoxlog.sh index 0452781..8b51101 100755 --- a/tools/parsedoxlog.sh +++ b/tools/parsedoxlog.sh @@ -1,183 +1,183 @@ #! /bin/sh VERBOSE=false VERSION="" # Read arguments... test "x--verbose" = "x$1" && { shift ; VERBOSE=true ; } test "x--version" = "x$1" && { shift ; VERSION="$1" ; shift ; } test -z "$VERSION" && { echo "No version given"; exit 1 ; } # Configuration # APIPATH: top-level for API stuff APIPATH=/srv/www/api.kde.org # OUTPATH: where the final output goes OUTPATH=/srv/www/englishbreakfastnetwork.org/apidocs/apidox-$VERSION # TEMPPATH: where the temporary output goes TEMPPATH=/srv/tmp/tempdocs/apidox-$VERSION # TAGPATH: where tag files (i.e, qtX.Y.tag) reside TAGPATH=$HOME/quality-kde-org/apidox/data # BINPATH: where the helper programs (i.e. doxylog2html.pl) reside BINPATH=/home/api/bin # SRCPREFIX: where the top-level KDE source code resides SRCPREFIX=/srv/sources # LOGPATH: where logs get moved LOGPATH=/srv/logs/api/$VERSION # SRCPATH: where the source code for this component resides SRCPATH=$SRCPREFIX/$VERSION # LIBSPATH: where the source code for kdelibs resides (so we can find doxygen.sh) LIBSPATH=$HOME/ # DOXDATAPATH: where the doxygen.sh data lives DOXDATAPATH=$LIBSPATH/kdelibs/doc/common # Database access variables PSQL="psql" #replace with echo when/if the database is in a bad way PSQL_FLAGS="-t -h localhost -U kde ebn" GITREV() { savepath=`pwd` cd $1 2>/dev/null if ( test $? -ne 0 ) then REV=0 else REV=`git rev-parse --short HEAD 2>/dev/null` if ( test -z "$REV" ) then REV=0 fi fi cd $savepath } # Determine the modules we need to build the documentation of... case "$VERSION" in kde-3.5|kde-4.* ) SRCPATH=$SRCPREFIX/$VERSION MODULES=`ls $SRCPATH` DOXDATAPATH=$SRCPREFIX/$VERSION/kdelibs/doc/common ;; frameworks ) SRCPATH=$SRCPREFIX/$VERSION MODULES=frameworks5 ;; * ) SRCPATH=$SRCPREFIX/$VERSION MODULES=`ls $SRCPATH` ;; esac # If argument given, use it as modules list to run test -n "$1" && MODULES="$1" # Prepare to run.... test -d "$OUTPATH" || { echo "No path $OUTPATH -- creating it" ; mkdir -p $OUTPATH || exit 1 ; } test -d "$TEMPPATH" || { echo "No path $TEMPPATH -- creating it" ; mkdir -p $TEMPPATH || exit 1 ; } test -d "$LOGPATH" || { echo "No path $LOGPATH -- creating it" ; mkdir -p $LOGPATH || exit 1 ; } test -d "$SRCPATH" || { echo "No source path $SRCPATH" ; exit 1 ; } cd "$TEMPPATH" || { echo "Cannot cd into $TEMPPATH" ; exit 1 ; } $VERBOSE && echo "* Parsing logs for $MODULES" timestamp="" # Find my flavor (dox for various versions have different flavors) if [ "$PSQL" != "echo" ]; then component=`echo "SELECT id FROM components WHERE name = '$VERSION';" | $PSQL $PSQL_FLAGS | sed 's+^\s*++'` expr 0 + "$component" > /dev/null 2>&1 || { echo "Could not get component."; exit 1 ; } flavor=`echo "SELECT id FROM tools WHERE name='dox' AND component = $component ;" | $PSQL $PSQL_FLAGS | sed 's+^\s*++'` expr 0 + "$flavor" > /dev/null 2>&1 || { echo "Could not get flavor." ; exit 1 ; } else component="kde" flavor="kde" fi # If argument (module list) given, don't overwrite log data if [ "$PSQL" != "echo" ]; then if test -z "$1" ; then timestamp=`date "+%B %d %Y %T"` # Bump generation now generation=`echo "SELECT * FROM nextval('generation') ;" | $PSQL $PSQL_FLAGS | sed 's+^\s*++'` ; else generation=`echo "SELECT generation FROM tools WHERE id = $flavor" | $PSQL $PSQL_FLAGS | sed 's+^\s*++'` ; generation=`expr 1 + "$generation"` fi else generation="1" fi expr 0 + "$generation" > /dev/null 2>&1 || { echo "Bad generation." ; exit 1 ; } $VERBOSE && { echo "* Component $component"; echo "* Tool $flavor" ; echo "* Generation $generation" ; } case "$VERSION" in kde-3.5) export QTDOCDIR=http://doc.qt.digia.com/3.3 export QTDOCTAG=$TAGPATH/qt3.3.tag ;; frameworks* ) export QTDOCDIR=http://qt-project.org/doc/qt-5.1 export QTDOCTAG=$TAGPATH/qt5.1.tag ;; * ) - export QTDOCDIR=http://qt-project.org/doc/qt-4.8 + export QTDOCDIR=https://doc.qt.io/archives/qt-4.8 export QTDOCTAG=$TAGPATH/qt4.8.tag ;; esac for i in $MODULES; do LOGFILE=$LOGPATH/$i.log test -d "$SRCPATH/$i" || { echo "Skipping $SRCPATH/$i" ; continue ; } # Just count the total number of errors AMT=`grep ^$SRCPATH $LOGFILE | wc -l` expr 0 + "$AMT" > /dev/null 2>&1 || AMT="0" $VERBOSE && { echo "* Number of errors: $AMT" ; \ echo "* Number of applications: " `grep 'Creating apidox' "$i.log" | wc -l` ; } # An impenetrable forest of awkisms. Scan the logfile, # breaking it into sections using the *** Creating # header; count total errors under a top-level application # heading (eg. dcop or kio) and print the results as # lines with # appname count # # ... then pipe that to a while loop that reads the results # and adds records to the results table for each appname. : > /tmp/doxygen.sh.$$ awk 'BEGIN {t=-1;app=""; ot="'$i'"; } /\*\*\* Creating apidox/ { napp=$5; slash=index(napp,"/"); if (slash>0) napp=substr($5,1,slash-1); if (napp!=app) { if (t>=0) print app,t; close( ot "-" app ".log" ); app=napp; t=0; print $0 > ( ot "-" app ".log" ) ; } } /^\/.*[Ww]arning/ { if (t>=0) t=t+1; } t>=0 { print $0 >> ( ot "-" app ".log" ); } END { if (t>=0) print app,t;}' $LOGFILE | \ while true ; do read APP COUNT ; test -z "$APP" && break ; echo "$APP $COUNT" >> /tmp/doxygen.sh.$$ GITREV $SRCPATH/$i/$APP $BINPATH/doxylog2html.pl --explain --export=ebn --cms="$VERSION/$i/$APP" --rev=$REV $TEMPPATH/$i-$APP.log | sed s+/tempdocs/+/apidocs/+g > $OUTPATH/$i-$APP.html; mv -f $TEMPPATH/$i-$APP.log $OUTPATH; echo "INSERT INTO results_apidox VALUES ( $generation, '$i', '$APP', $COUNT, $component, '', 'apidox-$VERSION/$i-$APP.html' ); "; done | \ $PSQL $PSQL_FLAGS > /dev/null done if [ "$PSQL" != "echo" ]; then if test -z "$1" ; then ( REV=0 #lacking anything better at the moment echo "INSERT INTO generations VALUES ( $generation, '$timestamp', (SELECT SUM(issues) FROM results_apidox WHERE generation = $generation), $flavor, $REV ) ;" echo "UPDATE tools SET generation = $generation WHERE id = $flavor ;" ) | $PSQL $PSQL_FLAGS | sed 's+^\s*++' > /dev/null fi fi rm -f /tmp/doxygen.sh.$$