lxr-commits Mailing List for LXR Cross Referencer (Page 8)
Brought to you by:
ajlittoz
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(13) |
Oct
(11) |
Nov
(19) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(11) |
Feb
(14) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
(8) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
|
Mar
(10) |
Apr
|
May
(2) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(26) |
Jul
(83) |
Aug
(4) |
Sep
(4) |
Oct
(9) |
Nov
|
Dec
(17) |
2005 |
Jan
(1) |
Feb
(71) |
Mar
(1) |
Apr
(3) |
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
(1) |
Nov
(6) |
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(35) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(12) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(30) |
Apr
(55) |
May
(28) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2013 |
Jan
(35) |
Feb
|
Mar
(7) |
Apr
(12) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(32) |
Oct
|
Nov
(45) |
Dec
(18) |
2014 |
Jan
(9) |
Feb
|
Mar
(10) |
Apr
(2) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(4) |
Dec
|
From: Andre-Littoz <ajl...@us...> - 2013-01-18 16:18:29
|
Update of /cvsroot/lxr/lxr/lib/LXR/Files In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30663/lib/LXR/Files Added Files: Mercurial.pm Log Message: Mercurial.pm, templates/Mercurial/: add Mercurial support Experimental support; still performance issue in Marcurial.pm's getdir() --- NEW FILE: Mercurial.pm --- # -*- tab-width: 4 -*- ############################################### # # $Id: Mercurial.pm,v 1.1 2013/01/18 16:18:26 ajlittoz Exp $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ############################################### =head1 Mercurial module This module subclasses the Files module for Mercurial repository. See Files POD for method information. Methods are sorted in the same order as in the super-class. =cut package LXR::Files::Mercurial; $CVSID = '$Id: Mercurial.pm,v 1.1 2013/01/18 16:18:26 ajlittoz Exp $ '; use strict; use Time::Local; use LXR::Common; @LXR::Files::Mercurial::ISA = ('LXR::Files'); our %hg; our $cache_filename = ''; sub new { my ($self, $rootpath, $params) = @_; $self = bless({}, $self); $self->{'rootpath'} = $rootpath; # $self->{'rootpath'} =~ s@/*$@@; $self->{'hg_blame'} = $$params{'hg_blame'}; $self->{'hg_annotations'} = $$params{'hg_annotations'} # Though Mercurial can provide changeset author independently # from annotations, source script design won't work without # annotations. || $$params{'hg_blame'}; $self->{'path'} = $config->{'hgpath'}; my $cmd = 'cd ' . $rootpath . ';HGRCPATH=' . $rootpath . '/hg.rc hg '; $cmd =~ m/(.*)/; $self->{'hg-cmd'} = $1; # Untaint string return $self; } sub getdir { my ($self, $pathname, $releaseid) = @_; my ($node, @dirs, @files); my $hgpath = $pathname; $hgpath =~ s,/*$,/,; # Paths on the hg command lines must not start with a slash # to be relative to 'rootpath'. Changes LXR convention. $hgpath =~ s,^/+,,; open(DIR, $$self{'hg-cmd'} . "ls-onelevel -r \"$releaseid\" \"$hgpath\" |") || die ("hg subprocess died unexpectedly: $!"); while($node = <DIR>) { chomp($node); if (substr($node, -1) eq '/') { next if $self->_ignoredirs($pathname, substr($node,0,-1)); push(@dirs, $node) } elsif (!$self->_ignorefiles($pathname, $node)) { push(@files, $node) } } closedir(DIR); return (sort(@dirs), sort(@files)); } sub getnextannotation { my ($self, $filename, $releaseid) = @_; return undef unless $self->{'hg_annotations'}; if (scalar(@{$self->{'annotations'}}) <= 0) { $self->loadline(); } return shift @{$self->{'annotations'}}; } sub getauthor { my ($self, $pathname, $releaseid, $rev) = @_; return undef unless $self->{'hg_blame'}; if (scalar(@{$self->{'authors'}}) <= 0) { $self->loadline(); } return shift @{$self->{'authors'}}; } # File designations (release-ids) are restricted to revision # numbers (full numerics), tag or branch names. sub filerev { my ($self, $filename, $releaseid) = @_; my ($rev, $outrev); $filename =~ s,^/+,,; $self->parsehg($filename); if ($releaseid !~ m/^\d+$/) { $rev = `$$self{'hg-cmd'} id -n -r \"$releaseid\"`; if (!defined($rev)) { # $releaseid not found: this is an error, but nothing is prepared # to handle it; then, return the 'tip' revision. $rev = `$$self{'hg-cmd'} id -n -r tip`; } } # First try to get the exact revision $rev =~ m/(.*)/; $rev = $1; # Untaint $rev $filename =~ m/(.*)/; $filename = $1; # Untaint $filename $outrev = `$$self{'hg-cmd'} log -r $rev --template '{rev}' $filename`; return $outrev if $outrev ne ''; # The exact revision was not found # Find now the closest revision number (in time) # since $releaseid may come from a directory request # and a file may not have exactly this revision number # in its change set. # The heuristics chosen is to retain the revision # with the highest time less than or equal to $releaseid. # NOTE: will this give correct results?. # Suggestions and contributions are welcome. `$$self{'hg-cmd'} log -r $rev --template '{date|hgdate}'` =~ m/^(\d+)\s+([+-]?\d+)\s*/; my $revtime = $1 + $2; $outrev = -1; # just in case foreach my $curtime (sort keys %{$hg{'date2rev'}}) { last if $revtime < $curtime; if ($outrev < $curtime) { $outrev = $curtime; } } if ($outrev != -1) { $outrev = $hg{'date2rev'}{$outrev}; } return $outrev; } # getfilehandle returns a handle to a pipe through which the # checked out content can be read. sub getfilehandle { my ($self, $filename, $releaseid, $withannot) = @_; my ($fileh); $filename =~ s,^/+,,; $filename =~ m/(.*)/; $filename = $1; my $rev = $self->filerev($filename, $releaseid); $rev =~ m/(.*)/; $rev = $1; if ( $withannot && $self->{'hg_annotations'} ) { my $opt = '-n'; $opt .= 'u' if $self->{'hg_blame'}; open ($fileh, $$self{'hg-cmd'} . "blame $opt -r $rev \"$filename\" 2>/dev/null |") || die("hg subprocess died unexpextedly: $!"); $self->{'fileh'} = $fileh; $self->{'nextline'} = undef; $self->{'annotations'} = []; $self->{'authors'} = []; return $self; } else { open ($fileh, $$self{'hg-cmd'} . "cat -r $rev $filename 2>/dev/null |") || die("hg subprocess died unexpextedly: $!"); return $fileh; } } sub loadline { my ($self) = @_; return if !exists $self->{'fileh'}; my $hgline = $self->{'fileh'}->getline(); if (!defined($hgline)) { delete $self->{'nextline'}; delete $self->{'fileh'}; } (my $auth, my $tag, $self->{'nextline'}) = $hgline =~ m/^\s*(\S+)\s+(\d+):\s(.*)/s; if ($self->{'hg_annotations'}) { push @{$self->{'annotations'}}, $tag; push @{$self->{'authors'}}, $auth if $self->{'hg_blame'}; } } sub getline { my ($self) = @_; return undef if !exists $self->{'fileh'}; if (!defined($self->{'nextline'})) { $self->loadline(); } return undef if !exists $self->{'nextline'}; my $line = $self->{'nextline'}; $self->{'nextline'} = undef; return $line; } # getfilesize returns the file size. sub getfilesize { my ($self, $filename, $releaseid) = @_; $filename =~ s,^/+,,; $filename =~ m/(.*)/; $filename = $1; my $rev = $self->filerev($filename, $releaseid); $rev =~ m/(.*)/; $rev = $1; my $fsize = `$$self{'hg-cmd'} fsize -r $rev $filename`; return $fsize; } # getfiletime returns the time and date the file was committed # (extracted from control info). sub getfiletime { my ($self, $filename, $releaseid) = @_; return undef if $self->isdir($filename, $releaseid); $filename =~ s,^/+,,; $self->parsehg($filename); my $rev = $self->filerev($filename, $releaseid); return $hg{'changeset'}{$rev}; } sub isdir { my ($self, $pathname, $releaseid) = @_; return substr($pathname, -1, 1) eq '/'; } sub isfile { my ($self, $pathname, $releaseid) = @_; return substr($pathname, -1, 1) ne '/'; } # # Private functions # =head2 C<alltags ($filename)> C<alltags> returns a list of all I<tags> available for the designated file. =over =item 1 C<$filename> A I<string> containing the filename =back A I<tag> is not a numeric I<revision>, it is a specific user symbol. A tag is usually associated with a software release, but may also name a branching point. Two files with the same I<release> tag are in a consistent state. The list is extracted with C<hg tags> command. =cut sub alltags { my ($self, $filename) = @_; my @tags; open(TAGS, $$self{'hg-cmd'} . 'tags |') || die("hg subprocess died unexpextedly: $!"); while( <TAGS> ) { m/^(\S+)/; push(@tags, $1); } close(TAGS); return sort @tags; } =head2 C<allbranches ($filename)> C<allbranches> returns a list of all I<revisions> available for the designated file. =over =item 1 C<$filename> A I<string> containing the filename =back The list is extracted with C<hg branches> command. =cut sub allbranches { my ($self, $filename) = @_; my @brch; open(BRANCH, $$self{'hg-cmd'} . 'branches |') || die("hg subprocess died unexpextedly: $!"); while( <BRANCH> ) { m/^(\S+)/; push(@brch, $1); } close(BRANCH); return sort @brch; } =head2 C<parsechg ($filename)> C<parsehg> builds a hash C<%hg> which summarises control information contained in the Mercurial log for file C<$filename>. =over =item 1 C<$filename> A I<string> containing the filename =back C<parsehg> parses a Mercurial log file through the C<hg log> command. It is critical for good operation of CVS class. =cut sub parsehg { my ($self, $filename) = @_; my @list; # Foolproof fence against infinite recursion return if $cache_filename eq $filename; $cache_filename = $filename; undef %hg; return if substr($filename, -1, 1) eq '/'; # we can't parse a directory $filename =~ s,^/+,,; $filename =~ m/(.*)/; $filename = $1; my $file = ''; # This log request with a template retrieves only the LXR-relevant # data, i.e. changeset-id and commit time. open(HG, $$self{'hg-cmd'} . "log --template '{rev} {date|hgdate}\n' $filename |") || die("hg subprocess died unexpextedly: $!"); while (<HG>) { # $file .= $_; # For "standard" output m/^(\d+)\s+(\d+)\s+([+-]?\d+)\s*\n/; $hg{'changeset'}{$1} = $2 + $3; $hg{'date2rev'}{$2 + $3} = $1; } close(HG); } 1; |
From: Andre-Littoz <ajl...@us...> - 2013-01-18 16:14:44
|
Update of /cvsroot/lxr/lxr/templates/Mercurial In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30284/templates/Mercurial Log Message: Directory /cvsroot/lxr/lxr/templates/Mercurial added to the repository |
From: Andre-Littoz <ajl...@us...> - 2013-01-17 09:32:51
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6433/scripts Modified Files: configure-lxr.pl Log Message: scripts/configure-lxr.pl: missing $ on variable name Index: configure-lxr.pl =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/configure-lxr.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- configure-lxr.pl 11 Jan 2013 11:53:13 -0000 1.6 +++ configure-lxr.pl 17 Jan 2013 09:32:48 -0000 1.7 @@ -515,7 +515,7 @@ , "${confdir}/${target}" ); if ($verbose) { - print "${VTbold}Mercurial{VTnorm} support files written into configuration directory\n" + print "${VTbold}Mercurial${VTnorm} support files written into configuration directory\n" } } } |
From: Andre-Littoz <ajl...@us...> - 2013-01-17 09:30:04
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6230 Modified Files: source Log Message: source, Files.pm, Files/*: new annotation retrieval strategy to allow more storage backends The present mathod is based on CVS where annotations are separately stored and retrieved as a single block while Mercurial returns an annotated line. The new method uses co-routines to retrieve lines and corresponding annotations one at a time, eventually buffering not-yet-used information internally. Index: source =================================================================== RCS file: /cvsroot/lxr/lxr/source,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- source 14 Nov 2012 18:37:46 -0000 1.62 +++ source 17 Jan 2013 09:30:00 -0000 1.63 @@ -619,6 +619,74 @@ =cut +sub next_annot { + my ($currev, $r, $bg) = @_; + + # Get annotations from the storage engine and prepare their + # layout in order to prefix every source line with its + # associated annotation. + my $rev = $files->getnextannotation($pathname, $releaseid); + return if !defined($rev); + my $auth = $files->getauthor($pathname, $releaseid, $rev); + + if ($rev eq $$r) { + $rev = ' ' x 16; + if ($$r eq $currev) { + $rev = "<span class='annot-cur'>$rev</span>"; + } else { + $rev = "<span class='annot$$bg'>$rev</span>"; + } + return $rev; + } + + $$r = $rev; + my $la = length($auth); + my $lr = length($rev); + # After this call to length, $rev may be edited to contain + # HTML element and $lr will be different from length($rev). + # $lr reflects the number of character positions necessary + # to display $rev on screen, not its content. + if ($la > 0) { + if ($lr+$la > 15) { # sum of 2 fields too long + if ( $la > 4 + && $la > 14-$lr + ) { # truncate first author + $la = 14 - $lr; + $la = 4 if $la < 4; + $auth = substr($auth, 0, $la++) + . '<span class="error">*</span>'; + } + if ($lr+$la >15) { # now truncate revision + $lr = 14 - $la; + $lr = $files->truncateannotation(\$rev, $lr); + } + } + if ($lr+$la < 15) { # some space to distribute + if ($la >= 8) { + $rev .= ' ' x (15-$lr-$la); + } elsif ($lr >= 7) { + $auth .= ' ' x (15-$lr-$la); + } else { + $rev .= ' ' x (7-$lr); + $auth .= ' ' x (8-$la); + } + } + $rev .= ' ' . $auth; + } else { + if ($lr > 16) { + $lr = $files->truncateannotation(\$rev, 15); + } else { + $rev .= ' ' x (16 - $lr); + } + } + if ($$r eq $currev) { + $rev = "<span class='annot-cur'>$rev</span>"; + } else { + $$bg = 1 - $$bg; + $rev = "<span class='annot$$bg'>$rev</span>"; + } +} + sub printfile { my $raw = shift; @@ -626,7 +694,8 @@ printdir($pathname); } else { - my $fileh = $files->getfilehandle($pathname, $releaseid); + # Request annotated content (through defined third argument) + my $fileh = $files->getfilehandle($pathname, $releaseid, !$raw); if ($fileh) { if ($raw) { @@ -661,73 +730,20 @@ . "'>View CVS Log</a>"; } - # Get annotations from the storage engine and prepare their - # layout in order to prefix every source line with its - # associated annotation. - my @ann = $files->getannotations($pathname, $releaseid); - if (@ann) { - my $currev = $files->filerev($pathname, $releaseid); - my ($rev, $r); - my $bg = 1; - foreach $rev (@ann) { - if ($rev eq $r) { - $rev = ' ' x 16; - if ($r eq $currev) { - $rev = "<span class='annot-cur'>$rev</span>"; - } else { - $rev = "<span class='annot$bg'>$rev</span>"; - } - next; - } - $r = $rev; - my $auth = $files->getauthor($pathname, $releaseid, $rev); - my $la = length($auth); - my $lr = length($rev); - if ($lr+$la > 15) { # sum of 2 fields too long - if ( $la > 4 - && $la > 14-$lr - ) { # truncate first author - $la = 14 - $lr; - $la = 4 if $la < 4; - $auth = substr($auth, 0, $la++) . "*"; - } - if ($lr+$la >15) { # now truncate revision - $lr = 13 - $la; - $rev = "<" . substr($rev, -$lr++); - } - } - if ($lr+$la < 15) { # some space to distribute - if ($la >= 8) { - $rev .= ' ' x (15-$lr-$la); - } elsif ($lr >= 7) { - $auth .= ' ' x (15-$lr-$la); - } else { - $rev .= ' ' x (7-$lr); - $auth .= ' ' x (8-$la); - } - } - $rev .= " " . $auth; - if ($r eq $currev) { - $rev = "<span class='annot-cur'>$rev</span>"; - } else { - $bg = 1 - $bg; - $rev = "<span class='annot$bg'>$rev</span>"; - } - } - } - # Markup and output the source file - my $l; + my $currev = $files->filerev($pathname, $releaseid); + my $bg = 1; + my $oldrev; my $outfun = sub { + my $l; $l = shift; - $l =~ s/(\n)/$1.shift(@ann)/ge; + $l =~ s/(\n)/$1.next_annot($currev, \$oldrev, \$bg)/ge; print $l; }; &$outfun("<pre class=\"filecontent\">\n"); markupfile($fileh, $outfun); &$outfun("</pre>\n"); } - } else { print( |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 17:38:10
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24354/lib/LXR Modified Files: Template.pm Log Message: Template.pm: correct typo on $marker name $tree marker changed to $target some time ago Index: Template.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Template.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Template.pm 21 Sep 2012 08:18:02 -0000 1.20 +++ Template.pm 11 Jan 2013 17:38:07 -0000 1.21 @@ -1628,7 +1628,7 @@ , "<html><body><hr>\n" , "<hr>\n" . "<h1 style='text-align:center'>Unrecoverable Error</h1>\n" - . "<p>Source-tree \$tree unknown</p>\n" + . "<p>Source-tree >> \$target << unknown</p>\n" . "</body></html>\n" ); |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 17:35:54
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24257/lib/LXR Modified Files: Common.pm Config.pm Log Message: Common.pm, Config.pm: improve error handling condition New method emergency in Config to tentatively recover from a "virtroot not found" error and print some user-friendly message Index: Common.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Common.pm,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -r1.102 -r1.103 --- Common.pm 14 Nov 2012 15:22:57 -0000 1.102 +++ Common.pm 11 Jan 2013 17:35:51 -0000 1.103 @@ -865,6 +865,7 @@ $config = LXR::Config->new($script_path); unless (defined $config) { + $config = LXR::Config->emergency($script_path); LXR::Template::makeerrorpage('htmlfatal'); die "Can't find config for " . $HTTP->{'this_url'}; } @@ -901,8 +902,12 @@ # on a directory name. $pathname = $HTTP->{'path_info'}; $releaseid = clean_release($config->variable('v')); + $releaseid =~ m/(.*)/; + $releaseid = $1; # untaint for future use $config->variable('v', $releaseid); # put back into config obj $pathname = fixpaths($HTTP->{'path_info'}); + $pathname =~ m/(.*)/; + $pathname = $1; # untaint for future use printhttp; } Index: Config.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Config.pm,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- Config.pm 14 Nov 2012 15:22:57 -0000 1.55 +++ Config.pm 11 Jan 2013 17:35:51 -0000 1.56 @@ -70,6 +70,25 @@ } +=head2 C<emergency ()> + +Method C<emergency> returns whatever can be retrieved from +the configuration file. + +It is intended to allow editing user-friendly error message when +a catastrophic event occurred during initialisation. + +=cut + +sub emergency { + my ($class, @parms) = @_; + my $self = {}; + bless($self); + $self->_initialize(@parms); + return ($self); +} + + =head2 C<readconfig ()> Method C<readconfig> returns the content of the configuration |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 14:43:50
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11370 Modified Files: diff Log Message: diff: improve HTML style Add class=error for warnings Index: diff =================================================================== RCS file: /cvsroot/lxr/lxr/diff,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- diff 17 Sep 2012 11:16:10 -0000 1.30 +++ diff 11 Jan 2013 14:43:47 -0000 1.31 @@ -26,7 +26,6 @@ $CVSID = '$Id$ '; use strict; -use lib '.'; # for Local.pm use lib do { $0 =~ m{(.*)/} ? "$1/lib" : "lib" }; # if LXR modules are in ./lib use LXR::Common; @@ -94,11 +93,11 @@ $diffv =~ s/v=//; unless ($files->isfile($origname, $releaseid)) { - print("*** $origname does not exist in version $releaseid ***\n"); + print("<p class='error'>*** $origname does not exist in version $releaseid ***</p>\n"); return; } unless ($files->isfile($diffname, $diffv)) { - print("*** $diffname does not exist in version $releaseid ***\n"); + print("<p class='error'>*** $diffname does not exist in version $releaseid ***</p>\n"); return; } |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 12:22:36
|
Update of /cvsroot/lxr/lxr/templates In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv348/templates Modified Files: filetype.conf Log Message: templates/filetype.conf CSS handling still faulty, despite new ctags Index: filetype.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/filetype.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- filetype.conf 21 Nov 2012 17:09:34 -0000 1.3 +++ filetype.conf 11 Jan 2013 12:22:33 -0000 1.4 @@ -87,6 +87,7 @@ , # CAVEAT - CAVEAT - CAVEAT - 2012-08-19 (ajl) # Do not enable CSS: causes segmentation fault with ctags 5.8-7 +# Parsing still problematic with ctags 5.8-9 # 'css' => # [ 'CSS' # , '(?i)\.css$' |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 12:10:12
|
Update of /cvsroot/lxr/lxr/templates/lighttpd In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31840/templates/lighttpd Modified Files: lighttpd-lxrserver.conf Log Message: Configuration process: part 5/5 Upgrade lighttpd templates to LCL Index: lighttpd-lxrserver.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/lighttpd/lighttpd-lxrserver.conf,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- lighttpd-lxrserver.conf 22 Sep 2012 13:02:23 -0000 1.4 +++ lighttpd-lxrserver.conf 11 Jan 2013 12:10:09 -0000 1.5 @@ -467,26 +467,28 @@ ## Format is "virtroot" => "%LXRroot%" ## for all 'virtroot' to be served by the same LXR server ## located in the root directory. -#@begin_O context==s +#@IF %_singlecontext% # $HTTP["url"] !~ "^/lxr/[^/]+/" { # alias.url += ("/lxr/tree1/" => "%LXRroot%/") # alias.url += ("/lxr/tree2/" => "%LXRroot%/") # alias.url += ("/lxr/tree3/" => "%LXRroot%/") # } # -#@end_O context==s -#@begin_O context==m +#@ELSE $HTTP["url"] !~ "^/lxr/[^/]+/" { -#@end_O context==m -#@begin_virtroot -#@begin_O context==m +#@ENDIF +#- - - +#- - - Note: block below is interpreted during pass 2. +#- - - +#@PASS2 here_virtroot +#@ IF !%_singlecontext% #@U alias.url += ("%virtroot%/" => "%LXRroot%/") -#@end_O context==m -#@end_virtroot -#@here_virtroot -#@begin_O context==m +#@ ENDIF +#@ENDP2 +#- - - End of second pass additions +#@IF !%_singlecontext% } -#@end_O context==m +#@ENDIF ## ------- Tell which files are CGI scripts ------ cgi.assign += ( "/source" => "" |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 12:08:51
|
Update of /cvsroot/lxr/lxr/templates/initdb In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31635/templates/initdb Modified Files: initdb-m-template.sql initdb-o-template.sql initdb-p-template.sql initdb-s-template.sql Log Message: Configuration process: part 4/5 Upgrade initdb templates to LCL Index: initdb-m-template.sql =================================================================== RCS file: /cvsroot/lxr/lxr/templates/initdb/initdb-m-template.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- initdb-m-template.sql 14 Nov 2012 11:28:13 -0000 1.2 +++ initdb-m-template.sql 11 Jan 2013 12:08:48 -0000 1.3 @@ -32,108 +32,98 @@ of a single mysql invocation. -*/ /*--*/ /*--*/ -/*@begin_O createglobals==1*/ -/*@X echo "*** MySQL - Creating global user %DB_user%"*/ -/*@X mysql -u root -p <<END_OF_USER*/ +/*@IF %_createglobals% */ +/*@XQT echo "*** MySQL - Creating global user %DB_user%"*/ +/*@XQT mysql -u root -p <<END_OF_USER*/ drop user '%DB_user%'@'localhost'; -/*@X END_OF_USER*/ -/*@X mysql -u root -p <<END_OF_USER*/ +/*@XQT END_OF_USER*/ +/*@XQT mysql -u root -p <<END_OF_USER*/ create user '%DB_user%'@'localhost' identified by '%DB_password%'; grant all on *.* to '%DB_user%'@'localhost'; -/*@X END_OF_USER*/ -/*@end_O createglobals==1*/ -/*@begin_O dbuseroverride==1*/ -/*@X echo "*** MySQL - Creating tree user %DB_tree_user%"*/ -/*@X mysql -u root -p <<END_OF_USER*/ +/*@XQT END_OF_USER*/ +/*@ENDIF %_createglobals% */ +/*@IF %_dbuseroverride% */ +/*@XQT echo "*** MySQL - Creating tree user %DB_tree_user%"*/ +/*@XQT mysql -u root -p <<END_OF_USER*/ create user '%DB_tree_user%'@'localhost'; -/*@X END_OF_USER*/ -/*@X mysql -u root -p <<END_OF_USER*/ +/*@XQT END_OF_USER*/ +/*@XQT mysql -u root -p <<END_OF_USER*/ create user '%DB_tree_user%'@'localhost' identified by '%DB_tree_password%'; grant all on *.* to '%DB_tree_user%'@'localhost'; -/*@X END_OF_USER*/ -/*@end_O dbuseroverride==1*/ +/*@XQT END_OF_USER*/ +/*@ENDIF %_dbuseroverride% */ /*--*/ /*--*/ /*- Create databases under LXR user -*//*- to activate place "- * /" at end of line (without spaces) -*/ -/*@begin_O createglobals==1*/ -/*@begin_O dbpolicy==g*/ -/*@X echo "*** MySQL - Creating global database %DB_name%"*/ -/*@X mysql -u %DB_user% -p%DB_password% <<END_OF_CREATE*/ +/*@IF %_createglobals% && %_globaldb% */ +/*@XQT echo "*** MySQL - Creating global database %DB_name%"*/ +/*@XQT mysql -u %DB_user% -p%DB_password% <<END_OF_CREATE*/ drop database if exists %DB_name%; create database %DB_name%; -/*@X END_OF_CREATE*/ -/*@end_O dbpolicy==g*/ -/*@end_O createglobals==1*/ -/*@begin_O dbpolicy==t*/ -/*@X echo "*** MySQL - Creating tree database %DB_name%"*/ -/*@begin_O dbuseroverride==1*/ -/*@X mysql -u %DB_tree_user% -p%DB_tree_password% <<END_OF_CREATE*/ -/*@end_O dbuseroverride==1*/ -/*@begin_O dbuseroverride==0*/ -/*@X mysql -u %DB_user% -p%DB_password% <<END_OF_CREATE*/ -/*@end_O dbuseroverride==0*/ +/*@XQT END_OF_CREATE*/ +/*@ENDIF*/ +/*@IF !%_globaldb% */ +/*@XQT echo "*** MySQL - Creating tree database %DB_name%"*/ +/*@IF %_dbuseroverride% */ +/*@XQT mysql -u %DB_tree_user% -p%DB_tree_password% <<END_OF_CREATE*/ +/*@ELSE*/ +/*@XQT mysql -u %DB_user% -p%DB_password% <<END_OF_CREATE*/ +/*@ENDIF*/ drop database if exists %DB_name%; create database %DB_name%; -/*@X END_OF_CREATE*/ -/*@end_O dbpolicy==t*/ +/*@XQT END_OF_CREATE*/ +/*@ENDIF !%_globaldb% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ /*- Create databases under master user, may be restricted by site rules -*//*- to activate place "- * /" at end of line (without spaces) -/*@begin_O createglobals==1*/ -/*@begin_O dbpolicy==g*/ -/*@X echo "*** MySQL - Creating global database %DB_name%"*/ -/*@X mysql -u root -p <<END_OF_CREATE*/ +/*@IF %_createglobals% && %_globaldb% */ +/*@XQT echo "*** MySQL - Creating global database %DB_name%"*/ +/*@XQT mysql -u root -p <<END_OF_CREATE*/ drop database if exists %DB_name%; create database %DB_name%; -/*@X END_OF_CREATE*/ -/*@end_O dbpolicy==g*/ -/*@end_O createglobals==1*/ -/*@begin_O dbpolicy==t*/ -/*@X echo "*** MySQL - Creating tree database %DB_name%"*/ -/*@X mysql -u root -p <<END_OF_CREATE*/ +/*@XQT END_OF_CREATE*/ +/*@ENDIF*/ +/*@IF !%_globaldb% */ +/*@XQT echo "*** MySQL - Creating tree database %DB_name%"*/ +/*@XQT mysql -u root -p <<END_OF_CREATE*/ drop database if exists %DB_name%; create database %DB_name%; -/*@X END_OF_CREATE*/ -/*@end_O dbpolicy==t*/ +/*@XQT END_OF_CREATE*/ +/*@ENDIF !%_globaldb% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ -/*@X echo "*** MySQL - Configuring tables %DB_tbl_prefix% in database %DB_name%"*/ +/*@XQT echo "*** MySQL - Configuring tables %DB_tbl_prefix% in database %DB_name%"*/ /*- Create tables under LXR user -*//*- to activate place "- * /" at end of line (without spaces) -*/ -/*@begin_O createglobals==1*/ -/*@begin_O dbpolicy==g*/ -/*@X mysql -u %DB_user% -p%DB_password% <<END_OF_TEMPLATE*/ -/*@end_O dbpolicy==g*/ -/*@end_O createglobals==1*/ -/*@begin_O dbpolicy==t*/ -/*@begin_O dbuseroverride==1*/ -/*@X mysql -u %DB_tree_user% -p%DB_tree_password% <<END_OF_TEMPLATE*/ -/*@end_O dbuseroverride==1*/ -/*@begin_O dbuseroverride==0*/ -/*@X mysql -u %DB_user% -p%DB_password% <<END_OF_TEMPLATE*/ -/*@end_O dbuseroverride==0*/ -/*@end_O dbpolicy==t*/ +/*@IF %_createglobals% && %_globaldb% */ +/*@XQT mysql -u %DB_user% -p%DB_password% <<END_OF_TEMPLATE*/ +/*@ENDIF*/ +/*@IF !%_globaldb% */ +/*@IF %_dbuseroverride% */ +/*@XQT mysql -u %DB_tree_user% -p%DB_tree_password% <<END_OF_TEMPLATE*/ +/*@ELSE*/ +/*@XQT mysql -u %DB_user% -p%DB_password% <<END_OF_TEMPLATE*/ +/*@ENDIF*/ +/*@ENDIF !%_globaldb% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ /*- Create tables under master user, may be restricted by site rules -*//*- to activate place "- * /" at end of line (without spaces) -/*@begin_O createglobals==1*/ -/*@begin_O dbpolicy==g*/ -/*@X mysql -u root -p <<END_OF_TEMPLATE*/ -/*@end_O dbpolicy==g*/ -/*@end_O createglobals==1*/ -/*@begin_O dbpolicy==t*/ -/*@X mysql -u root -p <<END_OF_TEMPLATE*/ -/*@end_O dbpolicy==t*/ +/*@IF %_createglobals% && %_globaldb% */ +/*@XQT mysql -u root -p <<END_OF_TEMPLATE*/ +/*@ENDIF*/ +/*@IF !%_globaldb% */ +/*@XQT mysql -u root -p <<END_OF_TEMPLATE*/ +/*@ENDIF !%_globaldb% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ @@ -349,5 +339,5 @@ set session foreign_key_checks = @old_check; end// delimiter ; -/*@X END_OF_TEMPLATE*/ +/*@XQT END_OF_TEMPLATE*/ Index: initdb-o-template.sql =================================================================== RCS file: /cvsroot/lxr/lxr/templates/initdb/initdb-o-template.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- initdb-o-template.sql 14 Nov 2012 11:28:13 -0000 1.2 +++ initdb-o-template.sql 11 Jan 2013 12:08:48 -0000 1.3 @@ -27,8 +27,8 @@ * ************************************************************** -*/ -/*@X echo "*** Oracle - Database creation (!!! untested !!!) ***" */ -/*@sqlplus <<END_OF_TABLES*/ +/*@XQT echo "*** Oracle - Database creation (!!! untested !!!) ***" */ +/*@XQT sqlplus <<END_OF_TABLES*/ -- *** -- *** CAUTION -CAUTION - CAUTION *** -- *** @@ -338,4 +338,4 @@ commit; quit -/*@END_OF_TABLES*/ +/*@XQT END_OF_TABLES*/ Index: initdb-p-template.sql =================================================================== RCS file: /cvsroot/lxr/lxr/templates/initdb/initdb-p-template.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- initdb-p-template.sql 14 Nov 2012 11:28:13 -0000 1.2 +++ initdb-p-template.sql 11 Jan 2013 12:08:48 -0000 1.3 @@ -32,108 +32,100 @@ of a single psql invocation. -*/ /*--*/ /*--*/ -/*@begin_O createglobals==1*/ -/*@X echo "Note: deletion of user below fails if it owns databases"*/ -/*@X echo " and other objects."*/ -/*@X echo " If you want to keep some databases, ignore the error"*/ -/*@X echo " Otherwise, manually delete the objects"*/ -/*@X echo " and relaunch this script."*/ -/*@begin_O dbuser*/ -/*@X echo "*** PostgreSQL - Creating global user %DB_user%"*/ -/*@X dropuser -U postgres %DB_user%*/ -/*@X createuser -U postgres %DB_user% -d -P -R -S*/ -/*@end_O dbuser*/ -/*@end_O createglobals==1*/ -/*@begin_O dbuseroverride==1*/ -/*@X echo "*** PostgreSQL - Creating tree user %DB_tree_user%"*/ -/*@X dropuser -U postgres %DB_tree_user%*/ -/*@X createuser -U postgres %DB_tree_user% -d -P -R -S*/ -/*@end_O dbuseroverride==1*/ +/*@IF %_createglobals% */ +/*@XQT echo "Note: deletion of user below fails if it owns databases"*/ +/*@XQT echo " and other objects."*/ +/*@XQT echo " If you want to keep some databases, ignore the error"*/ +/*@XQT echo " Otherwise, manually delete the objects"*/ +/*@XQT echo " and relaunch this script."*/ +/*@IF %_dbuser%*/ +/*@XQT echo "*** PostgreSQL - Creating global user %DB_user%"*/ +/*@XQT dropuser -U postgres %DB_user%*/ +/*@XQT createuser -U postgres %DB_user% -d -P -R -S*/ +/*@ENDIF %_dbuser%*/ +/*@ENDIF %_createglobals% */ +/*@IF %_dbuseroverride% */ +/*@XQT echo "*** PostgreSQL - Creating tree user %DB_tree_user%"*/ +/*@XQT dropuser -U postgres %DB_tree_user%*/ +/*@XQT createuser -U postgres %DB_tree_user% -d -P -R -S*/ +/*@ENDIF %_dbuseroverride% */ /*--*/ /*--*/ /*- Create databases under LXR user but it prevents from deleting user if databases exist -*//*- to activate place "- * /" at end of line (without spaces) -*/ -/*@begin_O createglobals==1*/ -/*@begin_O dbpolicy==g*/ -/*@X echo "*** PostgreSQL - Creating global database %DB_name%"*/ -/*@X dropdb -U %DB_user% %DB_name%*/ -/*@X createdb -U %DB_user% %DB_name%*/ -/*@end_O dbpolicy==g*/ -/*@end_O createglobals==1*/ -/*@begin_O dbpolicy==t*/ -/*@begin_O dbuseroverride==1*/ -/*@X echo "*** PostgreSQL - Creating tree database %DB_name%"*/ -/*@X dropdb -U %DB_tree_user% %DB_name%*/ -/*@X createdb -U %DB_tree_user% %DB_name%*/ -/*@end_O dbuseroverride==1*/ -/*- When an overriding username is already known, dbuseroverride is left +/*@IF %_createglobals% && %_globaldb% */ +/*@XQT echo "*** PostgreSQL - Creating global database %DB_name%"*/ +/*@XQT dropdb -U %DB_user% %DB_name%*/ +/*@XQT createdb -U %DB_user% %DB_name%*/ +/*@ENDIF*/ +/*@IF !%_globaldb% */ +/*@IF %_dbuseroverride% */ +/*@XQT echo "*** PostgreSQL - Creating tree database %DB_name%"*/ +/*@XQT dropdb -U %DB_tree_user% %DB_name%*/ +/*@XQT createdb -U %DB_tree_user% %DB_name%*/ +/*@ELSE*/ +/*- When an overriding username is already known, %_dbuseroverride% is left * equal to zero to prevent generating a duplicate user. We must however * test the existence of %DB_tree_user% to operate under the correct * DB owner. -*/ -/*@begin_O dbuseroverride==0*/ -/*@X echo "*** PostgreSQL - Creating tree database %DB_name%"*/ -/*@begin_M DB_tree_user*/ -/*@X dropdb -U %DB_tree_user% %DB_name%*/ -/*@X createdb -U %DB_tree_user% %DB_name%*/ -/*@end_M DB_tree_user*/ -/*@begin_M !DB_tree_user*/ -/*@X dropdb -U %DB_user% %DB_name%*/ -/*@X createdb -U %DB_user% %DB_name%*/ -/*@end_M !DB_tree_user*/ -/*@end_O dbuseroverride==0*/ -/*@end_O dbpolicy==t*/ +/*@XQT echo "*** PostgreSQL - Creating tree database %DB_name%"*/ +/*@IF %DB_tree_user% */ +/*@XQT dropdb -U %DB_tree_user% %DB_name%*/ +/*@XQT createdb -U %DB_tree_user% %DB_name%*/ +/*@ELSE*/ +/*@XQT dropdb -U %DB_user% %DB_name%*/ +/*@XQT createdb -U %DB_user% %DB_name%*/ +/*@ENDIF %DB_tree_user% */ +/*@ENDIF %_dbuseroverride% */ +/*@ENDIF !%_globaldb% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ /*- Create databases under master user, usually postgres may be restricted by site rules -*//*- to activate place "- * /" at end of line (without spaces) -/*@begin_O createglobals==1*/ -/*@begin_O dbpolicy==g*/ -/*@X echo "*** PostgreSQL - Creating global database %DB_name%"*/ -/*@X dropdb -U postgres %DB_name%*/ -/*@X createdb -U postgres %DB_name%*/ -/*@end_O dbpolicy==g*/ -/*@end_O createglobals==1*/ -/*@begin_O dbpolicy==t*/ -/*@X echo "*** PostgreSQL - Creating tree database %DB_name%"*/ -/*@X dropdb -U postgres %DB_name%*/ -/*@X createdb -U postgres %DB_name%*/ -/*@end_O dbpolicy==t*/ +/*@IF %_createglobals% && %_globaldb% */ +/*@XQT echo "*** PostgreSQL - Creating global database %DB_name%"*/ +/*@XQT dropdb -U postgres %DB_name%*/ +/*@XQT createdb -U postgres %DB_name%*/ +/*@ENDIF*/ +/*@IF !%_globaldb% */ +/*@XQT echo "*** PostgreSQL - Creating tree database %DB_name%"*/ +/*@XQT dropdb -U postgres %DB_name%*/ +/*@XQT createdb -U postgres %DB_name%*/ +/*@ENDIF !%_globaldb% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ -/*@X echo "*** PostgreSQL - Configuring tables %DB_tbl_prefix% in database %DB_name%"*/ +/*@XQT echo "*** PostgreSQL - Configuring tables %DB_tbl_prefix% in database %DB_name%"*/ /*- Create databases under LXR user * but it prevents from deleting user if databases exist * * Note: - * When an overriding username is already known, dbuseroverride is left + * When an overriding username is already known, %_dbuseroverride% is left * equal to zero to prevent generating a duplicate user. We must however * test the existence of %DB_tree_user% to register the correct DB owner. * -*//*- to activate place "- * /" at end of line (without spaces) -*/ -/*@begin_O dbuseroverride==1*/ -/*@X psql -q -U %DB_tree_user% %DB_name% <<END_OF_TABLES*/ -/*@end_O dbuseroverride==1*/ -/*@begin_O dbuseroverride==0*/ -/*@begin_M DB_tree_user*/ -/*@X psql -q -U %DB_tree_user% %DB_name% <<END_OF_TABLES*/ -/*@end_M DB_tree_user*/ -/*@begin_M !DB_tree_user*/ -/*@X psql -q -U %DB_user% %DB_name% <<END_OF_TABLES*/ -/*@end_M !DB_tree_user*/ -/*@end_O dbuseroverride==0*/ +/*@IF %_dbuseroverride% */ +/*@XQT psql -q -U %DB_tree_user% %DB_name% <<END_OF_TABLES*/ +/*@ELSE*/ +/*@IF %DB_tree_user% */ +/*@XQT psql -q -U %DB_tree_user% %DB_name% <<END_OF_TABLES*/ +/*@ELSE*/ +/*@XQT psql -q -U %DB_user% %DB_name% <<END_OF_TABLES*/ +/*@ENDIF %DB_tree_user% */ +/*@ENDIF %_dbuseroverride% */ /*- end of disable/enable comment -*/ /*--*/ /*--*/ /*- Create databases under master user, usually postgres may be restricted by site rules -*//*- to activate place "- * /" at end of line (without spaces) -/*@X psql -q -U postgres %DB_name% <<END_OF_TABLES*/ +/*@XQT psql -q -U postgres %DB_name% <<END_OF_TABLES*/ /*- end of disable/enable comment -*/ drop sequence if exists %DB_tbl_prefix%filenum; drop sequence if exists %DB_tbl_prefix%symnum; @@ -195,23 +187,21 @@ create function %DB_tbl_prefix%erasefile() returns trigger language PLpgSQL -/*@begin_O shell*/ +/*@IF %_shell% */ as \$\$ -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ as $$ -/*@end_O !shell*/ +/*@ENDIF %_shell% */ begin delete from %DB_tbl_prefix%files where fileid = old.fileid; return old; end; -/*@begin_O shell*/ +/*@IF %_shell% */ \$\$; -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ $$; -/*@end_O !shell*/ +/*@ENDIF %_shell% */ drop trigger if exists %DB_tbl_prefix%remove_file on %DB_tbl_prefix%status; @@ -247,24 +237,22 @@ * by the process PID. It must then be quoted if the * resulting file is intended to be executed as a script. -*/ -/*@begin_O shell*/ +/*@IF %_shell% */ as \$\$ -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ as $$ -/*@end_O !shell*/ +/*@ENDIF %_shell% */ begin update %DB_tbl_prefix%status set relcount = relcount + 1 where fileid = new.fileid; return new; end; -/*@begin_O shell*/ +/*@IF %_shell% */ \$\$; -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ $$; -/*@end_O !shell*/ +/*@ENDIF %_shell% */ drop trigger if exists %DB_tbl_prefix%add_release on %DB_tbl_prefix%releases; @@ -282,12 +270,11 @@ create function %DB_tbl_prefix%decrel() returns trigger language PLpgSQL -/*@begin_O shell*/ +/*@IF %_shell% */ as \$\$ -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ as $$ -/*@end_O !shell*/ +/*@ENDIF %_shell% */ begin update %DB_tbl_prefix%status set relcount = relcount - 1 @@ -298,12 +285,11 @@ and relcount > 0; return old; end; -/*@begin_O shell*/ +/*@IF %_shell%*/ \$\$; -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ $$; -/*@end_O !shell*/ +/*@ENDIF %_shell% */ drop trigger if exists %DB_tbl_prefix%remove_release on %DB_tbl_prefix%releases; @@ -343,12 +329,11 @@ create function %DB_tbl_prefix%decsym() returns trigger language PLpgSQL -/*@begin_O shell*/ +/*@IF %_shell% */ as \$\$ -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ as $$ -/*@end_O !shell*/ +/*@ENDIF %_shell% */ begin update %DB_tbl_prefix%symbols set symcount = symcount - 1 @@ -356,12 +341,11 @@ and symcount > 0; return old; end; -/*@begin_O shell*/ +/*@IF %_shell% */ \$\$; -/*@end_O shell*/ -/*@begin_O !shell*/ +/*@ELSE*/ $$; -/*@end_O !shell*/ +/*@ENDIF %_shell% */ /* Definitions */ /* symid: refers to symbol name @@ -439,5 +423,5 @@ grant select on %DB_tbl_prefix%usages to public; grant select on %DB_tbl_prefix%status to public; grant select on %DB_tbl_prefix%langtypes to public; -/*@X END_OF_TABLES*/ +/*@XQT END_OF_TABLES*/ Index: initdb-s-template.sql =================================================================== RCS file: /cvsroot/lxr/lxr/templates/initdb/initdb-s-template.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- initdb-s-template.sql 14 Nov 2012 11:28:13 -0000 1.2 +++ initdb-s-template.sql 11 Jan 2013 12:08:48 -0000 1.3 @@ -28,8 +28,8 @@ -*/ /*--*/ /*--*/ -/*@X echo "*** SQLite - Configuring tables %DB_tbl_prefix% in database %DB_name%"*/ -/*@X sqlite3 %DB_name% <<END_OF_TABLES*/ +/*@XQT echo "*** SQLite - Configuring tables %DB_tbl_prefix% in database %DB_name%"*/ +/*@XQT sqlite3 %DB_name% <<END_OF_TABLES*/ drop table if exists %DB_tbl_prefix%filenum; drop table if exists %DB_tbl_prefix%symnum; drop table if exists %DB_tbl_prefix%typenum; @@ -257,5 +257,5 @@ where symid = old.symid and symcount > 0; end; -/*@X END_OF_TABLES*/ +/*@XQT END_OF_TABLES*/ |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 12:06:17
|
Update of /cvsroot/lxr/lxr/templates/Apache In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31474/templates/Apache Modified Files: apache-lxrserver.conf apache2-require.pl Log Message: Configuration process: part 3/5 Upgrade Apache templates Index: apache-lxrserver.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/Apache/apache-lxrserver.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- apache-lxrserver.conf 22 Sep 2012 12:49:45 -0000 1.3 +++ apache-lxrserver.conf 11 Jan 2013 12:06:13 -0000 1.4 @@ -16,8 +16,11 @@ # # Uncomment for multiple trees operation # ----------------> absolute path to the LXR root directory -#=m= AliasMatch ^/lxr/[^/]+/(.*) "%LXRroot%/$1" - +#@IF %_singlecontext% +# AliasMatch ^/lxr/[^/]+/(.*) "%LXRroot%/$1" +#@ELSE + AliasMatch ^/lxr/[^/]+/(.*) "%LXRroot%/$1" +#@ENDIF # ================================================= # @@ -25,7 +28,11 @@ # # Uncomment for single tree operation # ----------------> absolute path to the LXR root directory -#=s= Alias /lxr "%LXRroot%" +#@IF %_singlecontext% + Alias /lxr "%LXRroot%" +#@ELSE +# Alias /lxr "%LXRroot%" +#@ENDIF # ================================================= @@ -60,11 +67,11 @@ # versions of mod_perl. <IfDefine MODPERL2> # ----------------> absolute path to the LXR root directory - PerlPostConfigRequire %LXRroot%/custom.d/apache2-require.pl + PerlPostConfigRequire %LXRroot%/%LXRconfdir%/apache2-require.pl </IfDefine> <IfDefine !MODPERL2> # ----------------> absolute path to the LXR root directory - PerlRequire %LXRroot%/custom.d/apache2-require.pl + PerlRequire %LXRroot%/%LXRconfdir%/apache2-require.pl </IfDefine> </IfModule> Index: apache2-require.pl =================================================================== RCS file: /cvsroot/lxr/lxr/templates/Apache/apache2-require.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- apache2-require.pl 23 Jan 2012 08:55:02 -0000 1.1 +++ apache2-require.pl 11 Jan 2013 12:06:14 -0000 1.2 @@ -1,4 +1,16 @@ #!/usr/bin/env perl -w +# Apache mod_perl additional configuration file +# +#- $Id$ +#- +#- +#- This configuration file is fully configured by script +#- configure-lxr.pl (along with all other files). +#- +# If configured manually, it could be worth to use relative +# file paths so that this file is location independent. +# Relative file paths are here relative to LXR root directory. + @INC= ( @INC , "%LXRroot%" # <- LXR root directory , "%LXRroot%/lib" # <- LXR library directory |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 12:04:31
|
Update of /cvsroot/lxr/lxr/templates In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31377/templates Modified Files: lxr.conf lxrkernel.conf Added Files: datastorage.conf.part global.conf.part Log Message: Configuration process: part 2/5 Upgrade configuration templates lxr.conf & lxrkernel.conf changed to new LCL, using common parts global.conf.part & datastorage.conf.part --- NEW FILE: datastorage.conf.part --- #- -*- mode: perl -*- #- LXR master configuration file #- Tree configuration section #- Data storage subsection #- #- $Id: datastorage.conf.part,v 1.1 2013/01/11 12:04:27 ajlittoz Exp $ #- #- #- This file fragment is meant to be "included" to form the #- complete configuration file. #- #- #- # Data storage subsection # #- #=========================# #- #@LOG Configuring data storage # The DBI identifier for the database to use # For MySQL, the format is dbi:mysql:dbname=<name> # for Postgres, it is dbi:Pg:dbname=<name>;host=localhost # for Oracle, it is dbi:Oracle:host=localhost;sid=DEVMMS;port=1521 # for SQLite, it is dbi:SQLite:dbname=<filename> #@CASE %_dbengine% #- ----- MySQL ----- #@m: #@ IF !%_globaldb% #@ ASK --- Database name?; -2 #@ DEFINE DB_name="%A%" #@ ENDIF , 'dbname' => 'dbi:mysql:dbname=%DB_name%' #- #- ----- Oracle ----- #@o: , 'dbname' => 'dbi:Oracle:host=localhost;sid=DEVMMS;port=1521' #- #- ----- PostgreSQL ----- #@p: #@ IF !%_globaldb% #@ ASK --- Database name?; -2 #@ DEFINE DB_name="%A%" #@ ENDIF , 'dbname' => 'dbi:Pg:dbname=%DB_name%;host=localhost' #- #- ----- SQLite ----- #@s: #@ IF !%_globaldb% #@ ASK --- Database file? (e.g. /home/myself/storage.db); -2 #@ DEFINE DB_name="%A%" #@ ENDIF , 'dbname' => 'dbi:SQLite:dbname=%DB_name%' #@ENDC %_dbengine% #- #- #@IF %_dbengine% ne "s" #@ IF !%_dbuser% #@ ASK --- DB user name?; -1; ; lxr #@ DEFINE DB_tree_user="%A%" #@ ASK --- DB password?; -1; ; lxrpw #@ DEFINE DB_tree_password="%A%" , 'dbuser' => '%DB_tree_user%' , 'dbpass' => '%DB_tree_password%' #- #@ ELSEIF !%_globaldb% #@ ASK,C Do you want to override the global '%DB_user%' user name?; 2; yes,no; Y,N #@ IF %C% eq "Y" #@ ASK --- DB user name?; -1; ; lxr #@ DEFINE DB_tree_user="%A%" #@ ASK --- DB password?; -1; ; lxrpw #@ DEFINE DB_tree_password="%A%" , 'dbuser' => '%DB_tree_user%' , 'dbpass' => '%DB_tree_password%' #@ ELSE # If you need to specify the username or password for the database connection, # uncomment the following two lines # , 'dbuser' => 'lxr' # , 'dbpass' => 'lxrpw' #@ ENDIF #@ ENDIF #@ENDIF %_dbengine% ne "s" #- #- #@IF !%_dbprefix% #@ ASK --- DB table prefix?; -1; ; lxr_ #@ DEFINE DB_tbl_prefix="%A%" , 'dbprefix' => '%DB_tbl_prefix%' #- #@ELSEIF !%_globaldb% #@ ASK,C Do you want to override the global '%DB_global_prefix%' table prefix?; 2; yes,no; Y,N #@ IF %C% eq "Y" #@ ASK --- DB table prefix?; -1; ; lxr_ #@ DEFINE DB_tbl_prefix="%A%" , 'dbprefix' => '%DB_tbl_prefix%' #@ ELSE # If you need multiple lxr configurations in one database, set different table # prefixes for them. # , 'dbprefix' => 'lxr_' #@ ENDIF #@ENDIF %_dbprefix% # The following two parameters are now automatically # generated from 'glimpsedirbase' or 'swishdirbase' and # 'virtroot'. # They may nevertheless be overridden here by uncommenting # them and filling-in an appropriate absolute path. # For using glimpse, the directory to store the .glimpse files in is required # , 'glimpsedir' => '/path/to/glimpse/databases' # Location of swish-e index database files if using swish-e # , 'swishdir' => '/path/to/swish/databases' --- NEW FILE: global.conf.part --- #- -*- mode: perl -*- #- LXR master configuration file #- Global configuration section #- #- $Id: global.conf.part,v 1.1 2013/01/11 12:04:27 ajlittoz Exp $ #- #- #- This file fragment is meant to be "included" to form the #- complete configuration file. #- #- #- ################################ #- # Global configuration section # #- ################################ #- { # Auxiliary tools subsection # #============================# #@LOG Configuring auxiliary tool paths #- Place where lxr can write temporary files 'tmpdir' => '/tmp' #- Define this OR the swish-e variable depending which search engine you want to use. #- Path to glimpse executables. #- e.g.: , 'glimpsebin' => '/usr/local/bin/glimpse' #@U , 'glimpsebin' => '%glimpse%' #@U , 'glimpseindex' => '%glimpseindex%' #@U , 'glimpsedirbase' => '%glimpsedirbase%' #- Location of SWISH-E binary #- e.g.: , 'swishbin' => '/usr/local/bin/swish-e' #@U , 'swishbin' => '%swish%' #@U , 'swishdirbase' => '%swishdirbase%' #- Location of the SWISH-E.conf file , 'swishconf' => '%LXRroot%/templates/swish-e.conf' #- Path to Exuberant Ctags executable , 'ectagsbin' => '%ctags%' #- Location of the ectags.conf file , 'ectagsconf' => '%LXRroot%/templates/ectags.conf' #- Paths for CVS module , 'cvspath' => '/bin:/usr/local/bin:/usr/bin:/usr/sbin' # Computer DNS names subsection # #================================ #@LOG Configuring host name or IP (as http://...) #@ASK --- Host name?; -2 , 'host_names' => [ '%A%' #@KEEPON --- Alias name ? (hit return to stop) , '%A%' #@ENDK #- , //localhost #- , https://192.168.1.1 #- , 'http://mycomputer.outside.domain:12345' ] # HTML subsection # #=================# #@LOG Configuring HTML parameters # All paths in this subsection are relative to LXR root directory # Templates used for headers and footers , 'htmlfatal' => 'templates/html/html-fatal.html' #@MSG 'Buttons-and-menus' interface is recommended for the kernel #@MSG to avoid screen cluttering. #@ASK --- Use 'buttons-and-menus' instead of 'link' interface?; 1;yes, no; Y, N #@IF %A% eq "Y" , 'htmlhead' => 'templates/html/html-head-btn.html' #@ELSE , 'htmlhead' => 'templates/html/html-head.html' #@ENDIF , 'htmltail' => 'templates/html/html-tail.html' , 'htmldir' => 'templates/html/html-dir-indexing.html' # If you do not need the "last indexed" column in directory # display (e.g. for a stable unchanging tree), erase the # '-indexing' suffix above. , 'htmlident' => 'templates/html/html-ident.html' , 'htmlsearch' => 'templates/html/html-search-%search_engine%.html' , 'htmlconfig' => 'templates/html/html-config.html' # htmlhead and htmltail can be customised for the various # LXR operations. Just replace html by source (listing file), # sourcedir (displaying directory), diff (difference markup), # ident (identifier search), search (free-text search) # as below (which changes nothing): # , 'sourcehead' => 'templates/html/html-head.html' # , 'sourcedirhead' => 'templates/html/html-head.html' # showconfig script is a bit special since "version" has # no meaning for it. Better to wipe out the 'variables' selection # links with an adequate header: , 'showconfighead' => 'templates/html/config-head-btn-smaller.html' # Default character width of left version (for diff) , 'diffleftwidth' => 50 # Default identifier search constraint (for ident) # , 'identdefonly' => 1 # CSS style sheet , 'stylesheet' => 'templates/lxr.css' , 'alternate_stylesheet' => [ 'templates/classic.css' ] # Default character encoding , 'encoding' => 'utf-8' # File management subsection # #============================# #@LOG Configuring file subsection # Which files should be excluded from indexing (and display). , 'ignorefiles' => '^\\.|~$|\\.(o|a|orig)$|^CVS$|^core$' # Which extensions to treat as images when browsing. If a file is an image, # it is displayed. , 'graphicfile' => 'bitmap|bmp|gif|icon?|jp2|jpe?g|pjpe?g|png|svg|tiff?|xbm|xpm' # Which file extensions are associated with which icon # Below is an example using 'Oxygen' theme available with KDE # small-icons/ is a symbolic link to # /usr/share/icons/oxygen/22x22/mimetypes/ # (This location is valid for Fedora distributions, # check for others) # , 'iconfolder' => 'small-icons/' # Don't forget the final / above. # , 'icons' => # { 'c|pc' => 'text-x-csrc.png' # , 'h|hh' => 'text-x-chdr.png' # , 'c\+\+|cc|cpp|cxx' => 'text-x-c++src.png' # , 'hpp|hxx|h\+\+' => 'text-x-c++hdr.png' # , 'java' => 'text-x-java.png' # , 'js' => 'application-x-javascript.png' # , 'pl|pm|perl' => 'application-x-perl.png' # , 'php|php3|phtml' => 'application-x-php.png' # , 'py|python' => 'text-x-python.png' # , 'sh|bsh|bash|ksh|zsh' => 'text-x-script.png' # , 's?html?' => 'text-html.png' # , 'css' => 'text-css.png' # , 'pdf' => 'application-pdf.png' # , 'txt' => 'text-plain.png' # , 'p|pas' => 'text-x-pascal.png' # , 'patch' => 'text-x-patch.png' # , 'sql' => 'text-x-sql.png' # , 'rb' => 'application-x-ruby.png' # , 'ui' => 'text-xml.png' # , '.*\~' => 'application-x-trash' # } # , 'graphicicon' => 'image-x-generic.png' # , 'defaulticon' => 'unknown.png' # , 'diricon' => 'inode-directory.png' #- How to map files to languages , 'filetypeconf' => '%LXRroot%/templates/filetype.conf' #- Location of the Generic.pm config file , 'genericconf' => '%LXRroot%/lib/LXR/Lang/generic.conf' # "Common factor" subsection # #============================# #@LOG Configuring "common factors" # In case your LXR installation controls several trees, # put here what you consider common parameters between # your source trees. # A parameter is "common" if its value must be simultaneously # adjusted in every tree. # Pattern for extracting tree name from URL, since all # trees are usually served from the same physical server. , 'treeextract' => '([^/]*)/[^/]*$' #@IF !%_dbuser% # User name and password for DB access can be the same, # even if the database name is tree-specific. # , 'dbuser' => 'lxr' # , 'dbpass' => 'lxrpw' #@ELSE , 'dbuser' => '%DB_user%' , 'dbpass' => '%DB_password%' #@ENDIF !%_dbuser% #@IF !%_dbprefix% # Table prefix is also a common parameter # unless you stuff all tree data in a single database. # It has a default hard-coded value: # , 'dbprefix' => 'lxr_' #@ELSE , 'dbprefix' => '%DB_global_prefix%' #@ENDIF !%_dbprefix% } Index: lxr.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/lxr.conf,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- lxr.conf 15 Nov 2012 08:49:41 -0000 1.55 +++ lxr.conf 11 Jan 2013 12:04:27 -0000 1.56 @@ -21,177 +21,7 @@ # Global configuration section # ################################ - { - # Auxiliary tools subsection # - #============================# -#@V Configuring auxiliary tool paths - - #- Place where lxr can write temporary files - 'tmpdir' => '/tmp' - - #- Define this OR the swish-e variable depending which search engine you want to use. - #- Path to glimpse executables. - #- e.g.: , 'glimpsebin' => '/usr/local/bin/glimpse' -#@U , 'glimpsebin' => '%glimpse%' -#@U , 'glimpseindex' => '%glimpseindex%' -#@U , 'glimpsedirbase' => '%glimpsedirbase%' - #- Location of SWISH-E binary - #- e.g.: , 'swishbin' => '/usr/local/bin/swish-e' -#@U , 'swishbin' => '%swish%' -#@U , 'swishdirbase' => '%swishdirbase%' - #- Location of the SWISH-E.conf file - , 'swishconf' => '%LXRroot%/templates/swish-e.conf' - - #- Path to Exuberant Ctags executable - , 'ectagsbin' => '%ctags%' - #- Location of the ectags.conf file - , 'ectagsconf' => '%LXRroot%/templates/ectags.conf' - - #- Paths for CVS module - , 'cvspath' => '/bin:/usr/local/bin:/usr/bin:/usr/sbin' - - # Computer DNS names subsection # - #================================ -#@V Configuring host name or IP (as http://...) -#@Q --- Host name?; -2 -#@A , 'host_names' => [ '@A' -#@QR --- Alias name ? (hit return to stop); -3 -#@A , '@A' -#- , //localhost -#- , https://192.168.1.1 -#- , 'http://mycomputer.outside.domain:12345' - ] - - # HTML subsection # - #=================# -#@V Configuring HTML parameters - - # All paths in this subsection are relative to LXR root directory - - # Templates used for headers and footers - , 'htmlfatal' => 'templates/html/html-fatal.html' - , 'htmlhead' => 'templates/html/html-head.html' - , 'htmltail' => 'templates/html/html-tail.html' - , 'htmldir' => 'templates/html/html-dir-indexing.html' - # If you do not need the "last indexed" column in directory - # display (e.g. for a stable unchanging tree), erase the - # '-indexing' suffix above. - , 'htmlident' => 'templates/html/html-ident.html' - , 'htmlsearch' => 'templates/html/html-search-%search_engine%.html' - , 'htmlconfig' => 'templates/html/html-config.html' - - # htmlhead and htmltail can be customised for the various - # LXR operations. Just replace html by source (listing file), - # sourcedir (displaying directory), diff (difference markup), - # ident (identifier search), search (free-text search) - # as below (which changes nothing): -# , 'sourcehead' => 'templates/html/html-head.html' -# , 'sourcedirhead' => 'templates/html/html-head.html' - - # showconfig script is a bit special since "version" has - # no meaning for it. Better to wipe out the 'variables' selection - # links with an adequate header: - , 'showconfighead' => 'templates/html/config-head-btn-smaller.html' - - # Default character width of left version (for diff) - , 'diffleftwidth' => 50 - - # Default identifier search constraint (for ident) -# , 'identdefonly' => 1 - - # CSS style sheet - , 'stylesheet' => 'templates/lxr.css' - , 'alternate_stylesheet' => [ 'templates/classic.css' ] - - # Default character encoding - , 'encoding' => 'utf-8' - - # File management subsection # - #============================# -#@V Configuring file subsection - - # Which files should be excluded from indexing (and display). - , 'ignorefiles' => - '^\\.|~$|\\.(o|a|orig)$|^CVS$|^core$' - # Which extensions to treat as images when browsing. If a file is an image, - # it is displayed. - , 'graphicfile' => - 'bitmap|bmp|gif|icon?|jp2|jpe?g|pjpe?g|png|svg|tiff?|xbm|xpm' - - # Which file extensions are associated with which icon - # Below is an example using 'Oxygen' theme available with KDE - # small-icons/ is a symbolic link to - # /usr/share/icons/oxygen/22x22/mimetypes/ - # (This location is valid for Fedora distributions, - # check for others) -# , 'iconfolder' => 'small-icons/' - # Don't forget the final / above. -# , 'icons' => -# { 'c|pc' => 'text-x-csrc.png' -# , 'h|hh' => 'text-x-chdr.png' -# , 'c\+\+|cc|cpp|cxx' => 'text-x-c++src.png' -# , 'hpp|hxx|h\+\+' => 'text-x-c++hdr.png' -# , 'java' => 'text-x-java.png' -# , 'js' => 'application-x-javascript.png' -# , 'pl|pm|perl' => 'application-x-perl.png' -# , 'php|php3|phtml' => 'application-x-php.png' -# , 'py|python' => 'text-x-python.png' -# , 'sh|bsh|bash|ksh|zsh' => 'text-x-script.png' -# , 's?html?' => 'text-html.png' -# , 'css' => 'text-css.png' -# , 'pdf' => 'application-pdf.png' -# , 'txt' => 'text-plain.png' -# , 'p|pas' => 'text-x-pascal.png' -# , 'patch' => 'text-x-patch.png' -# , 'sql' => 'text-x-sql.png' -# , 'rb' => 'application-x-ruby.png' -# , 'ui' => 'text-xml.png' -# , '.*\~' => 'application-x-trash' -# } -# , 'graphicicon' => 'image-x-generic.png' -# , 'defaulticon' => 'unknown.png' -# , 'diricon' => 'inode-directory.png' - - #- How to map files to languages - , 'filetypeconf' => '%LXRroot%/templates/filetype.conf' - - #- Location of the Generic.pm config file - , 'genericconf' => '%LXRroot%/lib/LXR/Lang/generic.conf' - - # "Common factor" subsection # - #============================# -#@V Configuring "common factors" - - # In case your LXR installation controls several trees, - # put here what you consider common parameters between - # your source trees. - # A parameter is "common" if its value must be simultaneously - # adjusted in every tree. - - # Pattern for extracting tree name from URL, since all - # trees are usually served from the same physical server. - , 'treeextract' => '([^/]*)/[^/]*$' - -#@begin_O nodbuser - # User name and password for DB access can be the same, - # even if the database name is tree-specific. -# , 'dbuser' => 'lxr' -# , 'dbpass' => 'lxrpw' -#@end_O nodbuser -#@begin_O dbuser - , 'dbuser' => '%DB_user%' - , 'dbpass' => '%DB_password%' -#@end_O dbuser -#@begin_O nodbprefix - # Table prefix is also a common parameter - # unless you stuff all tree data in a single database. - # It has a default hard-coded value: -# , 'dbprefix' => 'lxr_' -#@end_O nodbprefix -#@begin_O dbprefix - , 'dbprefix' => '%DB_global_prefix%' -#@end_O dbprefix - } +#@ADD %LXRtmpldir%/global.conf.part # ------------------------------------------------------------------------ @@ -199,14 +29,14 @@ # Tree configuration sections # ############################### -#@V Marking tree section -#@begin_tree +#@LOG Marking tree section +#@PASS2 here_tree # ------------------------------------------------------------------------ , { # Server configuration subsection # #=================================# -#@V Configuring LXR server parameters +#@LOG Configuring LXR server parameters #- #- NOTE --------------------------------------------------- # #- ---- 'baseurl' and 'baseurl_aliases' are deprecated ---- # @@ -234,39 +64,49 @@ #- -------------------------------------------------------- # #- , -#@V The virtual root is the fixed URL part after the hostname. -#@begin_O context==s -#@Q --- Virtual root? (i.e. URL part after host); -1; ; /lxr -#@end_O context==s -#@begin_O context==m -#@Q --- Virtual root? (e.g. /lxr/something); -2 -#@end_O context==m -#- The following @D allows automatic transfer of 'virtroot' +#@MSG The virtual root is the fixed URL part after the hostname. +#- - Virtual root is slightly different on context - - +#- - because we want to handle everything with a single LXR instance - - +#@IF %_singlecontext% +#- - Single tree context - - +#@ ASK --- Virtual root? (i.e. URL part after host); -1; ; /lxr +#@ELSE +#- - Multiple trees context - - +#@ ASK --- Virtual root? (e.g. /lxr/something); -2 +#@ENDIF %_singlecontext% +#- - End of virtroot differences - - +#- +#- The following @DEFINE allows automatic transfer of 'virtroot' #- into lighttpd-lxrserver.conf. -#@D virtroot=@A -#@A 'virtroot' => '@A' +#@DEFINE virtroot="%A%" + 'virtroot' => '%A%' #- Title for this tree to display in page header area #- if you aren't satisfied with the default -#@Q --- Caption in page header? (e.g. Project XYZZY displayed by LXR); -2 -#@A , 'caption' => '@A' -#@begin_O context!=m +#@ASK --- Caption in page header? (e.g. Project XYZZY displayed by LXR); -2 + , 'caption' => '%A%' +#- +#- - In single tree context, just output a reminder in case of change; +#- - for multiple trees, generate the speed switch buttons +#@IF %_singlecontext% # Button title to switch to this tree when multiple # trees are managed by LXR # , 'shortcaption' => 'Tree' -#@end_O context!=m -#@begin_O context==m -#@begin_Y Do you want a speed switch button for this tree ?; 1; yes, no; Y, N -#@Q --- Short title for button? (e.g. XYZZY); -2 -#@A , 'shortcaption' => '@A' -#@end_Y -#@end_O context==m -#@begin_Y Do you need a specific encoding for this tree ?; 2; yes, no; Y, N +#@ELSE +#@ ASK Do you want a speed switch button for this tree ?; 1; yes, no; Y, N +#@ IF %A% eq "Y" +#@ ASK --- Short title for button? (e.g. XYZZY); -2 + , 'shortcaption' => '%A%' +#@ ENDIF +#@ENDIF %_singlecontext% +#- +#@ASK Do you need a specific encoding for this tree ?; 2; yes, no; Y, N +#@IF %A% eq "Y" -#@Q --- Encoding name? (e.g. iso-8859-1); -2 +#@ ASK --- Encoding name? (e.g. iso-8859-1); -2 # Character encoding (overrides default) -#@A , 'encoding' => '@A' -#@end_Y + , 'encoding' => '%A%' +#@ENDIF # a link of the form (prefix)($filepath)(postfix) is generated when viewing a file # example for cvsweb: @@ -278,171 +118,188 @@ # Tree location subsection # #==========================# -#@V Describing tree location +#@LOG Describing tree location # sourceroot - where to get the source files from -#@begin_C How is your tree stored?; 1; files, cvs, git, svn, bitkeeper; F,C,G,S,B -#@case_C F +#- - Handle the supported variants of tree storage - - +#- - +#@ASK,C How is your tree stored?; 1; files, cvs, git, svn, hg, bk; F,C,G,S,H,B +#@CASE %C% +#- - Case No. 1: plain files and directories +#@F: #- For ordinary directories, this specifies a directory which has each version as a #- subdirectory e.g. #- project-tree/version1/... #- project-tree/version2/... #- The names of the version directories must match the values for the Version #- variable (see the version selection subsection). -#@V A source directory contains one sub-directory for every version. -#@Q --- Source directory? (e.g. /home/myself/project-tree); -2 -#@A , 'sourceroot' => '@A' -#@case_C C - +#@ MSG A source directory contains one sub-directory for every version. +#@ ASK --- Source directory? (e.g. /home/myself/project-tree); -2 + , 'sourceroot' => '%A%' +#- +#- - Case No. 2: CVS repository +#@C: #- This specifies a CVS repository by setting the value to "cvs:" #- followed by the path to the repository. Note this must be file accessible - remote #- server access does NOT work. -#@V A CVS repository is a directory containing ,v files -#@Q --- CVS repository? (e.g. /home/myself/project-CVS); -2 -#@A , 'sourceroot' => 'cvs:@A' -#@case_C G - +#@ MSG A CVS repository is a directory containing ,v files +#@ ASK --- CVS repository? (e.g. /home/myself/project-CVS); -2 + , 'sourceroot' => 'cvs:%A%' +#- +#- - Case No. 3: GIT repository +#@G: #- For a GIT repository, the 'sourceroot' config variable points to the directory #- in which you find the `objects', `refs', `index' etc. #- directories. -#@V A Git repository is a directory containing objects, refs, index, ... subdirectories. -#@V It is usually named .git in some user directory and is thus not visible. -#@Q --- Git repository? (e.g. /home/myself/project-git/.git); -2 -#@D GITrepo=@A -#@A , 'sourceroot' => 'git:@A' +#@ MSG A Git repository is a directory containing objects, refs, index, ... subdirectories. +#@ MSG It is usually named .git in some user directory and is thus not visible. +#@ ASK --- Git repository? (e.g. /home/myself/project-git/.git); -2 +#@ DEFINE GITrepo="%A%" + , 'sourceroot' => 'git:%A%' + #- + #- Any parameters to the source access method should be specified below. + #- + #- GIT: if 'git_annotations' is non-zero, the file revision that + #- introduced each line is displayed. + #- 'git_blame' will add the author of each line to the + #- output. Keep in mind that the core LXR code + #- will only request author information if + #- annotations are switched on, too! , 'sourceparams' => -#@Q --- display revision-ids?; 1; yes,no; 1,0 -#@A { 'git_annotations' => @A -#@Q --- display revision author name?; 1; yes,no; 1,0 -#@A , 'git_blame' => @A +#@ ASK --- display revision-ids?; 1; yes,no; 1,0 + { 'git_annotations' => %A% +#@ ASK --- display revision author name?; 1; yes,no; 1,0 + , 'git_blame' => %A% } -#@case_C S - +#- +#- - Case No. 4: Subversion repository +#@S: #- For a Subversion repository, specify svn: followed by the path to the #- repository. Presently, the implementation is limited to #- local (file-accessible) repositories. -#@V A Subversion repository is a directory containing a database for -#@V the source-tree. The present backend implementation in LXR limits -#@V access to local repositories. -#@Q --- Subversion repository? (e.g. /home/myself/project-svn); -2 -#@A , 'sourceroot' => 'svn:@A' - , 'sourceparams' => -#@Q --- display revision-ids?; 1; yes,no; 1,0 -#@A { 'svn_annotations' => @A -#@Q --- display revision author name?; 1; yes,no; 1,0 -#@A , 'svn_blame' => @A - } -#@case_C B - - #- For a BitKeeper repository, specify bk: followed by the path to the - #- repository. For BK it is also necessary to specify a 'cachepath' parameter in - #- the 'sourceparams' value below. This should point to a directory where the - #- code can write and read files. -#@V BitKeeper is proprietary software. The BK management routines are more or less -#@V in their 2005 state. This interface has not been tested for many years. -#@V There is absolutely no guarantee on BK operation. -#@Q --- BK repository? (e.g. /home/myself/project-BK); -2 -#@A , 'sourceroot' => 'cvs:@A' -#@V BK needs a read/write temporary directory. -#@Q --- BK temporary directory? (e.g. /home/myself/BKtemp); -2 - , 'sourceparams' => -#@A { 'cachepath' => '@A' } -#@end_C - -# # The string to display as the base part of every path in the tree -#- , 'sourcerootname' => 'Example' -#- # Or if you want automatic version insertion -#- , 'sourcerootname' => '$v' -#@Q Name to display for the path root? (e.g. Project or $v for version); -1; ; $v -#@A , 'sourcerootname' => '@A' +#@ MSG A Subversion repository is a directory containing a database for +#@ MSG the source-tree. The present backend implementation in LXR limits +#@ MSG access to local repositories. +#@ ASK --- Subversion repository? (e.g. /home/myself/project-svn); -2 + , 'sourceroot' => 'svn:%A%' #- #- Any parameters to the source access method should be specified below. #- - #- BK: 'cachepath' is used for temporary files - #- GIT: if 'git_annotations' is non-zero, the file revision that + #- svn: if 'svn_annotations' is non-zero, the file revision that #- introduced each line is displayed. - #- 'git_blame' will add the author of each line to the + #- 'svn_blame' will add the author of each line to the #- output. Keep in mind that the core LXR code #- will only request author information if #- annotations are switched on, too! - #- svn: if 'svn_annotations' is non-zero, the file revision that + , 'sourceparams' => +#@ ASK --- display revision-ids?; 1; yes,no; 1,0 + { 'svn_annotations' => %A% +#@ ASK --- display revision author name?; 1; yes,no; 1,0 + , 'svn_blame' => %A% + } +#- +#- - Case No. 5: Mercurial repository +#@H: + #- For a Mercurial repository, specify hg: followed by the path to the + #- repository directory. Presently, the implementation is limited to + #- local (file-accessible) repositories. +#@ MSG A Mercurial repository is a directory containing a database for +#@ MSG the source-tree. The present backend implementation in LXR limits +#@ MSG access to local repositories. +#@ ASK --- Mercurial repository? (e.g. /home/myself/project-hg); -2 + , 'sourceroot' => 'hg:%A%' + #- + #- Any parameters to the source access method should be specified below. + #- + #- hg: if 'hg_annotations' is non-zero, the changeset that #- introduced each line is displayed. - #- 'svn_blame' will add the author of each line to the + #- 'hg_blame' will add the author of each line to the #- output. Keep in mind that the core LXR code #- will only request author information if #- annotations are switched on, too! + , 'sourceparams' => +#@ ASK --- display changeset-ids?; 1; yes,no; 1,0 + { 'hg_annotations' => %A% +#@ ASK --- display changeset author name?; 1; yes,no; 1,0 + , 'hg_blame' => %A% + } +#- +#- - Case No. 6: BitKeeper repository (kept only for historical reason) +#@B: + #- For a BitKeeper repository, specify bk: followed by the path to the + #- repository. For BK it is also necessary to specify a 'cachepath' parameter in + #- the 'sourceparams' value below. This should point to a directory where the + #- code can write and read files. +#@ MSG BitKeeper is proprietary software. The BK management routines are more or less +#@ MSG in their 2005 state. This interface has not been tested for many years. +#@ MSG There is absolutely no guarantee on BK operation. +#@ ASK --- BK repository? (e.g. /home/myself/project-BK); -2 + , 'sourceroot' => 'bk:%A%' #- -#- , 'sourceparams' => -#- { 'cachepath' => '/a/path/here' -#- , 'git_annotations' => 1 -#- , 'git_blame' => 1 -#- , 'svn_annotations' => 1 -#- , 'svn_blame' => 1 -#- } + #- Any parameters to the source access method should be specified below. + #- + , 'sourceparams' => +#@ MSG BK needs a read/write temporary directory. +#@ ASK --- BK temporary directory? (e.g. /home/myself/BKtemp); -2 + { 'cachepath' => '%A%' } +#@ENDC +#- - End of tree storage - - + +# # The string to display as the base part of every path in the tree +#- , 'sourcerootname' => 'Example' +#- # Or if you want automatic version insertion +#- , 'sourcerootname' => '$v' +#@ASK Name to display for the path root? (e.g. Project or $v for version); -1; ; $v + , 'sourcerootname' => '%A%' # Version selection subsection # #==============================# -#@V Enumerating versions +#@LOG Enumerating versions , 'variables' => # Define typed variable "v". { 'v' => -#@Q Label for version selection menu? ; -1; ; Version -#@A { 'name' => '@A' +#@ASK Label for version selection menu? ; -1; ; Version + { 'name' => '%A%' # This is the list of versions to index. -#@V Versions can be explicitly enumerated, be read from a file or computed -#@V by a function. The latter case is recommended for VCS-stored trees. -#@begin_C Version enumeration method?; 1; list, file, function; L,R,F +#- +#- - Manage the different version enumeration methods - - +#@MSG Versions can be explicitly enumerated, be read from a file or computed +#@MSG by a function. The latter case is recommended for VCS-stored trees. +#@ASK,V Version enumeration method?; 1; list, file, function; L,R,F #- This can come from a file, a function or be explicitly #- ennumerated. -#@case_C R - #- From a file: - # , 'range' => [ readfile('src/versions') ] -#@Q --- Version file? (absolute path or relative to LXR root dir.); -2 -#@A , 'range' => [ readfile('@A') ] - # The default version to display - # If not specified, first in 'range' used -#@V By default, first version in list is displayed. You may also indicate -#@V a prefered version. -#@begin_C --- Default displayed version is first in 'range'?; 1; yes,no; Y,N -#@case_C N -#@Q --- Default version name?; -2 -#@A , 'default' => '@A' -#@case_C Y - # The default version to display - # If not specified, first in 'range' used -# , 'default' => 'v3.1' -#@end_C -#@case_C L - #- Explicitly: - # , 'range' => [qw(v1 v2 v3.1 v4 experimental)] +#@CASE %V% +#- +#- - Case No. 1: versions stored in a file +#@R: +#@ ASK --- Version file? (absolute path or relative to LXR root dir.); -2 + , 'range' => [ readfile('%A%') ] +#- +#- - Case No. 2: versions given explicitly in a list +#@L: , 'range' => [qw( -#@QR --- Version name? (hit return to stop); -3 -#@A @A +#@ KEEPON --- Version name? (hit return to stop); -2 + %A% +#@ ENDK )] -#@V By default, first version in list is displayed. You may also indicate -#@V a prefered version. -#@begin_C --- Default displayed version is first in 'range'?; 1; yes,no; Y,N -#@case_C N -#@Q --- Default version name?; -2 -#@A , 'default' => '@A' -#@case_C Y - # The default version to display - # If not specified, first in 'range' used -# , 'default' => 'v3.1' -#@end_C -#@case_C F +#- +#- - Case No. 3: versions dynamically computed by a function applied to each file +#@F: #- If files within a tree can have different versions, #- e.g in a CVS tree, 'range' can be specified as a #- function to call for each file: -#@V This template contains generic nearly-all-purpose functions. -#@V Since designing such a function is not a trivial exercise, -#@V you'd better choose an available one. You can later refine it -#@V to fit your needs. -#@begin_C --- Generic or custom function?; 0; files, CVS, Git, svn, custom; F,C,G,S,U -#@case_C F +#@ MSG This template contains generic nearly-all-purpose functions. +#@ MSG Since designing such a function is not a trivial exercise, +#@ MSG you'd better choose an available one. You can later refine it +#@ MSG to fit your needs. +#@ ASK,F --- Generic or custom function?; 0; files, CVS, Git, svn, hg, custom; F,C,G,S,H,U +#@ CASE %F% +#- +#- - Case No. 3a: function suited to plain files tree +#@F: #- Automatically collects the version names #- in 'sourceroot' directory which are sorted in #- lexicographic order (this may not meet the @@ -453,17 +310,16 @@ { opendir (my $dh, $LXR::Common::config->{'sourceroot'}) || die "can't open source root directory: $!"; my @dirs = grep - { /^[^.]/ + { m/^[^.]/ # Discard invisible items && -d "$LXR::Common::config->{'sourceroot'}/$_" } readdir($dh); closedir($dh); return(sort @dirs); } -#@V With a function, you MUST indicate a default version. -#@Q --- Default version name?; -1; ; head -#@A , 'default' => '@A' -#@case_C C +#- +#- - Case No. 3b: function suited to CVS tree +#@C: #- Get the releases and revisions from CVS control data. #- Revisions may not be meaningful since their numbers #- are not synchronised between files. @@ -486,10 +342,9 @@ ) #U } } -#@V With a function, you MUST indicate a default version. -#@Q --- Default version name?; -1; ; head -#@A , 'default' => '@A' -#@case_C G +#- +#- - Case No. 3c: function suited to GIT tree +#@G: #- When using a GIT repo, you can use its tags #- to create a list of versions. As an extra #- bonus, with the Linux::KernelSort Perl module, @@ -540,15 +395,14 @@ # # return @files; # } -#@V With a function, you MUST indicate a default version. -#@Q --- Default version name?; -1; ; HEAD -#@A , 'default' => '@A' -#@case_C S +#- +#- - Case No. 3d: function suited to Subversion tree +#@S: #- Get the revisions from Subversion control data. - #- Revisions may not be meaningful since their numbers - #- increment sequentially on every commit. - #- Latest revision on branches and tags may be more - #- meaningful. + #- Changeset ids may not be meaningful since their numbers + #- are not ordered chronologically. + #- Tags and branches are more related to milestones + #- for the project. #- , 'range' => sub { @@ -561,39 +415,90 @@ , $files->alltags ($LXR::Common::pathname) ) } -#@V With a function, you MUST indicate a default version. -#@Q --- Default version name?; -1; ; head -#@A , 'default' => '@A' -#@case_C U -#@V Remember to write your 'range' function. +#- +#- - Case No. 3e: function suited to Mercurial tree +#@H: + #- Get the revisions from Mercurial control data. + #- Revisions may not be meaningful since their numbers + #- increment sequentially on every commit. + #- Latest revision on branches and tags may be more + #- meaningful. + #- , 'range' => sub - { # design your own function - return 0 + { + return grep {defined} + ##### You may comment some of the following lines to limit the + ##### number of displayed revisions, provided at least one is + ##### left active. If you keep only allbranches, uncomment the + ##### 'tip' line to guarantee at least one revision is + ##### reachable. + ( $files->allbranches() + , $files->alltags () + # , 'tip' + ) } - , 'default' => 0 -#@end_C -#@end_C +#- +#- - Case No. 3f: reminder for your own function +#@U: +#@ REMIND Remember to write your 'range' function. + # CAUTION - CAUTION - CAUTION - CAUTION + # This is NOT a real function! + # You MUST write one, otherwise nothing can be displayed. + # This stubborn stub function drops anything! + # CAUTION - CAUTION - CAUTION - CAUTION + , 'range' => sub # CAUTION + { # design your own function # CAUTION + return () # CAUTION + } # CAUTION + # CAUTION - CAUTION - CAUTION - CAUTION +#@ ENDC +#@ENDC +#- - Default initial version to display (depends on enumeration method) +#- - Version list not provided by a function (file or explicit list) +#@IF %V% ne "F" +#@MSG By default, first version in list is displayed. You may also indicate +#@MSG a prefered version. +#@ ASK --- Default displayed version is first in 'range'?; 1; yes,no; Y,N +#@ IF %A% eq "N" +#@ ASK,N --- Default version name?; -2 + , 'default' => '%N%' +#@ ELSE + # The default version to display + # If not specified, first in 'range' used +# , 'default' => 'v3.1' +#@ ENDIF +#@ELSE +#- - Version list provided by a function +#@ MSG With a function, you MUST indicate a default version. +#@ CASE %F% +#@F: +#@ ASK,N --- Default version name?; -2 +#@C:S: +#@ ASK,N --- Default version name?; -1; ; head +#@G: +#@ ASK,N --- Default version name?; -1; ; HEAD +#@H: +#@ ASK,N --- Default version name?; -1; ; tip +#@U: +#@ DEFINE N='??to be provided by user??' +#@ ENDC + , 'default' => '%N%' +#@ENDIF +#- - End of version enumeration methods - - +#- } - # Define typed variable "a". First value is default. - # Meaningful for Linux kernel - # Comment out for average user source-tree - # , 'a' => - # { 'name' => 'Architecture' - # , 'range' => [qw(i386 alpha arm m68k mips ppc sparc sparc64)] - # } - # NOTE: If you implement the 'a' variable against the Kernel tree, - # don't rely on the above list of architectures. It is out-dated. - # To get an accurate list, type the following command in a - # terminal: ls path-to-kernel-source/arch/ - # The directories list in the output gives the up-to-date list. - # Alternately, use template lxrkernel.conf dedicated to kernel - # configuration. + # Other variables may be defined for use by rewrite rules + # in the subdirectory section. + # These variable definitions are needed for Linux kernel + # browsing. Read carefully the User's Manual. + # Alternately, use template lxrkernel.conf dedicated to kernel + # configuration. } # Subdirectory subsection # #=========================# -#@V Setting directory lists +#@LOG Setting directory lists # Tree-specific files to ignore (in every directory of the tree) # Extend and uncomment the following copy of the global @@ -606,28 +511,40 @@ # project history. Note that .xxx directories are hidden # by an internal hard-coded rule. Redundant example: # , 'ignoredirs' => ['CVSROOT', 'CVS', '.git'] -#@V Some directories may contain non-public project data (binaries, -#@V compilers caches, SCM control data, ...). They can be hidden from LXR. +#@MSG Some directories may contain non-public project data (binaries, +#@MSG compilers caches, SCM control data, ...). They can be hidden from LXR. +#@KEEPON --- Directory to ignore, e.g. CVSROOT or CVS? (hit return to stop) +#@ ON first , 'ignoredirs' => [qw( -#@QR --- Directory to ignore, e.g. CVSROOT or CVS? (hit return to stop); -3 -#@A @A +#@ ENDON + %A% +#@ ON last )] +#@ ENDON +#@ENDK # Where to look for include files inside the sourcetree. # This is used to hyperlink to included files. Example: -#@V If your source code uses "include" statements (#include, require, ...) -#@V LXR needs hints to resolve the destination file. -# , 'incprefix' => [ '/include', '/include/linux' ] +#@MSG If your source code uses "include" statements (#include, require, ...) +#@MSG LXR needs hints to resolve the destination file. +#@KEEPON --- Include directory, e.g. /include? (hit return to stop) +#@ ON first , 'incprefix' => [qw( -#@QR --- Include directory, e.g. /include? (hit return to stop); -3 -#@A @A +#@ ENDON + %A% +#@ ON last )] +#@ ENDON +#@ ON none +# , 'incprefix' => [ '/include', '/include/linux' ] +#@ ENDON +#@ENDK # These do funky things to paths in the system - you probably don't need them. # They are used to simulate compiler behaviour to various options # to rewrite short paths from (#)include statement and get the # real "physical" path to the file. -# , 'maps' => +# , 'maps' => # $a means substitute with current value of variable 'a' # [ '/include/asm[^\/]*/' => '/include/asm-$a/' # , '/arch/[^\/]+/' => '/arch/$a/' # ], @@ -640,109 +557,10 @@ # Data storage subsection # #=========================# -#@V Configuring data storage - - # The DBI identifier for the database to use - # For MySQL, the format is dbi:mysql:dbname=<name> - # for Postgres, it is dbi:Pg:dbname=<name>;host=localhost - # for Oracle, it is dbi:Oracle:host=localhost;sid=DEVMMS;port=1521 - # for SQLite, it is dbi:SQLite:dbname=<filename> -#@begin_O dbengine==m -#@begin_O dbpolicy==t -#@Q --- Database name?; -2 -#@D DB_name=@A -#@end_O dbpolicy==t - , 'dbname' => 'dbi:mysql:dbname=%DB_name%' -#@end_O dbengine==m -#- -#@begin_O dbengine==o - , 'dbname' => 'dbi:Oracle:host=localhost;sid=DEVMMS;port=1521' -#@end_O dbengine==o -#- -#@begin_O dbengine==p -#@begin_O dbpolicy==t -#@Q --- Database name?; -2 -#@D DB_name=@A -#@end_O dbpolicy==t - , 'dbname' => 'dbi:Pg:dbname=%DB_name%;host=localhost' -#@end_O dbengine==p -#- -#@begin_O dbengine==s -#@begin_O dbpolicy==t -#@Q --- Database file? (e.g. /home/myself/storage.db); -2 -#@D DB_name=@A -#@end_O dbpolicy==t - , 'dbname' => 'dbi:SQLite:dbname=%DB_name%' -#@end_O dbengine==s -#- -#- -#@begin_O dbengine!=s -#@begin_O nodbuser -#@Q --- DB user name?; -1; ; lxr -#@D DB_tree_user=@A -#@Q --- DB password?; -1; ; lxrpw -#@D DB_tree_password=@A - - , 'dbuser' => '%DB_tree_user%' - , 'dbpass' => '%DB_tree_password%' -#@end_O nodbuser -#- -#@begin_O dbuser -#@begin_O dbpolicy==t -#@begin_C Do you want to override the global '%DB_user%' user name?; 2; yes,no; Y,N -#@case_C Y -#@Q --- DB user name?; -1; ; lxr -#@D DB_tree_user=@A -#@Q --- DB password?; -1; ; lxrpw -#@D DB_tree_password=@A - - , 'dbuser' => '%DB_tree_user%' - , 'dbpass' => '%DB_tree_password%' -#@case_C N - # If you need to specify the username or password for the database connection, - # uncomment the following two lines -# , 'dbuser' => 'lxr' -# , 'dbpass' => 'lxrpw' -#@end_C -#@end_O dbpolicy==t -#@end_O dbuser -#@end_O dbengine!=s -#- #- -#@begin_O nodbprefix -#@Q --- DB table prefix?; -1; ; lxr_ -#@D DB_tbl_prefix=@A - - , 'dbprefix' => '%DB_tbl_prefix%' -#@end_O nodbprefix +#@ADD %LXRtmpldir%/datastorage.conf.part #- -#@begin_O dbprefix -#@begin_O dbpolicy==t - -#@begin_C Do you want to override the global '%DB_global_prefix%' table prefix?; 2; yes,no; Y,N -#@case_C Y -#@Q --- DB table prefix?; -1; ; lxr_ -#@D DB_tbl_prefix=@A - , 'dbprefix' => '%DB_tbl_prefix%' -#@case_C N - # If you need multiple lxr configurations in one database, set different table - # prefixes for them. -# , 'dbprefix' => 'lxr_' -#@end_C -#@end_O dbpolicy==t -#@end_O dbprefix - - # The following two parameters are now automatically - # generated from 'glimpsedirbase' or 'swishdirbase' and - # 'virtroot'. - # They may nevertheless be overridden here by uncommenting - # them and filling-in an appropriate absolute path. - # For using glimpse, the directory to store the .glimpse files in is required -# , 'glimpsedir' => '/path/to/glimpse/databases' - # Location of swish-e index database files if using swish-e -# , 'swishdir' => '/path/to/swish/databases' } -#@end_tree -#@here_tree +#@ENDP2 ) Index: lxrkernel.conf =================================================================== RCS file: /cvsroot/lxr/lxr/templates/lxrkernel.conf,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- lxrkernel.conf 15 Nov 2012 08:49:41 -0000 1.6 +++ lxrkernel.conf 11 Jan 2013 12:04:27 -0000 1.7 @@ -42,13 +42,12 @@ #- ./scripts/configure-lxr.pl --conf-out=lxr.conf lxrkernel.conf #- ./scripts/configure-lxr.pl --add lxr.conf #- -#@V -#@V Welcome in the Linux kernel browsing configurator -#@V -#@V Buttons-and-menus interface is highly recommended, otherwise your -#@V screen will be seriously cluttered and ugly. -#@V This interface is selected by the 'htmlhead' parameter in the -#@V HTML subsection. +#@LOG Welcome to the Linux kernel browsing configurator +#@LOG +#@MSG Buttons-and-menus interface is highly recommended, otherwise your +#@MSG screen will be seriously cluttered and ugly. +#@MSG This interface is selected by the 'htmlhead' parameter in the +#@MSG HTML subsection. # # To use this file 'as is', move it to its final location with: # cp custom.d/lxrkernel.conf lxr.conf @@ -58,183 +57,14 @@ #- #- Have a pleasant navigation -- ajl 2012/03/29 #- updated for automatic configuration -- ajl 2012/05/05 +#- updated to use LCL statements -- ajl 2012/11/30 ( ################################ # Global configuration section # ################################ - { - # Auxiliary tools subsection # - #============================# -#@V Configuring auxiliary tool paths - - #- Place where lxr can write temporary files - 'tmpdir' => '/tmp' - - #- Define this OR the swish-e variable depending which search engine you want to use. - #- Path to glimpse executables. - #- e.g.: , 'glimpsebin' => '/usr/local/bin/glimpse' -#@U , 'glimpsebin' => '%glimpse%' -#@U , 'glimpseindex' => '%glimpseindex%' -#@U , 'glimpsedirbase' => '%glimpsedirbase%' - #- Location of SWISH-E binary - #- e.g.: , 'swishbin' => '/usr/local/bin/swish-e' -#@U , 'swishbin' => '%swish%' -#@U , 'swishdirbase' => '%swishdirbase%' - #- Location of the SWISH-E.conf file - , 'swishconf' => '%LXRroot%/templates/swish-e.conf' - - #- Path to Exuberant Ctags executable - , 'ectagsbin' => '%ctags%' - #- Location of the ectags.conf file - , 'ectagsconf' => '%LXRroot%/templates/ectags.conf' - - #- Paths for CVS module - , 'cvspath' => '/bin:/usr/local/bin:/usr/bin:/usr/sbin' - - # Computer DNS names subsection # - #================================ -#@V Configuring host name or IP (as http://...) -#@Q --- Host name?; -2 -#@A , 'host_names' => [ '@A' -#@QR --- Alias name ? (hit return to stop); -3 -#@A , '@A' -#- , //localhost -#- , https://192.168.1.1 -#- , 'http://mycomputer.outside.domain:12345' - ] - - # HTML subsection # - #=================# -#@V Configuring HTML parameters - - # All paths in this subsection are relative to LXR root directory - - # Templates used for headers and footers - , 'htmlfatal' => 'templates/html/html-fatal.html' - , 'htmlhead' => 'templates/html/html-head-btn.html' - , 'htmltail' => 'templates/html/html-tail.html' - , 'htmldir' => 'templates/html/html-dir-indexing.html' - # If you do not need the "last indexed" column in directory - # display (e.g. for a stable unchanging tree), erase the - # '-indexing' suffix above. - , 'htmlident' => 'templates/html/html-ident.html' - , 'htmlsearch' => 'templates/html/html-search-%search_engine%.html' - , 'htmlconfig' => 'templates/html/html-config.html' - - # htmlhead and htmltail can be customised for the various - # LXR operations. Just replace html by source (listing file), - # sourcedir (displaying directory), diff (difference markup), - # ident (identifier search), search (free-text search) - # as below (which changes to link interface): -# , 'sourcehead' => 'templates/html/html-head.html' -# , 'sourcedirhead' => 'templates/html/html-head.html' - - # showconfig script is a bit special since "version" has - # no meaning for it. Better to wipe out the 'variables' selection - # links with an adequate header: - , 'showconfighead' => 'templates/html/config-head-btn-smaller.html' - - # Default character width of left version (for diff) - , 'diffleftwidth' => 50 - - # Default identifier search constraint (for ident) -# , 'identdefonly' => 1 - - # CSS style sheet - , 'stylesheet' => 'templates/lxr.css' - , 'alternate_stylesheet' => [ 'templates/classic.css' ] - - # Default character encoding - , 'encoding' => 'utf-8' - - # File management subsection # - #============================# -#@V Configuring file subsection - - # Which files should be excluded from indexing (and display). - , 'ignorefiles' => - '^\\.|~$|\\.(o|a|orig)$|^CVS$|^core$' - # Which extensions to treat as images when browsing. If a file is an image, - # it is displayed. - , 'graphicfile' => - 'bitmap|bmp|gif|icon?|jp2|jpe?g|pjpe?g|png|svg|tiff?|xbm|xpm' - - # Which file extensions are associated with which icon - # Below is an example using 'Oxygen' theme available with KDE - # small-icons/ is a symbolic link to - # /usr/share/icons/oxygen/22x22/mimetypes/ - # (This location is valid for Fedora distributions, - # check for others) -# , 'iconfolder' => 'small-icons/' - # Don't forget the final / above. -# , 'icons' => -# { 'c|pc' => 'text-x-csrc.png' -# , 'h|hh' => 'text-x-chdr.png' -# , 'c\+\+|cc|cpp|cxx' => 'text-x-c++src.png' -# , 'hpp|hxx|h\+\+' => 'text-x-c++hdr.png' -# , 'java' => 'text-x-java.png' -# , 'js' => 'application-x-javascript.png' -# , 'pl|pm|perl' => 'application-x-perl.png' -# , 'php|php3|phtml' => 'application-x-php.png' -# , 'py|python' => 'text-x-python.png' -# , 'sh|bsh|bash|ksh|zsh' => 'text-x-script.png' -# , 's?html?' => 'text-html.png' -# , 'css' => 'text-css.png' -# , 'pdf' => 'application-pdf.png' -# , 'txt' => 'text-plain.png' -# , 'p|pas' => 'text-x-pascal.png' -# , 'patch' => 'text-x-patch.png' -# , 'sql' => 'text-x-sql.png' -# , 'rb' => 'application-x-ruby.png' -# , 'ui' => 'text-xml.png' -# , '.*\~' => 'application-x-trash' -# } -# , 'graphicicon' => 'image-x-generic.png' -# , 'defaulticon' => 'unknown.png' -# , 'diricon' => 'inode-directory.png' - - #- How to map files to languages - , 'filetypeconf' => '%LXRroot%/templates/filetype.conf' - - #- Location of the Generic.pm config file - , 'genericconf' => '%LXRroot%/lib/LXR/Lang/generic.conf' - - # "Common factor" subsection # - #============================# -#@V Configuring "common factors" - - # In case your LXR installation controls several trees, - # put here what you consider common parameters between - # your source trees. - # A parameter is "common" if its value must be simultaneously - # adjusted in every tree. - - # Pattern for extracting tree name from URL, since all - # trees are usually served from the same physical server. - , 'treeextract' => '([^/]*)/[^/]*$' - -#@begin_O nodbuser - # User name and password for DB access can be the same, - # even if the database name is tree-specific. -# , 'dbuser' => 'lxr' -# , 'dbpass' => 'lxrpw' -#@end_O nodbuser -#@begin_O dbuser - , 'dbuser' => '%DB_user%' - , 'dbpass' => '%DB_password%' -#@end_O dbuser -#@begin_O nodbprefix - # Table prefix is also a common parameter - # unless you stuff all tree data in a single database. - # It has a default hard-coded value: -# , 'dbprefix' => 'lxr_' -#@end_O nodbprefix -#@begin_O dbprefix - , 'dbprefix' => '%DB_global_prefix%' -#@end_O dbprefix - } +#@ADD %LXRtmpldir%/global.conf.part # ------------------------------------------------------------------------ @@ -242,48 +72,61 @@ # Tree configuration sections # ############################### -#@V Marking tree section -#@begin_tree +#@LOG Marking tree section +#@PASS2 here_tree # ------------------------------------------------------------------------ , { + # This kernel LXR configuration is generated from + # a template contributed by André Littoz (C) 2012 + # Server configuration subsection # #=================================# -#@V Configuring LXR server parameters +#@LOG Configuring LXR server parameters -#@V The virtual root is the fixed URL part after the hostname. -#@begin_O context==s -#@Q --- Virtual root? (i.e. URL part after host); -1; ; /lxr -#@end_O context==s -#@begin_O context==m -#@Q --- Virtual root? (i.e. URL part after host); -1; ; /lxr/kernel -#@end_O context==m -#- The following @D allows automatic transfer of 'virtroot' +#@MSG The virtual root is the fixed URL part after the hostname. +#- - Virtual root is slightly different on context - - +#- - because we want to handle everything with a single LXR instance - - +#@IF %_singlecontext% +#- - Single tree context - - +#@ ASK --- Virtual root? (i.e. URL part after host); -1; ; /lxr +#@ELSE +#- - Multiple trees context - - +#@ ASK --- Virtual root? (e.g. /lxr/something); -1; /lxr/kernel +#@ENDIF %_singlecontext% +#- - End of virtroot differences - - +#- +#- The following @DEFINE allows automatic transfer of 'virtroot' #- into lighttpd-lxrserver.conf. -#@D virtroot=@A -#@A 'virtroot' => '@A' +#@DEFINE virtroot="%A%" + 'virtroot' => '%A%' #- Title for this tree to display in page header area #- if you aren't satisfied with the default -#@Q --- Caption in page header?; -1; ; Linux kernel cross-references -#@A , 'caption' => '@A' -#@begin_O context!=m +#@ASK --- Caption in page header?; -1; ; Linux kernel cross-references + , 'caption' => '%A%' +#- +#- - In single tree context, just output a reminder in case of change; +#- - for multiple trees, generate the speed switch buttons +#@IF %_singlecontext% # Button title to switch to this tree when multiple # trees are managed by LXR -# , 'shortcaption' => 'Linux' -#@end_O context!=m -#@begin_O context==m -#@begin_Y Do you want a speed switch button for this tree ?; 1; yes, no; Y, N -#@Q --- Short title for button?; -1; ; Linux -#@A , 'shortcaption' => '@A' -#@end_Y -#@end_O context==m -#@begin_Y Do you need a specific encoding for this tree ?; 2; yes, no; Y, N +# , 'shortcaption' => 'Tree' +#@ELSE +#@ ASK Do you want a speed switch button for this tree ?; 1; yes, no; Y, N +#@ IF %A% eq "Y" +#@ ASK --- Short title for button? (e.g. XYZZY); -2 + , 'shortcaption' => '%A%' +#@ ENDIF +#@ENDIF %_singlecontext% +#- +#@ASK Do you need a specific encoding for this tree ?; 2; yes, no; Y, N +#@IF %A% eq "Y" -#@Q --- Encoding name? (e.g. iso-8859-1); -2 +#@ ASK --- Encoding name? (e.g. iso-8859-1); -2 # Character encoding (overrides default) -#@A , 'encoding' => '@A' -#@end_Y + , 'encoding' => '%A%' +#@ENDIF # a link of the form (prefix)($filepath)(postfix) is generated when viewing a file # example for cvsweb: @@ -295,11 +138,12 @@ # Tree location subsection # #==========================# -#@V Describing tree location +#@LOG Describing tree location # sourceroot - where to get the source files from -#@begin_C Is your tree stored in a VCS repository (cvs, git, svn, bitkeeper)?; 2; yes, no; Y, N -#@case_C N +#@ASK,C Is your tree stored in a VCS repository (cvs, git, svn, bitkeeper)?; 2; yes, no; Y, N +#@CASE %C% +#@N: #- For ordinary directories, this specifies a directory which has each version as a #- subdirectory e.g. @@ -307,27 +151,29 @@ #- project-tree/version2/... #- The names of the version directories must match the values for the Version #- variable (see the version selection subsection). -#@V A source directory contains one sub-directory for every version. -#@Q --- Source directory? (e.g. /home/myself/kernel-tree); -2 -#@A , 'sourceroot' => '@A' -#@case_C Y -#@Q Sorry, invalid configuration! You are allowed to continue but; 1; next; y -#@Q stop when asked for a new tree. Then, remove the last tree sections; 1; next; y -#@Q from the output files (*.conf and initdb.sh) and start again ; 1; next; y -#@Q either with standard configuration driver lxr.conf for VCSes ; 1; next; y -#@Q or with lxrkernel.conf after having extracted kernel source ; 1; next; y -#@Q to ordinary files and directories. ; 1; next; y -#@Q NOTE: be careful to keep the #@here_tree label and the last ; 1; next; y -#@Q right parenthesis. ; 1; OK I understand; y -#@end_C +#@ MSG A source directory contains one sub-directory for every version. +#@ ASK --- Source directory? (e.g. /home/myself/project-tree); -2 + , 'sourceroot' => '%A%' +#- +#@Y: +#@ERROR Sorry, invalid configuration! You are allowed to continue but +#@ERROR stop when asked for a new tree. Then, remove the last tree sections +#@ERROR from the output files (*.conf and initdb.sh) and start again +#@ERROR either with standard configuration driver lxr.conf for VCSes +#@ERROR or with lxrkernel.conf after having extracted kernel source +#@ERROR to ordinary files and directories. +#@ERROR NOTE: be careful to keep the #@here_tree: label and the last +#@ERROR right parenthesis. +#@ASK --- Continue now?; 1; OK I understand; y +#@ENDC # The string to display as the base part of every path in the tree , 'sourcerootname' => '$v' # Version selection subsection # #==============================# -#@V Enumerating versions -#@V This relies on script kernel-vars-grab.sh +#@LOG Enumerating versions +#@MSG This relies on script kernel-vars-grab.sh , 'variables' => @@ -343,59 +189,70 @@ { 'v' => { 'name' => 'Version' - , 'range' => [ readfile('custom.d/version_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/version_list.txt') ] +#- - Default initial version to display +#@MSG By default, first version in list is displayed. You may also indicate +#@MSG a prefered version. +#@ ASK --- Default displayed version is first in 'range'?; 1; yes,no; Y,N +#@ IF %A% eq "N" +#@ ASK,N --- Default version name?; -2 + , 'default' => '%N%' +#@ ELSE # The default version to display + # If not specified, first in 'range' used +# , 'default' => 'v3.1' +#@ ENDIF } , 'a' => { 'name' => 'Architecture' - , 'range' => [ readfile('custom.d/arch_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/arch_list.txt') ] , 'default' => 'x86' } , 'arm_mach' => { 'name' => 'ARM machine' , 'when' => '"$a" eq "arm"' - , 'range' => [ readfile('custom.d/arm_mach_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/arm_mach_list.txt') ] } , 'arm_plat' => { 'name' => 'ARM platform' , 'when' => '"$a" eq "arm"' - , 'range' => [ readfile('custom.d/arm_plat_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/arm_plat_list.txt') ] } , 'avr32_mach' => { 'name' => 'AVR32 machine' , 'when' => '"$a" eq "avr32"' - , 'range' => [ readfile('custom.d/avr32_mach_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/avr32_mach_list.txt') ] } , 'blackfin_mach' => { 'name' => 'Blackfin machine' , 'when' => '"$a" eq "blackfin"' - , 'range' => [ readfile('custom.d/blackfin_mach_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/blackfin_mach_list.txt') ] } , 'cris_arch' => { 'name' => 'CRIS architecture' , 'when' => '"$a" eq "cris"' - , 'range' => [ readfile('custom.d/cris_arch_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/cris_arch_list.txt') ] } , 'mn10300_proc' => { 'name' => 'MN10300 processor' , 'when' => '"$a" eq "mn10300"' - , 'range' => [ readfile('custom.d/mn10300_proc_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/mn10300_proc_list.txt') ] } , 'mn10300_unit' => { 'name' => 'MN10300 unit' , 'when' => '"$a" eq "mn10300"' - , 'range' => [ readfile('custom.d/mn10300_unit_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/mn10300_unit_list.txt') ] } , 'um_sys' => { 'name' => 'UM system' , 'when' => '"$a" eq "um"' - , 'range' => [ readfile('custom.d/um_sys_list.txt') ] + , 'range' => [ readfile('%LXRconfdir%/um_sys_list.txt') ] } } # Subdirectory subsection # #=========================# -#@V Setting directory lists +#@LOG Setting directory lists # Tree-specific files to ignore (in every directory of the tree) # Extend and uncomment the following copy of the global @@ -408,12 +265,17 @@ # project history. Note that .xxx directories are hidden # by an internal hard-coded rule. Redundant example: # , 'ignoredirs' => ['CVSROOT', 'CVS', '.git'] -#@V Some directories may contain non-public project data (binaries, -#@V compilers caches, SCM control data, ...). They can be hidden from LXR. +#@MSG Some directories may contain non-public project data (binaries, +#@MSG compilers caches, SCM control data, ...). They can be hidden from LXR. +#@KEEPON --- Directory to ignore, e.g. CVSROOT or CVS? (hit return to stop) +#@ ON first , 'ignoredirs' => [qw( -#@QR --- Directory to ignore, e.g. CVSROOT or CVS? (hit return to stop); -3 -#@A @A +#@ ENDON + %A% +#@ ON last )] +#@ ENDON +#@ENDK # Where to look for include files inside the sourcetree. # This is used to hyperlink to included files. @@ -442,100 +304,10 @@ # Data storage subsection # #=========================# -#@V Configuring data storage - - # The DBI ident... [truncated message content] |
From: Andre-Littoz <ajl...@us...> - 2013-01-11 11:53:17
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30839/scripts Modified Files: configure-lxr.pl recreatedb.pl Added Files: ContextMgr.pm LCLInterpreter.pm Log Message: Configuration process: part 1/5 New LXR control language Create LCLInterpreter.pm for LCL mangement and interpretation, offering a common module to configure-lxr.pl and recreatedb.pl Common factor context management for use by configure-lxr.pl and recreatedb.pl ExpandHash.pm & ExpandSlashStar.pm no longer needed (replaced by LCLInterpreter.pm), will be erased in next update --- NEW FILE: ContextMgr.pm --- # -*- tab-width: 4 -*- ############################################### # # $Id: ContextMgr.pm,v 1.1 2013/01/11 11:53:13 ajlittoz Exp $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ############################################### package ContextMgr; use strict; use lib do { $0 =~ m{(.*)/}; "$1" }; use QuestionAnswer; use VTescape; ############################################################## # # Define global parameters # ############################################################## require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( $cardinality $dbengine $dbenginechanged $dbpolicy $dbname $dbuser $dbpass $dbprefix $nodbuser $nodbprefix &contextReload &contextSave &contextDB ); our $cardinality; our $dbengine; our $dbenginechanged = 0; our $dbpolicy; our $dbname; our $dbuser; our $dbpass; our $dbprefix; our $nodbuser; our $nodbprefix; # WARNING: remember to increment this number when changing the # set of state variables and/or their meaning. my $context_version = 1; ############################################################## # # Reload context file # ############################################################## sub contextReload { my ($verbose, $ctxtfile) = @_; my $reloadstatus = 0; if (my $c=open(SOURCE, '<', $ctxtfile)) { print "Initial context $ctxtfile is reloaded\n" if $verbose; # Default record separator # changed to read full file content at once and restored afterwards my $oldsep = $/; $/ = undef; my $context = <SOURCE>; $/ = $oldsep; close(SOURCE); my ($confout) =~ m/\n# Context .* with (.*?)\n/g; my $context_created; eval($context); if (!defined($context_created)) { print "${VTred}ERROR:${VTnorm} saved context file probably damaged!\n"; print "Check variable not found\n"; print "Delete or rename file $ctxtfile to remove lock.\n"; exit 1; } if ($context_created != $context_version) { print "${VTred}ERROR:${VTnorm} saved context file probably too old!\n"; print "Recorded state version = $context_created while expecting version = $context_version\n"; print "It is wise to 'quit' now and add manually the new tree or reconfigure from scratch.\n"; print "You can however try to restore the initial context at your own risk.\n"; print "\n"; print "${VTyellow}WARNING:${VTnorm} inconsistent answers can lead to LXR malfunction.\n"; print "\n"; if ('q' eq get_user_choice ( 'Do you want to quit or manually restore context?' , 1 , [ 'quit', 'restore' ] , [ 'q', 'r' ] ) ) { exit 1; } $reloadstatus = 1; }; if ($dbpolicy eq 't') { print "Your DB engine was: ${VTbold}"; if ("m" eq $dbengine) { print "MySQL"; } elsif ("o" eq $dbengine) { print "Oracle"; } elsif ("p" eq $dbengine) { print "PostgreSQL"; } elsif ("s" eq $dbengine) { print "SQLite"; } else { print "???${VTnorm}\n"; print "${VTred}ERROR:${VTnorm} saved context file damaged or tampered with!\n"; print "Unknown database code '$dbengine'\n"; print "Delete or rename file $ctxtfile to remove lock.\n"; if ('q' eq get_user_choice ( 'Do you want to quit or manually restore context?' , 1 , [ 'quit', 'restore' ] , [ 'q', 'r' ] ) ) { exit 1; } $reloadstatus = 1; }; } } else { print "${VTyellow}WARNING:${VTnorm} could not reload context file ${VTbold}$ctxtfile${VTnorm}!\n"; print "You may have deleted the context file or you moved the configuration\n"; print "file out of the user-configuration directory without the\n"; print "context companion file ${VTyellow}$ctxtfile${VTnorm}.\n"; print "\n"; print "You can now 'quit' to think about the situation or try to restore\n"; print "the parameters by answering the following questions\n"; print "(some clues can be gathered from reading configuration file).\n"; print "\n"; print "${VTyellow}WARNING:${VTnorm} inconsistent answers can lead to LXR malfunction.\n"; print "\n"; if ('q' eq get_user_choice ( 'Do you want to quit or manually restore context?' , 1 , [ 'quit', 'restore' ] , [ 'q', 'r' ] ) ) { exit 1; }; $reloadstatus = 1; } return $reloadstatus; } ############################################################## # # Save context for future additions # ############################################################## sub contextSave { my ($ctxtfile, $confout) = @_; if (open(DEST, '>', $ctxtfile)) { print DEST "# -*- mode: perl -*-\n"; print DEST "# Context file associated with $confout\n"; my @t = gmtime(time()); my ($sec, $min, $hour, $mday, $mon, $year) = @t; my $date_time = sprintf ( "%04d-%02d-%02d %02d:%02d:%02d" , $year + 1900, $mon + 1, $mday , $hour, $min, $sec ); print DEST "# Created $date_time UTC\n"; print DEST "# Strictly internal, do not play with content\n"; print DEST "\$context_created = $context_version;\n"; print DEST "\n"; print DEST "\$cardinality = '$cardinality';\n"; print DEST "\$dbpolicy = '$dbpolicy';\n"; print DEST "\$dbengine = '$dbengine';\n"; if ("g" eq $dbpolicy) { print DEST "\$dbname = '$dbname';\n"; } if ($nodbuser) { print DEST "\$nodbuser = 1;\n"; } else { print DEST "\$dbuser = '$dbuser';\n"; print DEST "\$dbpass = '$dbpass';\n"; } if ($nodbprefix) { print DEST "\$nodbprefix = 1;\n"; } else { print DEST "\$dbprefix = '$dbprefix'\n"; } close(DEST) or print "${VTyellow}WARNING:${VTnorm} error $! when closing context file ${VTbold}$confout${VTnorm}!\n"; } else { print "${VTyellow}WARNING:${VTnorm} could not create context file ${VTbold}$confout${VTnorm}, autoreload disabled!\n"; } } ############################################################## # # Describe database context # ############################################################## sub contextDB { my ($verbose) = @_; $dbengine = get_user_choice ( 'Database engine?' , 1 , [ 'mysql', 'oracle', 'postgres', 'sqlite' ] , [ 'm', 'o', 'p', 's' ] ); # Are we configuring for single tree or multiple trees? $cardinality = get_user_choice ( 'Configure for single/multiple trees?' , 1 , [ 's', 'm' ] , [ 's', 'm' ] ); if ($cardinality eq 's') { if ('y' eq get_user_choice ( 'Do you intend to add other trees later?' , 2 , [ 'yes', 'no' ] , [ 'y', 'n'] ) ) { $cardinality = 'm'; print "${VTyellow}NOTE:${VTnorm} installation switched to ${VTbold}multiple${VTnorm} mode\n"; print " but describe just a single tree.\n"; } else { $dbpolicy = 't'; $nodbuser = 1; $nodbprefix = 1; } } if ($cardinality eq 'm') { if ('o' ne $dbengine) { if ($verbose > 1) { print "The safest option is to create one database per tree.\n"; print "You can however create a single database for all your trees with a specific set of\n"; print "tables for each tree (though this is not recommended).\n"; } $dbpolicy = get_user_choice ( 'How do you setup the databases?' , 1 , [ 'per tree', 'global' ] , [ 't', 'g' ] ); if ($dbpolicy eq 'g') { # Single global database if ('s' eq $dbengine) { $dbname = get_user_choice ( 'Name of global SQLite database file? (e.g. /home/myself/SQL-databases/lxr' , -2 , [] , [] ); } else { $dbname = get_user_choice ( 'Name of global database?' , -1 , [] , [ 'lxr' ] ); } $nodbprefix = 1; } } else { if ($verbose > 1) { print "There is only one global database under Oracle.\n"; print "The tables for each tree are identified by a unique prefix.\n"; } $dbpolicy = 'g'; $nodbprefix = 1; } if ($verbose > 1) { print "All databases can be accessed with the same username and\n"; print "can also be described under the same names.\n"; } if ('n' eq get_user_choice ( 'Will you share database characteristics?' , 1 , [ 'yes', 'no' ] , [ 'y', 'n'] ) ) { $nodbuser = 1; $nodbprefix = 1; } } elsif ('o' eq $dbengine) { $dbpolicy = 'g'; $nodbuser = undef; } if (!defined($nodbuser)) { if ( $dbpolicy eq 'g' || 'y' eq get_user_choice ( 'Will you use the same username and password for all DBs?' , 1 , [ 'yes', 'no' ] , [ 'y', 'n'] ) ) { $dbuser = get_user_choice ( '--- DB user name?' , -1 , [] , [ 'lxr' ] ); $dbpass = get_user_choice ( '--- DB password ?' , -1 , [] , [ 'lxrpw' ] ); } else { $nodbuser = 1; } } if (!defined($nodbprefix)) { if ('y' eq get_user_choice ( 'Will you give the same prefix to all tables?' , 1 , [ 'yes', 'no' ] , [ 'y', 'n'] ) ) { $dbprefix = get_user_choice ( '--- Common table prefix?' , -1 , [] , [ 'lxr_' ] ); }else { $nodbprefix = 1; } } } 1; --- NEW FILE: LCLInterpreter.pm --- # -*- tab-width: 4 -*- ############################################### # # $Id: LCLInterpreter.pm,v 1.1 2013/01/11 11:53:13 ajlittoz Exp $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ############################################### # $Id: LCLInterpreter.pm,v 1.1 2013/01/11 11:53:13 ajlittoz Exp $ package LCLInterpreter; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( &expand_hash &expand_slash_star &pass2_hash &pass2_slash_star ); use strict; # use File::Path; use lib do { $0 =~ m{(.*)/}; "$1" }; use QuestionAnswer; use VTescape; ############################################################## # # LXR Control Language Interpreter # ############################################################## # LCL is embedded inside file comments. The exact nature of a # 'comment' is defined by the derived classes which hand over # the comment content for interpretation. # A comment is an LCL candidate if it has the following form: # 1. Comment starts in column 1 # This allows to have arbitrary comment anywhere else, # even if it looks like an LCL statement. # 2. @ immediately follows the starting comment delimiter # 3. The rest of the comment will be scanned by the interpreter. # *** LCL statements *** # == Syntax == # = Comment = # Beware that the parser is very very simple. The commands cannot contain # any form of comment. This would severely disturb the expression scanner. # = Label: @<label>:[<label:] = # <label> is a string of a-zA-Z0-9_ followed by a colon, without # intervening whitespace. If more than one label is needed, repeat the # construct without intervening whitespace. # NOTE: in the present implementation, labels cannot prefix a command. # In context where labels are meaningful (i.e. @CASE blocks), the # line containing the label is eaten up by skipping code. When # control is returned to the interpreter, this line is lost. # It can no longer trigger any action. # = Statement: @<name> [<arguments>] # <name> is an alphanumeric string. Case is indifferent. # The following sections list the known statements. # An error is issued for an unknown statement . # == Message display == # @LOG message # @MSG message # @REMIND message # @ERROR message # These statements print their argument depending on "verbosity". # @ERROR and @REMIND are always displayed, @LOG is displayed under moderate # verbosity and @MSG under full verbosity. # Note that message does not require delimiters. Everything after the # whitespace following command name is part of the message. # == Conditional commands == # Conditional blocks may be nested. # @IF <expr> # @ELSEIF <expr> # @ELSE # @ENDIF # @CASE <variable> # <Label> # @ENDC # == User interaction == # Single shot, with input kept in <var>: # @ASK[,<var>] <question>; <kind>; <choices>; <answers> # Continuous until empty answer, with input kept in <var>: # @KEEPON[,<var>] <question>[; -2] # @ON first # @ENDON # @ON last # @ENDON # @ON none # @ENDON # @ENDK # By convention, <var> name is a single uppercase letter. # kind defines the expected answer: # -3 any, empty string allowed # -2 any but empty string is not allowed # -1 any, empty string implies default answer # 0 one among choices, empty string not allowed # i>0 one among choices, empty string means choice number i # choices is empty for -2 and -3 # answers provides "normalised" answers corresponding to choices. # If kind=-1, must define a default answer (possibly empty). # choices and answers are comma-separated lists. # Answer to question is stored for use in <var>, by default A. # The lines between @KEEPON and @ENDK are repetitively interpreted # with <var> containing the most recent "answer" from the user. # @KEEPON implicitly uses a -3 "kind" since it is necessary to allow a # "bare" empty answer to exit the loop. # @KEEPON blocks may be nested in other conditional blocks and may # contain arbitrary content, including other @KEEPON blocks. # == Variable definition == # @DEFINE <var>=<expr> # Define a %marker% (% characters are internally added) equal to the # value of an expression. # Afterwards, %marker% can be used for substitution. # NOTE: since the simple parser only allows for A-Za-z0-9_ characters # in both marker and option, a translation is needed between the # shell option name and the #@D option name. # This is done through the hash reference $option_trans, i.e. # $$option_trans{'option'} gives the value to use. # == Shell command insertion == # @XQT <shell command> # Insert <shell command> into the output stream when generating for a # shell (i.e. marker %_shell% defined and non zero). # == File inclusion == # @ADD <filename> # Interpretation continues inside <filename> which may itself contain # other @ADD commands. # Limitations: # 1. @ADD is effective only when met while interpreting. @ADD is not # taken into account when it appears inside skipped blocks (inactive # branch of @IF/@ELSE/@ENDIF or unselected case of @CASE/@ENDK, ...) # 2. Consequence of 1., do not open any block (@CASE, @IF, @KEEPON, # @PASS2) in one file and put the closing command in another file. # Due to the possible skip of intervening statements, the @ADD # containing the opening orclosing statement might be not # interpreted and the stream will appear incorrectly bracketed. # File name path: the current directory is the one in effect when the # configurator is launched. It might be better to use OS-absolute paths. # == Delayed interpretation == # @PASS2 <label> # @ENDP2 # Mark a block for later interpretation (mainly used to add tree # specific sections into the output stream). # @PASS2 blocks cannot be nested. # During pass 1, add label <label> into the output stream and skip # interpretation of block. # During pass 2 and following, template is read sequentially for @PASS2. # When one is found, output stream is advanced up to the corresponding # label which is replaced by the interpreted content of block and <label> # is written again. Other @PASS2 blocks are looked for until EOF. # NOTE: Due to the scanning difference between pass 1 and 2, statements # @PASS2 and @ENDP2 must not be coded inside @ADD'ed files or # nested in @IF, @CASE or @KEEPON blocks. # @PASS2 blocks may contain @ASK or @KEEPON statements, but this # is not recommended unless they are preceded by explicit @LOG # or @MSG clearly showing we are in pass 2. ############################################################## # # Part 1: template file expansion # ############################################################## sub expand_hash { my @args = @_; expand ( @args , '#', '' , '~~~TO~EOF~~~' # Hope this is never used as a label! ); } sub expand_slash_star { my @args = @_; expand ( @args , qr(/\*), qr(\*/) , '~~~TO~EOF~~~' # Hope this is never used as a label! ); } sub expand { my ($source, $dest, $markers, $verbose, $comstart, $comend, $end_label) = @_; my $line; SCAN: while ($line = &$source()) { # Are we done? return parse_statement ($line, $comstart, $comend) if $line =~ m/^${comstart}\@$end_label/; # Suppress erasable comments if ($comend eq '') { if ( $line =~ s/${comstart}-.*// && $line =~ m/^\s*\n$/ ) { next; } } else { if ($line =~ m:${comstart}-:) { $line =~ s:(.*?)${comstart}-::; my $linehead = $1; if ($line =~ s:.*?-${comend}::) { $line = $linehead . $line; redo SCAN if $line !~ m/^\s*\n$/; } else { if ($linehead !~ m/^\s*$/) { print $dest $linehead, "\n"; } while ($line = &$source()) { if ($line =~ m:-${comend}:) { $line =~ s:.*?-${comend}::; redo SCAN if $line !~ m/^\s*\n$/; last; } } } next; } } ############################################# # # Statement interpreter # ############################################# # Is this an LCL statement? if ($line =~ m/^${comstart}@/) { my ($args, $var, $command, @labels) = parse_statement($line, $comstart, $comend); if ($command eq '') { # Label only? # Keep it in output file (NOTE: should not occur) # Fault-tolerant substitution line } elsif ($command eq 'U') { # Is processed below # Shell command } elsif ($command eq 'XQT') { if ($$markers{'%_shell%'}) { $line =~ s:^${comstart}\@${command}\s(.*)\s*${comend}\s*\n:$1\n:; } #else { # Uncomment to remove line from output # next; #} # Is further processed below # Messages } elsif ($command eq 'ERROR') { print "${VTred}ERROR:${VTnorm} $args\n"; next; } elsif ($command eq 'REMIND') { print "${VTyellow}Reminder:${VTnorm} $args\n"; next; } elsif ($command eq 'LOG') { print "${VTyellow}***${VTnorm} $args\n" if $verbose; next; } elsif ($command eq 'MSG') { print "${VTyellow}***${VTnorm} $args\n" if $verbose > 1; next; # User interaction } elsif ( $command eq 'ASK') { substitute_markers (\$args, $markers, $comstart, $comend); $$markers{"%$var%"} = ask_question($args); next; } elsif ($command eq 'KEEPON') { my %keep; if ($args =~ s/;\s*(-\d+)$//) { if ($1 != -2 && $1 != -3) { print "${VTred}ERROR:${VTnorm} illegal type $1 question for \@KEEPON!\n"; $args .= ';-3'; } else { $args .= ";$1"; } } else { $args .= ';-3'; } substitute_markers (\$args, $markers, $comstart, $comend); $keep{'q'} = $args; $keep{'v'} = $var; my @kbody; while ($command ne 'ENDK') { $line = &$source(); if ($line =~ m/${comstart}\@/) { ($args, $var, $command, @labels) = parse_statement($line, $comstart, $comend); last if $command eq 'ENDK'; if ($command eq 'ON') { my ($type) = $args =~ m/^(\w+)(?:\s|$)/; $type = lc($type); if ( $type ne 'first' && $type ne 'last' && $type ne 'none' ) { print "${VTred}ERROR:${VTnorm} unknown $type KEEPON action type!\n"; skip_until ( $source , qr/ENDON\b/i , 'KEEPON', 'ENDK' , $comstart, $comend ) } else { $keep{$type} = [ grab_block ( $source , qr/ENDON\b/i , 'KEEPON', 'ENDK' , $comstart, $comend ) ]; } } elsif ($command eq 'KEEP') { push ( @kbody , grab_block ( $source , qr/ENDK\b/i , 'KEEPON', 'ENDK' , $comstart, $comend ) ); } else { push (@kbody, $line); } } else { push (@kbody, $line); } } $keep{'body'} = [ @kbody ]; my $answer = ask_question($keep{'q'}); $$markers{"%${keep{'v'}}%"} = $answer; $keep{'q'} =~ s/;-2$/;-3/; # Ensure loop can be left if ($answer eq '') { # initial answer is empty, block is skipped. # See if action 'none' should be triggered. if (exists($keep{'none'})) { @kbody = @{$keep{'none'}}; expand ( sub { pop(@kbody) } , $dest , $markers , $verbose , $comstart, $comend , '~~~TO~EOF~~~' ); } next; } if (exists($keep{'first'})) { @kbody = @{$keep{'first'}}; expand ( sub { pop(@kbody) } , $dest , $markers , $verbose , $comstart, $comend , '~~~TO~EOF~~~' ); } while ($answer ne '') { @kbody = @{$keep{'body'}}; expand ( sub { pop(@kbody) } , $dest , $markers , $verbose , $comstart, $comend , '~~~TO~EOF~~~' ); $answer = ask_question($keep{'q'}); $$markers{"%${keep{'v'}}%"} = $answer; } if (exists($keep{'last'})) { @kbody = @{$keep{'last'}}; expand ( sub { pop(@kbody) } , $dest , $markers , $verbose , $comstart, $comend , '~~~TO~EOF~~~' ); } next; # Conditional block } elsif ($command eq 'IF') { while ($command ne 'ENDIF') { if ( $command eq 'ELSE' || evaluate_expr($args, $markers) ) { ($args, $var, $command, @labels) = expand ( $source, $dest , $markers , $verbose , $comstart, $comend , qr/\s*(ELSE(IF)?|ENDIF)\b/i ) ; if ($command ne 'ENDIF') { skip_until ( $source , qr/ENDIF\b/i , 'IF', 'ENDIF' , $comstart, $comend ) } ; last } ; ($args, $var, $command, @labels) = skip_until ( $source , qr/(ELSE(IF)?|ENDIF)\b/i , 'IF', 'ENDIF' , $comstart, $comend ) } next; # Selection block } elsif ($command eq 'CASE') { my $thecase = evaluate_expr($args, $markers); while (1) { ($args, $var, $command, @labels) = skip_until ( $source , qr/(\w+):/ , 'CASE', 'ENDC' , $comstart, $comend ) ; if ($command eq 'ENDC') { print "${VTred}ERROR:${VTnorm} no '$thecase' case label!\n"; ; last } ; if (grep {$thecase eq $_} @labels) { ($args, $var, $command, @labels) = expand ( $source, $dest , $markers , $verbose , $comstart, $comend , qr/((\w+):|((?i)\s*ENDC\b))/ ) ; if ($command ne 'ENDC') { skip_until ( $source , qr/ENDC\b/i , 'CASE', 'ENDC' , $comstart, $comend ) } ; last } } next; # Symbol definition } elsif ( $command eq 'DEFINE') { my ($var, $string) = ($args =~ m/^(\w+)\s*=\s*(.+)/); if (substr($var, 0, 1) eq '_') { print "${VTred}ERROR:${VTnorm} can't set read-only variable $var!\n"; } else { $$markers{"\%$var\%"} = evaluate_expr($string, $markers); } next; # Include a file } elsif ($command eq 'ADD') { if (!defined($args)) { print "${VTred}ERROR:${VTnorm} no file target on ADD!\n"; next; } my ($string) = ($args =~ m/^["']?(.+)["']?$/); $string = evaluate_expr("\"$string\"", $markers); if (open(ADD, '<', $string)) { expand ( sub { <ADD> } , $dest , $markers , $verbose , $comstart, $comend , '~~~TO~EOF~~~' ); } else { print "${VTred}ERROR:${VTnorm} couldn't open ADD'ed file \"${string}\"\n"; } close ADD; next; # Block for pass 2 } elsif ($command eq 'PASS2') { if (!defined($args)) { print "${VTred}ERROR:${VTnorm} PASS2 must define a label replacement for the block!\n"; $args = 'courtesy_label'; } # Replace the block with a label $line =~ s/^(${comstart}\@).+(${comend})\s*\n/$1${args}:$3\n/; skip_until ( $source , qr/ENDP2\b/i , '~~~TO~EOF~~~', '~~~TO~EOF~~~' , $comstart, $comend ) } elsif ( $command eq 'ELSE' || $command eq 'ELSEIF' || $command eq 'ENDIF' || $command eq 'ENDC' || $command eq 'ENDK' || $command eq 'ON' || $command eq 'ENDON' || $command eq 'PASS2' ) { print "${VTred}ERROR:${VTnorm} spurious $command!\n"; next; } else { # Unknown LCL statement print "${VTred}ERROR:${VTnorm} unknown command $command!\n"; next; } } # Substitute marker value substitute_markers (\$line, $markers, $comstart, $comend); print $dest $line; } } ############################################################## # # Part 2: special block expansion/insertion for # second and eventual subsequent passes # ############################################################## sub pass2_hash { my @args = @_; pass2 (@args, '#', ''); } sub pass2_slash_star { my @args = @_; pass2 (@args, qr(/\*), qr(\*/)); } sub pass2 { my ($source, $dest, $markers, $verbose, $comstart, $comend) = @_; my $line; unless (open(DESTIN, '<', $dest)) { die("${VTred}ERROR:${VTnorm} couldn't reread output file \"$dest\"\n"); } unless (open(DESTOUT, '>', "$dest.LXR")) { die("${VTred}ERROR:${VTnorm} couldn't open temporary file \"$dest\"\n"); } while ($line = <$source>) { if ($line =~ m/^${comstart}\@\s*PASS2\b/) { my ($args, $var, $command, @labels) = parse_statement($line, $comstart, $comend); if (!defined($args)) { print "${VTred}Warning:${VTnorm} using a courtesy label for missing PASS2 label!\n"; $args = 'courtesy_label'; } my $mark_label = $line; $mark_label =~ s/^(${comstart}\@).+(${comend})\s*\n/$1${args}:$2\n/; # Position destination file on corresponding label while (<DESTIN>) { last if m/^${comstart}\@$args:/; print DESTOUT $_; } if (!defined($line)) { print "${VTred}Error:${VTnorm} label $args not found in destination file!\n"; return; } # Expand dedicated block expand ( sub { <$source> }, \*DESTOUT , $markers , $verbose , $comstart, $comend , qr/s*ENDP2\b/i ); # Rewrite lable for eventual other passes print DESTOUT $mark_label; } } # Copy rest of destination file while (<DESTIN>) { print DESTOUT $_; } # Switch files close(DESTIN); close(DESTOUT); unlink $dest; rename "$dest.LXR", $dest; } ############################################################## # # Auxiliary routines # ############################################################## # parse_statement splits an LCL statement into components # Command name is uppercased to ease processing independent of # case. If no variable is defined, a default A is provided. sub parse_statement { my ($line, $comstart, $comend) = @_; $line =~ s/^${comstart}@//; # Get rid of prefix my @labels; while ($line =~ s/^(\w+)://g) { # Grab labels push @labels, $1; } $line =~ s/^\s*(\w+)//; # Grab command name my $command = uc($1); my $var = 'A'; # Grab var name $var = $1 if $line =~ s/^,(\w+)//; my ($args) = ($line =~ m/^\s+(.*)\s*${comend}\s*\n/); return ($args, $var, $command, @labels); } # substitute_markers replaces %xxx% occurrences by value of # marker xxx. If original string is prefixed by LCL command # @U, no error is issued for unknown marker and command prefix is # left in place (so that the string looks like a comment), # otherwise the @U command is transformed into a common string. sub substitute_markers { my ($line, $markers, $comstart, $comend) = @_; if ($$line =~ m/%\w+%/) { my $line_sub; my $failure = 0; my $optional_subst = $$line =~ m/^${comstart}\@U/; while ($$line =~ s/^(.*?)(%\w+%)//) { $line_sub .= $1; if (exists($$markers{$2})) { $line_sub .= $$markers{$2}; } else { $line_sub .= $2; $failure = 1; if (!$optional_subst) { print "${VTred}ERROR:${VTnorm} unknown $2 substitution marker!\n"; } } } $$line = $line_sub . $$line; if ( !$failure && $optional_subst && $$line =~ s/^${comstart}\@U// ) { $$line =~ s/\s*${comend}\s*\n/\n/; } } } # evaluate_expr evaluate its argument as a Perl expression # (mainly string comparisons). # Occurrences of %xxx% are transformed into local string variables. # NOTE: do not abuse expression complexity! The configurator may # some day be rewritten in another language where expression # evaluation will have to be programmed. Its power will certainly # be limited to basic needs such as string comparison and logical # combination. sub evaluate_expr { my ($expr, $markers) = @_; my %exprvars; my $theeval; # List used variables and check for illegal computation # NOTE: $op can be extended for more complex valid expressions my $op = qr/(?:eq|ne)/; while ($expr =~ m/($op\s*)?%(\w+)%(\s*$op)?/g) { # Make a difference between test for existence/definedness and # usage in a comparison/computation where value is needed if ( (defined($1) || defined($3)) && !exists($$markers{"\%$2\%"})) { print "${VTred}ERROR:${VTnorm} unknown $2 substitution marker!\n"; } }; my @allvars = ($expr =~ m/%(\w+)%/g); for (@allvars) { $exprvars{$_} = 1; } # Build the expression to evaluate $expr =~ s/%(\w+)%/\$\{_${1}_\}/g; foreach my $newvar (keys %exprvars) { $theeval .= 'my $_' . $newvar . '_ = "' . $$markers{"\%$newvar\%"} . '"; '; } $theeval .= $expr; my $res = eval($theeval); if ($@) { print "${VTred}ERROR:${VTnorm} bad expression: $@"; print "${VTyellow}$expr${VTnorm}\n"; return undef; } return $res; } # skip_until skips lines until a matching sentinel # is found. It takes care of nested blocks. sub skip_until { my ($source, $sentinel, $begin, $end, $comstart, $comend) = @_; my $stop; if ($sentinel =~ m/\):/) { $stop = qr/^${comstart}\@${sentinel}/; } else { $stop = qr/^${comstart}\@\s*${sentinel}/; } my $start_block = qr/^${comstart}\@\s*${begin}\b\s/i; my $end_block = qr/^${comstart}\@\s*${end}\b/i; my $nesting = 0; while (my $line = &$source()) { if ($line =~ m/$end_block/) { return parse_statement($line, $comstart, $comend) if $nesting == 0; $nesting--; next; } if ($line =~ m/$start_block/) { $nesting++; next; } if ( $nesting == 0 && $line =~ m/$stop/ ) { return parse_statement($line, $comstart, $comend); } } print "${VTred}ERROR:${VTnorm} improper nesting of conditional block!\n"; print "${VTred}ERROR:${VTnorm} still expecting $stop sentinel!\n"; die "Conditional block overflow"; } # grab_block stores lines until a matching sentinel # is found. It takes care of nested blocks. sub grab_block { my ($source, $sentinel, $begin, $end, $comstart, $comend) = @_; my @blocklines; my $stop; if ($sentinel =~ m/\):/) { $stop = qr/^${comstart}\@${sentinel}/; } else { $stop = qr/^${comstart}\@\s*${sentinel}/; } my $start_block = qr/^${comstart}\@\s*${begin}\s/i; my $end_block = qr/^${comstart}\@\s*${end}\b/i; my $nesting = 0; while (my $line = &$source()) { if ($line =~ m/$end_block/) { # Finding an end-of-block sentinel before the correct termination # is an error when recording sample code. This will be catched # at EOF (or, at least, I hope). # return @blocklines if $nesting == 0; $nesting--; next; } if ($line =~ m/$start_block/) { $nesting++; next; } if ( $nesting == 0 && $line =~ m/$stop/ ) { return @blocklines; } push @blocklines, $line; } print "${VTred}ERROR:${VTnorm} improper sample block limits!\n"; print "${VTred}ERROR:${VTnorm} still expecting $sentinel sentinel!\n"; die "Sample block overflow"; } # ask_question requests an answer from user. # This is an interface to get_user_choice in QuestionAnswer.pm sub ask_question { my ($qtext, $qdeft, $choices, $answer); my (@choices, @answers); $#choices = -1; $#answers = -1; ($qtext, $qdeft, $choices, $answer) = split(/;/, shift); if (defined($choices)) { @choices = map({s/^\s*(.*)\s*$/$1/; $_} split(/,/, $choices)); } if (defined($answer)) { @answers = map({s/^\s*(.*)\s*$/$1/; $_} split(/,/, $answer)); } $answer = get_user_choice ( $qtext , $qdeft , defined($choices) ? \@choices : undef , defined($answer) ? \@answers : undef ); return $answer; } 1; Index: configure-lxr.pl =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/configure-lxr.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- configure-lxr.pl 30 Sep 2012 07:27:06 -0000 1.5 +++ configure-lxr.pl 11 Jan 2013 11:53:13 -0000 1.6 @@ -26,8 +26,9 @@ use Getopt::Long qw(:config gnu_getopt); use File::Path qw(make_path); use lib do { $0 =~ m{(.*)/}; "$1" }; -use ExpandHash; -use ExpandSlashStar; + +use ContextMgr; +use LCLInterpreter; use QuestionAnswer; use VTescape; @@ -81,7 +82,8 @@ , 'root-dir=s' => \$rootdir , 'script-out=s'=> \$scriptout , 'tmpl-dir=s' => \$tmpldir - , 'verbose|v' => \$verbose + , 'verbose:2' => \$verbose + , 'v+' => \$verbose , 'version' ) ) { @@ -232,60 +234,14 @@ if ($verbose) { print "\n"; } - -my $cardinality; -my $dbengine; -my $dbenginechanged = 0; -my $dbpolicy; -my $dbname; -my $dbuser; -my $dbpass; -my $dbprefix; -my $nodbuser; -my $nodbprefix; my %users; # Cumulative list of all user/password -# WARNING: remember to increment this number when changing the -# set of state variables and/or their meaning. -my $context_version = 1; - if ($addtree) { if ($verbose) { print "== ${VTyellow}ADD MODE${VTnorm} ==\n"; print "\n"; } - if (my $c=open(SOURCE, '<', "$confdir/$contextfile")) { - print "Initial context $confdir/$contextfile is reloaded\n" if $verbose; - $/ = undef; - my $context = <SOURCE>; - $/ = $oldsep; - close(SOURCE); - my $context_created; - eval($context); - if (!defined($context_created)) { - print "${VTred}ERROR:${VTnorm} saved context file probably damaged!\n"; - print "Check variable not found\n"; - print "Delete or rename file $confdir/$contextfile to remove lock.\n"; - exit 1; - } - if ($context_created != $context_version) { - print "${VTred}ERROR:${VTnorm} saved context file probably too old!\n"; - print "Recorded state version = $context_created while expecting version = $context_version\n"; - print "It is wise to 'quit' now and add manually the new tree or reconfigure from scratch.\n"; - print "You can however try to restore the initial context at your own risk.\n"; - print "\n"; - print "${VTyellow}WARNING:${VTnorm} inconsistent answers can lead to LXR malfunction.\n"; - print "\n"; - if ('q' eq get_user_choice - ( 'Do you want to quit or manually restore context?' - , 1 - , [ 'quit', 'restore' ] - , [ 'q', 'r' ] - ) ) { - exit 1; - } - $addtree = 2; - }; + $addtree += contextReload ($verbose, "$confdir/$contextfile"); if ($cardinality eq 's') { print "${VTred}ERROR:${VTnorm} initial configuration was done for a single tree!\n"; print "This is not compatible with the present web server configuration.\n"; @@ -293,30 +249,6 @@ exit 1; } if ($dbpolicy eq 't') { - print "Your DB engine was: ${VTbold}"; - if ("m" eq $dbengine) { - print "MySQL"; - } elsif ("o" eq $dbengine) { - print "Oracle"; - } elsif ("p" eq $dbengine) { - print "PostgreSQL"; - } elsif ("s" eq $dbengine) { - print "SQLite"; - } else { - print "???${VTnorm}\n"; - print "${VTred}ERROR:${VTnorm} saved context file damaged or tampered with!\n"; - print "Unknown database code '$dbengine'\n"; - print "Delete or rename file $confdir/$contextfile to remove lock.\n"; - if ('q' eq get_user_choice - ( 'Do you want to quit or manually restore context?' - , 1 - , [ 'quit', 'restore' ] - , [ 'q', 'r' ] - ) ) { - exit 1; - } - $addtree = 2; - }; print "${VTnorm}\n"; print "Advanced users can configure different DB engines for different trees.\n"; print "This is not recommended for average users.\n"; @@ -335,32 +267,10 @@ $dbenginechanged = 1; } } - } else { - print "${VTyellow}WARNING:${VTnorm} could not reload context file ${VTbold}$confout${VTnorm}!\n"; - print "You may have deleted the context file or you moved the configuration\n"; - print "file out of the ${VTbold}${confdir}${VTnorm} user-configuration directory without the\n"; - print "context companion file ${VTyellow}$contextfile${VTnorm}.\n"; - print "\n"; - print "You can now 'quit' to think about the situation or try to restore\n"; - print "the parameters by answering the following questions\n"; - print "(some clues can be gathered from reading configuration file ${VTbold}$confout${VTnorm}).\n"; - print "\n"; - print "${VTyellow}WARNING:${VTnorm} inconsistent answers can lead to LXR malfunction.\n"; - print "\n"; - if ('q' eq get_user_choice - ( 'Do you want to quit or manually restore context?' - , 1 - , [ 'quit', 'restore' ] - , [ 'q', 'r' ] - ) ) { - exit 1; - }; - $addtree = 2; - } } if ($addtree != 1) { - if ($verbose) { + if ($verbose > 1) { print "The choice of the database engine can make a difference in indexing performance,\n"; print "but resource consumption is also an important factor.\n"; print " * For a small personal project, try ${VTbold}SQLite${VTnorm} which do not\n"; @@ -376,132 +286,9 @@ print " of bigger databases.\n"; print " * Take also in consideration the number of connected users.\n"; } - $dbengine = get_user_choice - ( 'Database engine?' - , 1 - , [ 'mysql', 'oracle', 'postgres', 'sqlite' ] - , [ 'm', 'o', 'p', 's' ] - ); - - # Are we configuring for single tree or multiple trees? - $cardinality = get_user_choice - ( 'Configure for single/multiple trees?' - , 1 - , [ 's', 'm' ] - , [ 's', 'm' ] - ); - - if ($cardinality eq 's') { - if ('y' eq get_user_choice - ( 'Do you intend to add other trees later?' - , 2 - , [ 'yes', 'no' ] - , [ 'y', 'n'] - ) - ) { - $cardinality = 'm'; - print "${VTyellow}NOTE:${VTnorm} installation switched to ${VTbold}multiple${VTnorm} mode\n"; - print " but describe just a single tree.\n"; - } else { - $dbpolicy = 't'; - $nodbuser = 1; - $nodbprefix = 1; - } - } - - if ($cardinality eq 'm') { - if ('o' ne $dbengine) { - print "The safest option is to create one database per tree.\n"; - print "You can however create a single database for all your trees with a specific set of\n"; - print "tables for each tree (though this is not recommended).\n"; - $dbpolicy = get_user_choice - ( 'How do you setup the databases?' - , 1 - , [ 'per tree', 'global' ] - , [ 't', 'g' ] - ); - if ($dbpolicy eq 'g') { # Single global database - if ('s' eq $dbengine) { - $dbname = get_user_choice - ( 'Name of global SQLite database file? (e.g. /home/myself/SQL-databases/lxr' - , -2 - , [] - , [] - ); - } else { - $dbname = get_user_choice - ( 'Name of global database?' - , -1 - , [] - , [ 'lxr' ] - ); - } - $nodbprefix = 1; - } - } else { - print "There is only one global database under Oracle.\n"; - print "The tables for each tree are identified by a unique prefix.\n"; - $dbpolicy = 'g'; - $nodbprefix = 1; - } - print "All databases can be accessed with the same username and\n"; - print "can also be described under the same names.\n"; - if ('n' eq get_user_choice - ( 'Will you share database characteristics?' - , 1 - , [ 'yes', 'no' ] - , [ 'y', 'n'] - ) - ) { - $nodbuser = 1; - $nodbprefix = 1; - } - } - - if (!defined($nodbuser)) { - if ( $dbpolicy eq 'g' - || 'y' eq get_user_choice - ( 'Will you use the same username and password for all DBs?' - , 1 - , [ 'yes', 'no' ] - , [ 'y', 'n'] - ) - ) { - $dbuser = get_user_choice - ( '--- DB user name?' - , -1 - , [] - , [ 'lxr' ] - ); - $dbpass = get_user_choice - ( '--- DB password ?' - , -1 - , [] - , [ 'lxrpw' ] - ); - $users{$dbuser} = $dbpass; # Record global user/password - } else { - $nodbuser = 1; - } - } - - if (!defined($nodbprefix)) { - if ('y' eq get_user_choice - ( 'Will you give the same prefix to all tables?' - , 1 - , [ 'yes', 'no' ] - , [ 'y', 'n'] - ) - ) { - $dbprefix = get_user_choice - ( '--- Common table prefix?' - , -1 - , [] - , [ 'lxr_' ] - ); - }else { - $nodbprefix = 1; - } + contextDB ($verbose); + if ($dbuser) { + $users{$dbuser} = $dbpass; # Record global user/password } } @@ -512,41 +299,7 @@ ############################################################## if (!$addtree) { - if (open(DEST, '>', "$confdir/$contextfile")) { - print DEST "# -*- mode: perl -*-\n"; - print DEST "# Context file associated with $confout\n"; - my @t = gmtime(time()); - my ($sec, $min, $hour, $mday, $mon, $year) = @t; - my $date_time = sprintf ( "%04d-%02d-%02d %02d:%02d:%02d" - , $year + 1900, $mon + 1, $mday - , $hour, $min, $sec - ); - print DEST "# Created $date_time UTC\n"; - print DEST "# Strictly internal, do not play with content\n"; - print DEST "\$context_created = $context_version;\n"; - print DEST "\n"; - print DEST "\$cardinality = '$cardinality';\n"; - print DEST "\$dbpolicy = '$dbpolicy';\n"; - print DEST "\$dbengine = '$dbengine';\n"; - if ("g" eq $dbpolicy) { - print DEST "\$dbname = '$dbname';\n"; - } - if ($nodbuser) { - print DEST "\$nodbuser = 1;\n"; - } else { - print DEST "\$dbuser = '$dbuser';\n"; - print DEST "\$dbpass = '$dbpass';\n"; - } - if ($nodbprefix) { - print DEST "\$nodbprefix = 1;\n"; - } else { - print DEST "\$dbprefix = '$dbprefix'\n"; - } - close(DEST) - or print "${VTyellow}WARNING:${VTnorm} error $! when closing context file ${VTbold}$confout${VTnorm}!\n"; - } else { - print "${VTyellow}WARNING:${VTnorm} could not create context file ${VTbold}$confout${VTnorm}, autoreload disabled!\n"; - } + contextSave ("$confdir/$contextfile", $confout); } ############################################################## @@ -555,27 +308,34 @@ # ############################################################## -my %option_trans = - ( 'add' => $addtree - , 'context' => $cardinality - , 'createglobals' => $cardinality eq 'm' +# %markers contains value for "options" (or their equivalent) +# which are not meant for substitution in the templates (this +# is indicated by the _ prefix, but not checked), +# and "substitution markers". +# From release 1.1 on, both are stuffed in the same hash since +# it simplifies processing in the macro interpreter. +my %markers = + ( '%_add%' => $addtree + , '%_singlecontext%' => $cardinality eq 's' + , '%_createglobals%' => $cardinality eq 'm' && ( 0 == $addtree || 1 == $dbenginechanged ) - , 'dbengine'=> $dbengine - , 'dbpass' => $dbpass - , 'dbpolicy'=> $dbpolicy - , 'dbprefix'=> $dbprefix - , 'dbuser' => $dbuser - , 'dbuseroverride' => 0 - , 'nodbuser'=> $nodbuser - , 'nodbprefix' => $nodbprefix + , '%_dbengine%' => $dbengine + , '%_dbpass%' => $dbpass + , '%_dbprefix%' => $dbprefix + , '%_dbuser%' => $dbuser + , '%_dbuseroverride%' => 0 + , '%_globaldb%' => $dbpolicy eq 'g' + , '%_nodbuser%' => $nodbuser + , '%_nodbprefix%' => $nodbprefix ); - -my %markers; my $sample; +$markers{'%LXRconfUser%'} = getlogin; # OS-user running configuration $markers{'%LXRroot%'} = $rootdir; +$markers{'%LXRtmpldir%'} = $tmpldir; +$markers{'%LXRconfdir%'} = $confdir; $sample = `command -v glimpse 2>/dev/null`; chomp($sample); $markers{'%glimpse%'} = $sample if $sample; @@ -687,6 +447,27 @@ # ############################################################## +sub copy_and_configure_template { + my ($fin, $fout, $target) = @_; + + unless (open(SOURCE, '<', $fin)) { + die("${VTred}ERROR:${VTnorm} couldn't open template file \"$fin\"\n"); + } + unless (open(DEST, '>', $fout)) { + die("${VTred}ERROR:${VTnorm} couldn't open output file \"$fout\n"); + } + expand_hash ( sub{ <SOURCE> } + , \*DEST + , \%markers + , $verbose + ); + close(DEST); + close(SOURCE); + if ($target && $verbose) { + print "file ${VTbold}$target${VTnorm} written into configuration directory\n" + } +} + if (!$addtree) { print "\n" if $verbose; @@ -696,87 +477,46 @@ } my $target; - my $target_contents; # Apache: per-directory access control file $target = '.htaccess'; `cp ${tmpldir}/Apache/htaccess-generic ${rootdir}/$target`; chmod(0775, "${rootdir}/$target"); - if ($verbose) { + if ($target && $verbose) { print "file ${VTbold}$target${VTnorm} written into LXR root directory\n" } # Apache: mod_perl startup file $target = 'apache2-require.pl'; - unless (open(SOURCE, '<', "${tmpldir}/Apache/$target")) { - die("${VTred}ERROR:${VTnorm} couldn't open template file \"${tmpldir}/Apache/$target\"\n"); - } - $/ = undef; - $target_contents = <SOURCE>; - $/ = $oldsep; - close(SOURCE); - $target_contents =~ s/%LXRroot%/$rootdir/g; - unless (open(DEST, '>', "${confdir}/${target}")) { - die("${VTred}ERROR:${VTnorm} couldn't open output file \"${confdir}/$target\n"); - } - print DEST $target_contents; - close(DEST); - if ($verbose) { - print "file ${VTbold}$target${VTnorm} written into configuration directory\n" - } + copy_and_configure_template ( "${tmpldir}/Apache/$target" + , "${confdir}/${target}" + , $target + ); # Apache: LXR server configuration file $target = 'apache-lxrserver.conf'; - unless (open(SOURCE, '<', "${tmpldir}/Apache/$target")) { - die("${VTred}ERROR:${VTnorm} couldn't open template file \"${tmpldir}/Apache/$target\"\n"); - } - $/ = undef; - $target_contents = <SOURCE>; - $/ = $oldsep; - close(SOURCE); - $target_contents =~ s/%LXRroot%/$rootdir/g; - $target_contents =~ s/#=$cardinality=//g; - unless (open(DEST, '>', "${confdir}/${target}")) { - die("${VTred}ERROR:${VTnorm} couldn't open output file \"${confdir}/$target\n"); - } - print DEST $target_contents; - close(DEST); - if ($verbose) { - print "file ${VTbold}$target${VTnorm} written into configuration directory\n" - } + copy_and_configure_template ( "${tmpldir}/Apache/$target" + , "${confdir}/${target}" + , $target + ); # lighttpd: LXR server configuration file $target = 'lighttpd-lxrserver.conf'; - unless (open(SOURCE, '<', "${tmpldir}/lighttpd/$target")) { - die("${VTred}ERROR:${VTnorm} couldn't open template file \"${tmpldir}/lighttpd/$target\"\n"); - } - unless (open(DEST, '>', "${confdir}/${target}")) { - die("${VTred}ERROR:${VTnorm} couldn't open output file \"${confdir}/$target\"\n"); - } - # Expand initial part - expand_hash ( \*SOURCE - , \*DEST - , 'begin_virtroot' - , \%markers - , \%option_trans - , $verbose - ); - # Skip virtroot section template - while (<SOURCE>) { - last if m/^#\@end_virtroot/; - } - # Expand rest of model - expand_hash ( \*SOURCE - , \*DEST - , '~~~TO~EOF~~~' # Hope this is never used as a label! - , \%markers - , \%option_trans - , $verbose - ); - close(SOURCE); - close(DEST); - if ($verbose) { - print "file ${VTbold}$target${VTnorm} written into configuration directory\n" + copy_and_configure_template ( "${tmpldir}/lighttpd/$target" + , "${confdir}/${target}" + , $target + ); + + # Mercurial: extension and configuration file + if (-d "${tmpldir}/Mercurial") { + `cp ${tmpldir}/Mercurial/lxr-hg-ls.py ${confdir}/`; + $target = 'hg.rc'; + copy_and_configure_template ( "${tmpldir}/Mercurial/$target" + , "${confdir}/${target}" + ); + if ($verbose) { + print "${VTbold}Mercurial{VTnorm} support files written into configuration directory\n" + } } } ############################################################## @@ -792,35 +532,9 @@ print " Global section part\n"; print "\n"; } - - my $line; - - open(SOURCE, '<', "${tmpldir}/$lxrtmplconf") - or die("${VTred}ERROR:${VTnorm} couldn't open template file \"${tmpldir}/$lxrtmplconf\"\n"); - open(DEST, '>', "${confdir}/${confout}") - or die("${VTred}ERROR:${VTnorm} couldn't open output file \"${confdir}/$confout\"\n"); - - # Expand global section - expand_hash ( \*SOURCE - , \*DEST - , 'begin_tree' - , \%markers - , \%option_trans - , $verbose - ); - - # Skip tree section template - while (<SOURCE>) { - last if m/^#\@end_tree/; - } - - # Copy rest of model - while (<SOURCE>) { - print DEST; - } - - close(SOURCE); - close(DEST); + copy_and_configure_template ( "${tmpldir}/$lxrtmplconf" + , "${confdir}/${confout}" + ); } elsif ($dbenginechanged && !$nodbuser) { if ('n' eq get_user_choice ( 'Do you want to create the global DB user?' @@ -829,7 +543,7 @@ , [ 'y', 'n'] ) ) { - $option_trans{'createglobals'} = 0; + $markers{'%_createglobals%'} = 0; } } @@ -850,100 +564,33 @@ while (1) { # Start each iteration in default configuration - $option_trans{'add'} = $addtree; - $option_trans{'dbuseroverride'} = 0; + $markers{'%_add%'} = $addtree; + $markers{'%_dbuseroverride%'} = 0; delete $markers{'%DB_tree_user%'}; - delete $markers{'%DB_tree_password'}; + delete $markers{'%DB_tree_password%'}; delete $markers{'%DB_tbl_prefix%'}; unless (open(SOURCE, '<', "${tmpldir}/$lxrtmplconf")) { die("${VTred}ERROR:${VTnorm} couldn't open template file \"${tmpldir}/$lxrtmplconf\"\n"); } - unless (open(DEST, '+<', "${confdir}/${confout}")) { - die("${VTred}ERROR:${VTnorm} couldn't open output file \"${confdir}/$confout\"\n"); - } - - my $destpos = 0; - while (<DEST>) { - if (m/#\@here_tree\n/) { - last; - } - $destpos = tell; - } - my @deststat = stat(DEST); - if ($deststat[7] == $destpos) { - die("${VTred}ERROR:${VTnorm} couldn't find tree section before EOF in \"${confdir}/$lxrtmplconf\n"); - } - seek(DEST, $destpos, 0); # Position for write - $destpos = tell; - # Skip global section model - while (<SOURCE>) { - if (m/#\@begin_tree\n/) { - last; - } - } - - # Expand tree section - expand_hash ( \*SOURCE - , \*DEST - , 'end_tree' + pass2_hash ( \*SOURCE + , "${confdir}/${confout}" , \%markers - , \%option_trans , $verbose ); - # Copy rest of model - while (<SOURCE>) { - print DEST; - } - close(SOURCE); - close(DEST); # Update lighttpd configuration with the new 'virtroot' open(SOURCE, '<', "${tmpldir}/lighttpd/lighttpd-lxrserver.conf") or die("${VTred}ERROR:${VTnorm} couldn't open template file \"${tmpldir}/lighttpd/lighttpd-lxrserver.conf\"\n"); - open(DEST, '+<', "${confdir}/lighttpd-lxrserver.conf") - or die("${VTred}ERROR:${VTnorm} couldn't open configuration file \"${confdir}/lighttpd-lxrserver.conf\"\n"); - # Position output to variable section - my $destpos = 0; - while (<DEST>) { - if (m/#\@here_virtroot\n/) { - last; - } - $destpos = tell; - } - my @deststat = stat(DEST); - if ($deststat[7] == $destpos) { - die("${VTred}ERROR:${VTnorm} couldn't find 'virtroot' section before EOF in \"${confdir}/lighttpd-lxrserver.conf\n"); - } - seek(DEST, $destpos, 0); # Position for write - $destpos = tell; - # Skip fixed section model - while (<SOURCE>) { - if (m/#\@begin_virtroot\n/) { - last; - } - } - # Expand virtroot section of model - expand_hash ( \*SOURCE - , \*DEST - , 'end_virtroot' - , \%markers - , \%option_trans - , $verbose - ); - # Expand rest of model - expand_hash ( \*SOURCE - , \*DEST - , '~~~TO~EOF~~~' # Hope this is never used as a label! + pass2_hash ( \*SOURCE + , "${confdir}/lighttpd-lxrserver.conf" , \%markers - , \%option_trans , $verbose ); close(SOURCE); - close(DEST); # Have new DB user and password been defined? if (exists($markers{'%DB_tree_user%'})) { @@ -955,7 +602,7 @@ } } else { # Tell other templates something changed - $option_trans{'dbuseroverride'} = 1; + $markers{'%_dbuseroverride%'} = 1; $users{$markers{'%DB_tree_user%'}} = $markers{'%DB_tree_password'}; } } @@ -985,15 +632,13 @@ # This is why the 'shell' pseudo-option is created. # Of course, this statement would be better outside the loop, # but this comment would be far from expand_slash_star invocation. - $option_trans{'shell'} = 1; + $markers{'%_shell%'} = 1; # Expand script model - expand_slash_star ( \*SOURCE - , \*DEST - , '~~~TO~EOF~~~' # Hope this is never used as a label! - , \%markers - , \%option_trans - , $verbose - ); + expand_slash_star ( sub{ <SOURCE> } + , \*DEST + , \%markers + , $verbose + ); close(SOURCE); close(DEST); @@ -1012,7 +657,7 @@ } # Prevent doing one-time actions more than once $addtree = 1; # Same as adding a new tree - $option_trans{'createglobals'} = 0; + $markers{'%_createglobals%'} = 0; } ############################################################## Index: recreatedb.pl =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/recreatedb.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- recreatedb.pl 29 Sep 2012 20:30:46 -0000 1.4 +++ recreatedb.pl 11 Jan 2013 11:53:13 -0000 1.5 @@ -34,7 +34,8 @@ use LXR::Index; use LXR::Common; -use ExpandSlashStar; +use ContextMgr; +use LCLInterpreter; use QuestionAnswer; use VTescape; @@ -230,6 +231,7 @@ ############################################################## if ($verbose) { + $verbose = 2; # Force max verbosity in support routines print "${VTyellow}***${VTnorm} ${VTred}L${VTblue}X${VTgreen}R${VTnorm} DB initialisation reconstruction (version: $version) ${VTyellow}***${VTnorm}\n"; print "\n"; print "LXR root directory is ${VTbold}$rootdir${VTnorm}\n"; @@ -252,17 +254,6 @@ if ($verbose) { print "\n"; } - -my $cardinality; -my $dbengine; -my $dbenginechanged = 1; -my $dbpolicy; -my $dbname; -my $dbuser; -my $dbpass; -my $dbprefix; -my $nodbuser; -my $nodbprefix; my %users; # Cumulative list of all user/password # Flags for first use of DB engine my %dbengine_seen = @@ -279,91 +270,7 @@ # ############################################################## -# WARNING: remember to keep this number in sync with -# configure-lxr.pl. -my $context_version = 1; -my $manualreload = 0; - -if (my $c=open(SOURCE, '<', $lxrctx)) { - print "Initial context $lxrctx is reloaded\n" if $verbose; - $/ = undef; - my $context = <SOURCE>; - $/ = $oldsep; - close(SOURCE); - my $context_created; - eval($context); - if (!defined($context_created)) { - print "${VTred}ERROR:${VTnorm} saved context file probably damaged!\n"; - print "Check variable not found\n"; - print "Delete or rename file $lxrctx to remove lock.\n"; - exit 1; - } - if ($context_created != $context_version) { - print "${VTred}ERROR:${VTnorm} saved context file probably too old!\n"; - print "Recorded state version = $context_created while expecting version = $context_version\n"; - print "It is wise to 'quit' now and add manually the new tree or reconfigure from scratch.\n"; - print "You can however try to restore the initial context at your own risk.\n"; - print "\n"; - print "${VTyellow}WARNING:${VTnorm} inconsistent answers can lead to LXR malfunction.\n"; - print "\n"; - if ('q' eq get_user_choice - ( 'Do you want to quit or manually restore context?' - , 1 - , [ 'quit', 'restore' ] - , [ 'q', 'r' ] - ) ) { - exit 1; - } - $manualreload = 1; - }; - if ($dbpolicy eq 't') { - print "Your DB engine was: ${VTbold}" if $verbose; - if ("m" eq $dbengine) { - print "MySQL\n" if $verbose; - } elsif ("o" eq $dbengine) { - print "Oracle\n" if $verbose; - } elsif ("p" eq $dbengine) { - print "PostgreSQL\n" if $verbose; - } elsif ("s" eq $dbengine) { - print "SQLite\n" if $verbose; - } else { - print "???${VTnorm}\n" if $verbose; - print "${VTred}ERROR:${VTnorm} saved context file damaged or tampered with!\n"; - print "Unknown database code '$dbengine'\n"; - print "Delete or rename file $lxrctx to remove lock.\n"; - if ('q' eq get_user_choice - ( 'Do you want to quit or manually restore context?' - , 1 - , [ 'quit', 'restore' ] - , [ 'q', 'r' ] - ) ) { - exit 1; - } - $manualreload = 1; - }; - } -} else { - print "${VTyellow}WARNING:${VTnorm} could not reload context file ${VTbold}$lxrctx${VTnorm}!\n"; - print "You may have deleted the context file or you moved the configuration\n"; - print "file out of the ${VTbold}${confdir}${VTnorm} user-configuration directory without the\n"; - print "context companion file ${VTyellow}$lxrctx${VTnorm}.\n"; - print "\n"; - print "You can now 'quit' to think about the situation or try to restore\n"; - print "the parameters by answering the following questions\n"; - print "(some clues can be gathered from reading configuration file ${VTbold}$lxrconf${VTnorm}).\n"; - print "\n"; - print "${VTyellow}WARNING:${VTnorm} inconsistent answers can lead to LXR malfunction.\n"; - print "\n"; - if ('q' eq get_user_choice - ( 'Do you want to quit or manually restore context?' - , 1 - , [ 'quit', 'restore' ] - , [ 'q', 'r' ] - ) ) { - exit 1; - }; - $manualreload = 1; -} +my $manualreload = contextReload ($verbose, $lxrctx); if ($manualreload) { print "\n"; @@ -373,132 +280,9 @@ print "trees. Answer with the choices you made previously,\n"; print "otherwise your DB will not be what LXR expects.\n"; } - $dbengine = get_user_choice - ( 'Default database engine?' - , 1 - , [ 'mysql', 'oracle', 'postgres', 'sqlite' ] - , [ 'm', 'o', 'p', 's' ] - ); - - # Are we configuring for single tree or multiple trees? - $cardinality = get_user_choice - ( 'Configured for single/multiple trees?' - , 2 - , [ 's', 'm' ] - , [ 's', 'm' ] - ); - - if ($cardinality eq 's') { - if ('y' eq get_user_choice - ( 'Do you intend to add other trees later?' - , 2 - , [ 'yes', 'no' ] - , [ 'y', 'n'] - ) - ) { - $cardinality = 'm'; - print "${VTyellow}NOTE:${VTnorm} installation switched to ${VTbold}multiple${VTnorm} mode\n"; - print " but describe just a single tree.\n"; - } else { - $dbpolicy = 't'; - $nodbuser = 1; - $nodbprefix = 1; - } - } - - if ($cardinality eq 'm') { - if ('o' ne $dbengine) { - print "The safest option is to create one database per tree.\n"; - print "You can however create a single database for all your trees with a specific set of\n"; - print "tables for each tree (though this is not recommended).\n"; - $dbpolicy = get_user_choice - ( 'How did you setup the databases?' - , 1 - , [ 'per tree', 'global' ] - , [ 't', 'g' ] - ); - if ($dbpolicy eq 'g') { # Single global database - if ('s' eq $dbengine) { - $dbname = get_user_choice - ( 'Name of global SQLite database file? (e.g. /home/myself/SQL-databases/lxr' - , -2 - , [] - , [] - ); - } else { - $dbname = get_user_choice - ( 'Name of global da... [truncated message content] |
From: Andre-Littoz <ajl...@us...> - 2013-01-03 11:07:08
|
Update of /cvsroot/lxr/html/prototype/LxrConf In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10005/prototype/LxrConf Modified Files: lxrconfexclude.shtml lxrconfmaps.shtml lxrconftreeparms.shtml Log Message: Update for 1.1 features Index: lxrconfexclude.shtml =================================================================== RCS file: /cvsroot/lxr/html/prototype/LxrConf/lxrconfexclude.shtml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- lxrconfexclude.shtml 3 Nov 2012 21:07:08 -0000 1.2 +++ lxrconfexclude.shtml 3 Jan 2013 11:07:04 -0000 1.3 @@ -51,6 +51,34 @@ , 'ignoredirs' => [ 'CVSROOT', '.git' ] </pre> </div> + <ul class="version"> + <li class="classics">Release 1.1 and higher + <p class="normal"> +Should you need a finer-grained control on directory exclusion, +parameter <code>'filterdirs'</code> operates on the full LXR path +(rooted at <code>'virtroot'</code>): + </p> +<pre class="example"> +, 'filterdirs' => [ <em>regular_expressions</em> ] +</pre> + <p class="normal"> +By convention for this test, +directory paths begin with a separator (<code>/</code>) +and are <strong>NOT</strong> terminated by a separator. + </p> + <p class="normal"> +Regular expressions are used one after the other in the order +in which they are specified +until a match +(in which case the directory is excluded). + </p> + <p class="normal caution"> +Usage of this parameter is strongly discouraged because of the +processing time needed. +Read the User's Manual for further explanation and examples. + </p> + </li> + </ul> <h2><a name="excludeFiles">Files</a></h2> <p class="normal"> @@ -116,4 +144,32 @@ </p> </li> </ul> + <ul class="version"> + <li class="classics">Release 1.1 and higher + <p class="normal"> +Should you need a more precise screening rule, +parameter <code>'filterfiles'</code> operates on the full LXR path +(rooted at <code>'virtroot'</code>): + </p> +<pre class="example"> +, 'filterfiles' => [ <em>regular_expressions</em> ] +</pre> + <p class="normal"> +By convention for this test, +file paths begin with a separator (<code>/</code>). + </p> + <p class="normal"> +Regular expressions are used one after the other in the order +in which they are specified +until a match +(in which case the file is excluded). + </p> + <p class="normal caution"> +Usage of this parameter is also strongly discouraged because of the +processing time needed. +Read the User's Manual for further explanation and examples. + </p> + </li> + </ul> + <!--#include virtual="/backstore/footer.shtml" --> Index: lxrconfmaps.shtml =================================================================== RCS file: /cvsroot/lxr/html/prototype/LxrConf/lxrconfmaps.shtml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- lxrconfmaps.shtml 23 Sep 2012 16:48:10 -0000 1.4 +++ lxrconfmaps.shtml 3 Jan 2013 11:07:04 -0000 1.5 @@ -195,7 +195,8 @@ system of the open source world. To cope with sub-architecture variants needs more variable definitions and more <code>'incprefix'</code> and <code>'maps'</code> rules. -Configuring LXR for the kernel deserves a full chapter. +Configuring LXR for the kernel deserves a +<a href="/<!--#echo var="langPrefix" -->Tips/tipkernel.shtml" title="Linux kernel include configuration">full chapter</a>. </p> </div> </div> Index: lxrconftreeparms.shtml =================================================================== RCS file: /cvsroot/lxr/html/prototype/LxrConf/lxrconftreeparms.shtml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- lxrconftreeparms.shtml 3 Nov 2012 21:07:08 -0000 1.6 +++ lxrconftreeparms.shtml 3 Jan 2013 11:07:04 -0000 1.7 @@ -44,6 +44,9 @@ , 'sourceaccess' => <em>HTML_access_to_source_tree</em> # 0.10+ , 'ignoredirs' => [ <em>list_of_directories_to_ignore</em> ] +, 'filterdirs' => [ <em>list_of_regexps_for_directories</em> ] # 1.1+ +, 'ignorefiles'=> <em>regexp</em> # 1.1+ +, 'filterfiles'=> [ <em>list_of_regexps_for_files</em> ] # 1.1+ , 'incprefix' => [ <em>list_of_include_directories</em> ] , 'maps' => { <em>rules_for_path_transformation</em> } # -0.11 (see note below) , 'maps' => [ <em>rules_for_path_transformation</em> ] # 1.0+ @@ -75,5 +78,32 @@ Perl-type of <code>'maps'</code> parameter changed in release 1.0 to allow a controlled application order of the rules. </p> + <p>Deprecation notes:</p> + <ul> + <li class="normal"><code>'baseurl'</code> and <code>'baseurl_aliases'</code> + <p class="normal"> +<code>'baseurl_aliases'</code> are error-prone +because they require exact partial duplication from <code>'baseurl'</code>. +Moreover, both require to copy <code>'virtroot'</code>. + </p> + <p> +<code>'host_names'</code> and <code>'virtroot'</code> must be preferred +because they separate the host names list from the virtual root, +removing redundancies and possible typing errors. + </p> + </li> + <li class="normal"><code>'glimpsedir'</code> and <code>'swishdir'</code> + <p class="normal"> +If you define <code>'glimpsedirbase'</code> and/or <code>'swishdirbase'</code> +in the global section, +these tree-parameters are automatically generated as +<em>value(</em><code>'glimpsedirbase'</code><em>)/value(</em><code>'virtroot'</code><em>)</em>. + </p> + <p class="normal"> +Of course, as usual, explicitly coding <code>'glimpsedir'</code> +and/or <code>'swishdir'</code> in a tree section overrides the default automatic behaviour. + </p> + </li> + </ul> <!--#include virtual="/backstore/footer.shtml" --> |
From: Andre-Littoz <ajl...@us...> - 2013-01-03 11:07:07
|
Update of /cvsroot/lxr/html/en/1-0-InstallSteps In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10005/en/1-0-InstallSteps Modified Files: 1-0-install3config.shtml Log Message: Update for 1.1 features Index: 1-0-install3config.shtml =================================================================== RCS file: /cvsroot/lxr/html/en/1-0-InstallSteps/1-0-install3config.shtml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- 1-0-install3config.shtml 24 Nov 2012 13:23:14 -0000 1.6 +++ 1-0-install3config.shtml 3 Jan 2013 11:07:03 -0000 1.7 @@ -52,7 +52,7 @@ <li>Create both LXR and database configurations with script <code>configure-lxr.pl</code> <pre class="shell"> -<samp>$ </samp><kbd>./scripts/configure-lxr.pl -v</kbd> +<samp>$ </samp><kbd>./scripts/configure-lxr.pl -vv</kbd> </pre> <p class="comment"> This launches the configuration script with default options, |
From: Andre-Littoz <ajl...@us...> - 2012-12-07 12:27:39
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29670 Modified Files: genxref Log Message: genxref: improve initial environment tests Index: genxref =================================================================== RCS file: /cvsroot/lxr/lxr/genxref,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- genxref 4 Dec 2012 13:47:13 -0000 1.65 +++ genxref 7 Dec 2012 12:27:35 -0000 1.66 @@ -239,6 +239,9 @@ check_tool('glimpseindex', 'glimpseindex', '-V', '0'); $foundswishe = check_tool('swishbin', 'swish-e', '-V', '2.1'); +# The following verifications are a bit "over-kill" +# because there is presently no check on version level +# on glimpse. But that could change in the future. if ($foundglimpse == 0 && $foundswishe == 0) { # No engine defined - propose to go on without print "${VTyellow}Neither 'glimpsebin' nor 'swishbin' defined${VTnorm}\n"; @@ -255,7 +258,18 @@ } elsif ($foundglimpse <= 0 && $foundswishe <= 0) { # Can't use any search engine # (either not found or version too low) - $failure |= 1 + # But check if user disabled free-text search with suggested tip + if ( $foundglimpse < 0 # true has no version + && $config->{'glimpsebin'} =~ m:(^|/)true$: + && $foundswishe == 0 + || $foundswishe < 0 + && $config->{'swishbin'} =~ m:(^|/)true$: + && $foundglimpse == 0 + ) { + # Leave $failure "as is" when user disables search + } else { + $failure |= 1 + } } elsif ($foundglimpse == 1 && $foundswishe <= 1) { # glimpse has been forced, but glimpse is prefered if both print "${VTyellow}Warning:${VTnorm} using existing ${VTbold}glimpse${VTnorm}\n"; @@ -446,7 +460,7 @@ cleanindex($version); } if ($files->isa("LXR::Files::Plain")) { - if ($foundglimpse || $foundswishe) { + if ($foundglimpse > 0 || $foundswishe > 0) { gensearch($version); } else { print STDERR "${VTyellow}Free-text search disabled${VTnorm}\n"; |
From: Andre-Littoz <ajl...@us...> - 2012-12-04 17:42:33
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23321/scripts Modified Files: QuestionAnswer.pm Log Message: scripts/QuestionAnswer.pm: make question more easily visible Add blinking > at end of question Index: QuestionAnswer.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/QuestionAnswer.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- QuestionAnswer.pm 22 Sep 2012 08:50:33 -0000 1.1 +++ QuestionAnswer.pm 4 Dec 2012 17:42:27 -0000 1.2 @@ -117,7 +117,7 @@ if (defined($choices) && @$choices) { print " [${VTyellow}", join("${VTnorm}/${VTyellow}", @$choices), "${VTnorm}]"; } - print " "; + print " ${VTslow}${VTyellow}>${VTnorm} "; my $userentry = <STDIN>; chomp($userentry); # See if user just hit "return"; if this is valid, give |
From: Andre-Littoz <ajl...@us...> - 2012-12-04 13:47:16
|
Update of /cvsroot/lxr/lxr In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9515 Modified Files: genxref Log Message: genxref: improve initial environment tests Index: genxref =================================================================== RCS file: /cvsroot/lxr/lxr/genxref,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- genxref 21 Nov 2012 13:33:45 -0000 1.64 +++ genxref 4 Dec 2012 13:47:13 -0000 1.65 @@ -44,10 +44,11 @@ , "help!" , "url=s" , "version=s" - , "allurls!" + , "allurls" , "allversions:s" - , "reindexall!" - , "checkonly!" + , "reindexall" + , "checkonly" + , "accept" ); if ($option{'help'}) { @@ -58,10 +59,10 @@ The genxref program automatically generates LXR database cross-reference tokens for a set of URL configuration blocks and source code versions. These -are both defined in the lxr.conf configuration file. Each "URL" is a separate +are both defined in the $lxrconf configuration file. Each "URL" is a separate source tree; LXR separates and identifies these by their URL. Each "version" is -a different version of the source tree being indexed. See lxr.conf or -lxr.conf.template for configuring URLs and versions. +a different version of the source tree being indexed. See file $lxrconf or +script configure-lxr.pl for configuring URLs and versions. Valid options are: --help Print a summary of the options. @@ -71,6 +72,7 @@ --allversions Generate tokens for all versions of the code (default). --reindexall Purges existing index data --checkonly Verify tools version and stop + --accept Accept parameter suggestions to continue with indexing Report bugs at http://sourceforge.net/projects/lxr/. END_HELP @@ -79,10 +81,6 @@ my $failure = 0; # Cumulative failure indicator -# TODO: implement --allurls -# die("${VTred}Option --allurls not implemented.${VTnorm} Use --url instead.\n") -# if $option{'allurls'}; - if ( !$option{'checkonly'} && !$option{'url'} && !$option{'allurls'} @@ -117,7 +115,7 @@ } else { print "${VTred}ERROR:${VTnorm} could not open configuration file ${VTred}$lxrconf${VTnorm}\n"; exit(1) unless $option{'checkonly'}; - $failure = 1; + $failure |= 1; } @@ -134,30 +132,39 @@ print VTCUU(1), "${VTgreen}[ OK ]${VTnorm}\n"; } else { print VTCUU(1), "${VTred}[${VTslow}FAILED${VTnorm}${VTred}]${VTnorm}\n"; - $failure = 1; + $failure |= 1; } # Check tools version # Return value: -# . -1. OK but conf parm set -# . 0 everything fine -# . 1 software tool not found -# . 2 version too low +# . -2. version too low for forced parm (see 1) +# . -1 version too low +# . 0 software tool not found +# . 1 OK but conf parm set +# . 2 everything fine sub check_tool { my ($tl_param, $tl_name, $tl_option, $tl_version) = @_; my $tool; my $toolloc; - my $toolforced; + my $toolforced = 0; my $version; if ($config && $config->{$tl_param}) { $tool = $config->{$tl_param}; - $toolloc = `command -v $tl_name 2>/dev/null`; - $toolloc =~ s/\n$//s; - if ($tool ne $toolloc) { - print "${VTyellow}'$tl_param' not equal to `command -v $tl_name`${VTnorm}\n"; - print "If this is a non-system copy, ignore this warning\n"; + # Make further tests on designated tool + $toolloc = `command -v $tool 2>/dev/null`; + if ($toolloc !~ s/\n$//s) { + print "${VTred}'$tl_param' does not name an existing $tl_name utility${VTnorm}\n"; + delete $config->{$tl_param}; + } else { + my $systoolloc = `command -v $tl_name 2>/dev/null`; + if ($systoolloc =~ s/\n$//s) { + if ($systoolloc ne $toolloc) { + print "${VTyellow}'$tl_param' not equal to `command -v $tl_name`${VTnorm}\n"; + print "If this is a non-system copy, ignore this warning\n"; + } + } } } else { print("${VTyellow}Parameter '$tl_param' not defined - trying to find $tl_name${VTnorm}\n"); @@ -168,15 +175,18 @@ } if (!$toolloc) { print "${VTred}$tl_name not found,${VTnorm} `command -v $tl_name` returned a null string\n"; - return 1; + if ($config) { + delete $config->{$tl_param}; + } + return 0; } if ($config) { if (!$config->{$tl_param}) { $config->{$tl_param} = $toolloc; - $toolforced = -1; + $toolforced = 1; $tool = $toolloc; print "$tl_name found at ${VTyellow}$toolloc${VTnorm}\n"; - print "Manually update lxr.conf for permanent setting if needed\n"; + print "Manually update $lxrconf for permanent setting if needed\n"; } } else { print "$tl_name found at ${VTyellow}$toolloc${VTnorm}\n"; @@ -200,57 +210,77 @@ ) { print VTCUU(1), "${VTred}[${VTslow}FAILED${VTnorm}${VTred}]${VTnorm}\n"; print "$tl_name version $tl_version or above required, found $version\n"; - return 2; + return -1 - $toolforced; } else { print VTCUU(1), "${VTgreen}[ OK ]${VTnorm}\n"; } } else { print VTCUU(1), "${VTyellow}Checked:${VTnorm}\n"; } - return $toolforced // 0; + return 2 -$toolforced; } my $foundglimpse = 0; my $foundswishe = 0; my $ct = check_tool('ectagsbin', 'ctags', '--version', '5'); -if ($ct > 0) { - if ($ct == 1) { - print "genxref can't index source-tree without ctags\n"; - print "Find its location or install it and fix 'ectagsbin'\n"; - } - $failure = 1; -} -$ct = check_tool('glimpsebin', 'glimpse', '-V', '0'); -if ($ct <= 0) { - $foundglimpse = 2 * $ct + 1; -} -check_tool('glimpseindex', 'glimpseindex', '-V', '0'); -$ct = check_tool('swishbin', 'swish-e', '-V', '2.1'); -if ($ct <= 0) { - $foundswishe = 2 * $ct + 1; +if ($ct == 0) { + print "genxref can't index source-tree without ctags\n"; + print "Find its location or install it and fix 'ectagsbin'\n"; + $failure |= 1; +} elsif ($ct == 1) { + print "ctags fixed for genxref, but LXR browsing will not work\n"; + $failure |= 2; +} elsif ($ct < 0) { + $failure |= 1; } -if ( $foundglimpse == 1 - && $foundswishe == 1 - ) { - print "${VTred}Both 'glimpsebin' and 'swishbin' defined${VTnorm}\n"; - print "Choose one of them by commenting the other in lxr.conf\n"; - $failure = 1; -} +$foundglimpse = check_tool('glimpsebin', 'glimpse', '-V', '0'); +check_tool('glimpseindex', 'glimpseindex', '-V', '0'); +$foundswishe = check_tool('swishbin', 'swish-e', '-V', '2.1'); -if ( $foundglimpse == -1 - && $foundswishe == -1 - ) { +if ($foundglimpse == 0 && $foundswishe == 0) { + # No engine defined - propose to go on without print "${VTyellow}Neither 'glimpsebin' nor 'swishbin' defined${VTnorm}\n"; - if ($foundglimpse) { - print "Using existing ${VTyellow}glimpse${VTnorm}\n"; - print "If you prefer swish-e, configure lxr.conf\n"; - } elsif ($foundswishe){ - print "Using existing ${VTyellow}swish-e${VTnorm}\n"; - print "If you prefer glimpse, configure lxr.conf\n"; - } else { - print "${VTyellow}None found in the system - Free-text search disabled${VTnorm}\n"; + print "${VTyellow}Disabling free-text search${VTnorm}\n"; + if ($config) { + $config->{'glimpsebin'} = '/usr/bin/true'; + } + $failure |= 2; +} elsif ($foundglimpse == 2 && $foundswishe == 2) { + # Both engines defined - do not know what to do + print "${VTred}Both 'glimpsebin' and 'swishbin' defined${VTnorm}\n"; + print "Choose one of them by commenting the other in $lxrconf\n"; + $failure |= 1; +} elsif ($foundglimpse <= 0 && $foundswishe <= 0) { + # Can't use any search engine + # (either not found or version too low) + $failure |= 1 +} elsif ($foundglimpse == 1 && $foundswishe <= 1) { + # glimpse has been forced, but glimpse is prefered if both + print "${VTyellow}Warning:${VTnorm} using existing ${VTbold}glimpse${VTnorm}\n"; + delete $config->{'swishbin'} if ($config); + $failure |= 2; +} elsif ($foundswishe == 1 && $foundglimpse <= 0) { + # swish-e has been forced, but glimpse is prefered if both + print "${VTyellow}Warning:${VTnorm} using existing ${VTbold}swish-e${VTnorm}\n"; + delete $config->{'glimpsebin'} if ($config); + $failure |= 2; +} elsif ($foundglimpse == 2) { + # Standard glimpse selection, but for the case of both + # engines present and swish-e has too low a version + if ($foundswishe == -1) { + print "${VTyellow}Warning:${VTnorm} forcing use of ${VTbold}glimpse${VTnorm}\n"; + delete $config->{'swishbin'} if ($config); + $failure |= 2; + } +} elsif ($foundswishe == 2) { + # Standard swish-e selection, but for the case of both + # engines present and glimpse has too low a version + if ($foundglimpse == -1) { + print "${VTyellow}Warning:${VTnorm} forcing use of ${VTbold}swish-e${VTnorm}\n"; + delete $config->{'glimpsebin'} if ($config); + $failure |= 2; } } @@ -259,6 +289,17 @@ print "${VTyellow}genxref stopped without indexing by --checkonly option${VTnorm}\n"; exit; } +if ($failure > 1) { + if ($option{'accept'}) { + print "\nParameter changes accepted by option --accept without writing them in $lxrconf\n"; + print "Indexing may eventually complete but expect malfunction in LXR browsing\n"; + print "till you fix configuration file $lxrconf\n\n"; + $failure = 0; + } else { + print "\ngenxref suggested changes to your configuration\n"; + print "You can test their effect with option ${VTyellow}--accept${VTnorm}\n"; + } +} if ($failure > 0) { die "${VTred}Aborting due to previous errors${VTnorm}"; } @@ -339,9 +380,9 @@ $autoversionflag = 1; } else { @versions = $config->varrange('v'); - die - "${VTred}Option --allversions cannot be used because no versions found automatically.${VTnorm} Use --version=VERSION or fix lxr.conf.\n" - if scalar @versions <= 0; + die "${VTred}Option --allversions cannot be used because no versions found automatically.${VTnorm}" + . "Use --version=VERSION or fix $lxrconf.\n" + if scalar @versions <= 0; } } else { @versions = $option{'version'}; |
From: Andre-Littoz <ajl...@us...> - 2012-12-01 15:03:22
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17645/lib/LXR Modified Files: Index.pm Log Message: Index.pm: failsafe "die" for bad cache initialisation Added "die" statements in case symbol cache not properly initialized in setdymdeclaration and setsymreference. Should never fire since the symbols are supposed to have already been seen. This is only for debugging. Lines could be withdrawn once it is proven caching code is always correct. Index: Index.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Index.pm 14 Nov 2012 11:27:30 -0000 1.22 +++ Index.pm 1 Dec 2012 15:03:19 -0000 1.23 @@ -921,8 +921,8 @@ $cntcache{$relsym} += 1; } } -die "Symbol cache not initialised for $symname\n" if (!defined($symcache{$symname})); -die "Symbol cache not initialised for $relsym\n" +die "Symbol cache not initialised for sym $symname\n" if (!defined($symcache{$symname})); +die "Symbol cache not initialised for rel $relsym\n" if (defined($relsym) && !defined($symcache{$relsym})); } |
From: Andre-Littoz <ajl...@us...> - 2012-12-01 14:47:18
|
Update of /cvsroot/lxr/lxr/lib/LXR/Files In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16438/lib/LXR/Files Modified Files: CVS.pm Log Message: CVS.pm: avoid double / in paths Index: CVS.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Files/CVS.pm,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- CVS.pm 14 Nov 2012 10:44:20 -0000 1.45 +++ CVS.pm 1 Dec 2012 14:47:14 -0000 1.46 @@ -48,7 +48,7 @@ $self = bless({}, $self); $self->{'rootpath'} = $rootpath; - $self->{'rootpath'} =~ s@/*$@/@; + $self->{'rootpath'} =~ s@/*$@@; $self->{'path'} = $config->{'cvspath'}; unless (defined $gnu_diff) { |
From: Malcolm B. <mb...@us...> - 2010-01-15 23:23:30
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv26224/lib/LXR Modified Files: Common.pm Log Message: Fix XSS exploit in title string Index: Common.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Common.pm,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- Common.pm 5 Jan 2010 17:59:38 -0000 1.63 +++ Common.pm 15 Jan 2010 23:23:20 -0000 1.64 @@ -633,6 +633,8 @@ return $config->sourcerootname . ' identifier search' . ($i ? ": $i" : ''); } elsif ($who eq 'search') { my $s = $HTTP->{'param'}->{'string'}; + $s =~ s/</</g; + $s =~ s/>/>/g; return $config->sourcerootname . ' general search' . ($s ? ": $s" : ''); } } |
From: Malcolm B. <mb...@us...> - 2010-01-05 21:58:36
|
Update of /cvsroot/lxr/lxr-tools In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11528 Modified Files: makerelease.pl Log Message: Update with new SF release system Index: makerelease.pl =================================================================== RCS file: /cvsroot/lxr/lxr-tools/makerelease.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- makerelease.pl 22 Apr 2009 15:38:35 -0000 1.3 +++ makerelease.pl 5 Jan 2010 21:58:26 -0000 1.4 @@ -51,7 +51,7 @@ --noex Do not do any action that alters SF state (useful for seeing what will happen) --tag Use the supplied string as the release tag name - --nottext Do not run the tests from lxr-tools + --notest Do not run the tests from lxr-tools END_HELP @@ -312,7 +312,7 @@ print "Uploading to SF..."; chdir(".."); - my $cmd = "rsync -a -e ssh lxr-$version.tgz ".'mb...@fr...:uploads/'; + my $cmd = "rsync -a -e ssh lxr-$version.tgz ".'mbox,lx...@fr...:/home/frs/project/l/lx/lxr/development/lxr-'.$version.'/'; print "[Not executing]" if $NO; print " $cmd\n"; |
From: Malcolm B. <mb...@us...> - 2010-01-05 18:01:08
|
Update of /cvsroot/lxr/lxr In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9463 Modified Files: ident search Log Message: Fix for CVE-2009-4497 from Dan Rosenberg Avoid a XSS vulnerability Index: ident =================================================================== RCS file: /cvsroot/lxr/lxr/ident,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ident 10 May 2009 11:54:29 -0000 1.24 +++ ident 5 Jan 2010 18:00:58 -0000 1.25 @@ -1,4 +1,4 @@ -#!perl -T +#!/usr/bin/perl -T # $Id$ # ident -- Look up identifiers @@ -49,7 +49,7 @@ my $templ = shift; my $ret = ''; - my @refs = $index->symdeclarations($identifier, $releaseid); + my @refs = $index->getindex($identifier, $release); my $file_hits = 0; my $last_file; @@ -86,7 +86,7 @@ my $templ = shift; my $ret = ''; - my @uses = $index->symreferences($identifier, $releaseid); + my @uses = $index->getreference($identifier, $release); my $file_hits = 0; my $last_file; foreach my $ref (sort { $$a[0] cmp $$b[0] } @uses) { @@ -146,8 +146,8 @@ $templ, ( variables => \&varinputs, - identifier => sub { return $identifier }, - identifier_escaped => sub { $_ = $identifier; s/\"/"/g; return $_; }, + identifier => sub { $_ = $identifier; s/</</g; s/>/>/g; return $_; }, + identifier_escaped => sub { $_ = $identifier; s/\"/"/g; s/</</g; s/>/>/g; return $_; }, refs => sub { refexpand(@_) }, ) ) Index: search =================================================================== RCS file: /cvsroot/lxr/lxr/search,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- search 10 May 2009 11:54:29 -0000 1.33 +++ search 5 Jan 2010 18:00:58 -0000 1.34 @@ -288,8 +288,8 @@ $templ, ( variables => sub { varinputs(@_) }, - searchtext => sub { return $searchtext }, - searchtext_escaped => sub { $_ = $searchtext; s/\"/"/g; return $_; }, + searchtext => sub { $_ = $searchtext; s/</</g; s/>/>/g; return $_; }, + searchtext_escaped => sub { $_ = $searchtext; s/\"/"/g; s/</</g; s/>/>/g; return $_; }, filetext_escaped => sub { $_ = $filetext; s/\"/"/g; return $_; }, advancedchecked => sub { return $advanced ? "checked" : "" }, casesensitivechecked => sub { return $casesensitive ? "checked" : "" }, |
From: Malcolm B. <mb...@us...> - 2010-01-05 17:59:47
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9367/lib/LXR Modified Files: Common.pm Log Message: Fix bug in clean_identifier It wasn't cleaning the identifier properly, leaving a security hole Index: Common.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Common.pm,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- Common.pm 10 May 2009 11:54:29 -0000 1.62 +++ Common.pm 5 Jan 2010 17:59:38 -0000 1.63 @@ -526,9 +526,13 @@ } sub clean_identifier { + # Cleans up the identifier parameter + # Result should be HTML-safe and a valid identifier in + # any supported language... + # Well, not Lisp symbols since they can contain anything my $id = shift; - $id =~ s/(^[\w`:.,]+).*/$1/ if defined $id; + $id =~ s/[^\w`:.,\-_ ]//g if defined $id; return $id; } |
From: Malcolm B. <mb...@us...> - 2010-01-05 17:58:38
|
Update of /cvsroot/lxr/lxr-tools/tests In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9175 Modified Files: SecurityTest.pm Log Message: Add tests for problem with clean_identifier Index: SecurityTest.pm =================================================================== RCS file: /cvsroot/lxr/lxr-tools/tests/SecurityTest.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SecurityTest.pm 10 May 2009 11:54:33 -0000 1.2 +++ SecurityTest.pm 5 Jan 2010 17:58:27 -0000 1.3 @@ -102,6 +102,20 @@ } +sub test_clean_identifier { + # Test that LXR::Common::clean_identifier does a good job + my $self = shift; + my @good_ids = ("i", "warning", "malcolm.box", "g`b", "aZX091-12-12", "ax_box", "AaX09-_.:`"); + my %bad_ids = ( "<script>", "script"); + my $i; + foreach $i (@good_ids) { + $self->assert($i eq LXR::Common::clean_identifier($i), "clean_identifier changed $i"); + } + foreach $i (keys(%bad_ids)) { + $self->assert($bad_ids{$i} eq LXR::Common::clean_identifier($i), "clean_identifier didn't clean $i") + } +} + sub test_filename_wash { # Check that filenames are washed my $self = shift; |