lxr-general Mailing List for LXR Cross Referencer (Page 4)
Brought to you by:
ajlittoz
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
(1) |
Sep
(6) |
Oct
|
Nov
(13) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(8) |
Feb
(4) |
Mar
(6) |
Apr
(5) |
May
(5) |
Jun
(4) |
Jul
(8) |
Aug
(3) |
Sep
(6) |
Oct
(7) |
Nov
(7) |
Dec
(10) |
2003 |
Jan
(9) |
Feb
(4) |
Mar
(8) |
Apr
(12) |
May
(13) |
Jun
(9) |
Jul
(13) |
Aug
(10) |
Sep
(3) |
Oct
(3) |
Nov
(19) |
Dec
(14) |
2004 |
Jan
(11) |
Feb
(10) |
Mar
(7) |
Apr
(5) |
May
(4) |
Jun
(4) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
(6) |
Dec
(6) |
2005 |
Jan
(11) |
Feb
(1) |
Mar
(6) |
Apr
(4) |
May
(7) |
Jun
(13) |
Jul
(9) |
Aug
(32) |
Sep
(27) |
Oct
(31) |
Nov
(17) |
Dec
(24) |
2006 |
Jan
(19) |
Feb
(25) |
Mar
(30) |
Apr
(28) |
May
(35) |
Jun
(38) |
Jul
(21) |
Aug
(31) |
Sep
(38) |
Oct
(68) |
Nov
(84) |
Dec
(83) |
2007 |
Jan
(45) |
Feb
(78) |
Mar
(72) |
Apr
(67) |
May
(51) |
Jun
(49) |
Jul
(125) |
Aug
(113) |
Sep
(74) |
Oct
(59) |
Nov
(63) |
Dec
(55) |
2008 |
Jan
(58) |
Feb
(53) |
Mar
(56) |
Apr
(224) |
May
(282) |
Jun
(269) |
Jul
(354) |
Aug
(552) |
Sep
(277) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(8) |
Dec
|
2010 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(6) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael O. <mic...@fr...> - 2007-05-13 08:16:31
|
Shahbaz Khan wrote: > I have switched from version 0.3 to version 0.9.5 after a continuous > failure in configuration. > > Currently, after all configurations I do http://localhost/source, it > dumps the source.pl script from lxr directory as text! I cannot not > figure out how to run the various tests that come with lxr. > Did you read the INSTALL file carefully enough? I found it sufficient to install lxr-0.9.5. Your problem happens when the Apache server doesn't run perl to execute the perl script, but dumps the script instead. Make sure followed all instructions. > In the lxr.conf do I need to set username, password if I use initdb_mysql? > I also checked my /etc/passwd and did not find any lxr user so is this > user local to mysql server? > Did you read the comments in templates/lxr.conf? # 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> # for Oracle, it is dbi:Oracle:host=localhost;sid=DEVMMS;port=1521 'dbname' => 'dbi:mysql:dbname=lxr', # If you need to specify the username or password for the database connection, # uncomment the following two lines # 'dbpass' => 'foo', # 'dbuser' => 'lxr', > lxr database in mysql has not been populated even after generating the > indexes and genxref command. > > I wish if someone could write a decent howto or guide on such a useful > tool so that it becomes useful for newbies like me! > Take your time to read the instruction files and even the source files... This is always helpful at the end. My advise: you should first solve your Apache / Perl issue. Good luck! Michael. -- Michael Opdenacker, Free Electrons Free Embedded Linux Training Materials on http://free-electrons.com/training (More than 1500 pages!) |
From: Shahbaz K. <sha...@gm...> - 2007-05-12 15:33:02
|
I have switched from version 0.3 to version 0.9.5 after a continuous failure in configuration. Currently, after all configurations I do http://localhost/source, it dumps the source.pl script from lxr directory as text! I cannot not figure out how to run the various tests that come with lxr. In the lxr.conf do I need to set username, password if I use initdb_mysql? I also checked my /etc/passwd and did not find any lxr user so is this user local to mysql server? lxr database in mysql has not been populated even after generating the indexes and genxref command. I wish if someone could write a decent howto or guide on such a useful tool so that it becomes useful for newbies like me! |
From: Jan-Benedict G. <jb...@lu...> - 2007-05-10 15:52:45
|
On Thu, 2007-05-10 06:53:43 +0500, Shahbaz Khan <sha...@gm...> wrot= e: > 1- I am using lxr 0.3 because of its simplicity but I may give a try > to 0.9.5 if anybody can help me out with each required step. Following > findings are with 0.3 version. The 0.3 version is more or less totally obsolete. > 2- I am not using any CVS. I don't know what SCM is, which might mean > I am using plain files. You need to really go into deep details here. You're using LXR, so I guess there's some kind of source tree you want to be presented by a web server. So lets start there. Is it *one* version of sources, or more than one version? In either case, where is it located? Did you simply untar one (or more) tarballs of released sources? > 3- Apache has no errors. The source code is shown is a directory > listing. Thus no hyperlinks (cross refferences) are shown. What is "a directory listing" in terms of content? Do you have a screen shot? For what it's worth, it makes a lot of sense to also place a simple index.html file into the LXR directory that points to the "source" binary. This is what actually "makes up" the sources and inserts hyperlinks et al. > 5- The indices are generated and there was no problem. "no problem" can be described as there's a reasonable amount of data in some database? > 6- I am not able to comprehend the version file and $v, and the > defversion. So these settings might be bad! But I have been doing > quite some trial and error with some of them. "$v" lists all versions of your source releases you want to present. For the Linux kernel, things like "v0.01 v2.6.0 v2.6.20" might make sense. Of course there might only be one single version. defversion is the initially selected version (choosen whenever a visitor accesses the site for the first time and didn't choose an alternate version.) > The current state is that all I see is the directory listing. If the directory listing contains a "source" entry, please click on it. MfG, JBG --=20 Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: God put me on earth to accomplish a certain numbe= r of the second : things. Right now I am so far behind I will never = die. |
From: Shahbaz K. <sha...@gm...> - 2007-05-10 01:53:45
|
Following is how things are for me with lxr: 1- I am using lxr 0.3 because of its simplicity but I may give a try to 0.9.5 if anybody can help me out with each required step. Following findings are with 0.3 version. 2- I am not using any CVS. I don't know what SCM is, which might mean I am using plain files. 3- Apache has no errors. The source code is shown is a directory listing. Thus no hyperlinks (cross refferences) are shown. 4- I have gone through multiple lxr.conf files available on the internet and a debian readme which was a good explaination. I use /var/www/lxr as my install prefix thus skipping the alias thingy. The .htaccess is working and so is the access.conf. 5- The indices are generated and there was no problem. 6- I am not able to comprehend the version file and $v, and the defversion. So these settings might be bad! But I have been doing quite some trial and error with some of them. 7- I am using linux kernel 0.1 as the source code and the code is there. I have yet to download sources for kernel 2.6.18 for my fc 6. The current state is that all I see is the directory listing. Thank You. On 5/10/07, Maximilian Wilhelm <ma...@rf...> wrote: > Am Thursday, den 10 May hub Shahbaz Khan folgendes in die Tasten: > > Hi! > > Please answer to the list, so everybody can see the problems and can > help. There may (will) be others who are deeper in LXR as I might be. > > > First of all my I cannot comprehend the version and defversion part. > > Sorry? > > > Is it necessary at all? Apache is showing the sources but there are no > > hyperlinks as it should have been! > > What do you mean with 'showing the sources'? > Is apache serving a directory listing? > Can you look into your files and see the source in there? > > > Can you send me your configurations with a little bit of explanation > > on each step while installation. > > The config file depends on many decisions you made (DB, search-tool) > whatever. > > > > Maybe its too much that I ask but am too stressed out with going over > > and over with the installlation. > > I have fedora core 6. I prefer the lxr 0.3 because of its simplicity > > but you are the expert. If u need to look at my current lxr.conf let > > me know. > > Please provide us > * the version of LXR you are running (current CVS HEAD would be > appreciated) > * Your lxr.conf > * Messages/Errors from your apache errors.log > * What is running, what=B4s broken > * What SCM do you use? Or Plain files? > * What have you done so far to trace the problem(s)? > > Ciao > Max > -- > Follow the white penguin. > |
From: Maximilian W. <ma...@rf...> - 2007-05-10 00:11:38
|
Am Thursday, den 10 May hub Shahbaz Khan folgendes in die Tasten: Hi! Please answer to the list, so everybody can see the problems and can help. There may (will) be others who are deeper in LXR as I might be. > First of all my I cannot comprehend the version and defversion part. Sorry? > Is it necessary at all? Apache is showing the sources but there are no > hyperlinks as it should have been! What do you mean with 'showing the sources'? Is apache serving a directory listing? Can you look into your files and see the source in there? > Can you send me your configurations with a little bit of explanation > on each step while installation. The config file depends on many decisions you made (DB, search-tool) whatever. > Maybe its too much that I ask but am too stressed out with going over > and over with the installlation. > I have fedora core 6. I prefer the lxr 0.3 because of its simplicity > but you are the expert. If u need to look at my current lxr.conf let > me know. Please provide us * the version of LXR you are running (current CVS HEAD would be appreciated) * Your lxr.conf * Messages/Errors from your apache errors.log * What is running, what´s broken * What SCM do you use? Or Plain files? * What have you done so far to trace the problem(s)? Ciao Max -- Follow the white penguin. |
From: Maximilian W. <ma...@rf...> - 2007-05-09 21:44:00
|
Am Wednesday, den 9 May hub Maximilian Wilhelm folgendes in die Tasten: Hi! > > Its been a like two weeks that I have been trying to work out the LXR > > installation and configuration. I am not yet successul. > > Can anyone suggest a substitute cross refferencing tool as good as LXR > > because I have deadlines. > Why did you not ask earlier? > Maybe one could have give you some hints. > So to come back to the topic of this list: > What are your problems? To get this more precise as my statement might be mistakable: Which parts of the installation are problematic? What does work, what does fail? Ciao Max -- Follow the white penguin. |
From: Maximilian W. <ma...@rf...> - 2007-05-09 21:39:03
|
Am Thursday, den 10 May hub Shahbaz Khan folgendes in die Tasten: Hi! > Its been a like two weeks that I have been trying to work out the LXR > installation and configuration. I am not yet successul. > Can anyone suggest a substitute cross refferencing tool as good as LXR > because I have deadlines. Why did you not ask earlier? Maybe one could have give you some hints. So to come back to the topic of this list: What are your problems? > I am working on SELinux and doing enhancement but have no prior experiance. ? Ciao Max -- Follow the white penguin. |
From: Shahbaz K. <sha...@gm...> - 2007-05-09 20:59:43
|
Its been a like two weeks that I have been trying to work out the LXR installation and configuration. I am not yet successul. Can anyone suggest a substitute cross refferencing tool as good as LXR because I have deadlines. I am working on SELinux and doing enhancement but have no prior experiance. I will appreciate a good advice. Thank you. |
From: Jan-Benedict G. <jb...@lu...> - 2007-05-07 16:49:49
|
On Mon, 2007-05-07 17:09:01 +0500, Shahbaz Khan <sha...@gm...> wrot= e: > Now going ahead with the latest 0.9x I need some help as well. I did > not find any "make" instructions. I would appreciate a sample conf > file or anyother guide. There aren't any `make' instructions, because it's all Perl, no compiled parts. You'd read the INSTALL file. It contains installation instructions. There's also a sample lxr.conf file with a lot of examples, as well as sample templates for the HTML pages in the template/ subdirectory. MfG, JBG --=20 Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: http://www.eyrie.org/~eagle/faqs/questions.html the second : |
From: Shahbaz K. <sha...@gm...> - 2007-05-07 12:09:05
|
Thanks jbglaw for the tip. I actually found the earlier version widely implemented and it required minimum installations and configuration so I opted for it. Now going ahead with the latest 0.9x I need some help as well. I did not find any "make" instructions. I would appreciate a sample conf file or anyother guide. Thank you. On 5/7/07, Jan-Benedict Glaw <jb...@lu...> wrote: > On Sun, 2007-05-06 23:54:26 +0500, Shahbaz Khan <sha...@gm...> wrote: > > I am using Fedora core 6. I have configured lxr 0.3 with the latest > > glimpse but I get the following in the browser: > > Version 0.3 is really really really old. It would be nice if you'd > test either a 0.9 release, or if possible even the current version > right out of CVS. > > MfG, JBG > > -- > Jan-Benedict Glaw jb...@lu... +49-172-7608481 > Signature of: ...und wenn Du denkst, es geht nicht mehr, > the second : kommt irgendwo ein Lichtlein her. > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.6 (GNU/Linux) > > iD8DBQFGPkcKHb1edYOZ4bsRAkB4AJ9gpCqgUVLCGwyYDa81AhWkpyju+gCfc7E+ > jtaAWjXXbhV7qA+JJNdActE= > =w/fE > -----END PGP SIGNATURE----- > > |
From: Jan-Benedict G. <jb...@lu...> - 2007-05-06 21:22:30
|
On Sun, 2007-05-06 23:54:26 +0500, Shahbaz Khan <sha...@gm...> wrot= e: > I am using Fedora core 6. I have configured lxr 0.3 with the latest > glimpse but I get the following in the browser: Version 0.3 is really really really old. It would be nice if you'd test either a 0.9 release, or if possible even the current version right out of CVS. MfG, JBG --=20 Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: ...und wenn Du denkst, es geht nicht mehr, the second : kommt irgendwo ein Lichtlein her. |
From: Shahbaz K. <sha...@gm...> - 2007-05-06 18:54:30
|
I am using Fedora core 6. I have configured lxr 0.3 with the latest glimpse but I get the following in the browser: -> Parent Directory - fileidx - xref when i click the files it gives me some wierd source code with lots of funny faces like ones in the ascii command line screens (if that makes sense at all!). lxr installprefix is /var/www/lxr/ My document root for apache is /var/www/ attached is my lxr configuration. |
From: Mike F. <vap...@gm...> - 2006-12-23 05:35:47
|
mod_perl does not allow you to use exit() and in fact spits out warnings ... so the trick is to apply a bit of code like: --- lxr/lib/LXR/Common.pm +++ lxr/lib/LXR/Common.pm @@ -49,6 +49,11 @@ require LXR::Index; require LXR::Lang; +use constant IS_MODPERL => $ENV{MOD_PERL}; +use subs qw(exit); +# Select the correct exit function +*exit = IS_MODPERL ? \&Apache::exit : sub { CORE::exit }; + $wwwdebug = 0; $tmpcounter = 23; i snipped this from the upstream mod_perl docs ... it'll redirect all calls to the proper exit function depending on whether you're running from the command line or from mod_perl -mike |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-17 12:28:13
|
Hi! This is Maximilian's first cut on variables in drop down boxes. It's *not* yet ready for real use! It already works mostly, but ./lxr/diff is broken now, needs to be fixed :) (The patch is -b generated, I've done some more whitespace cleanups to the html-head template, too.) diff --git a/lib/LXR/Common.pm b/lib/LXR/Common.pm index 908f690..36bcba2 100644 --- a/lib/LXR/Common.pm +++ b/lib/LXR/Common.pm @@ -750,6 +750,45 @@ sub varexpand { return ($varex); } =20 +sub varexpand_select { + my ($template, $who) =3D @_; + # XXX WTF is $who? + my $varexpand =3D ''; + +# $varexpand .=3D "<form name=3D\"variables\" method=3D\"GET\" action=3D\"= source\">\n"; + foreach my $var ($config->allvariables) { + $varexpand .=3D expandtemplate( + $template, + ( + 'varname' =3D> sub { $config->vardescription($var) }, + 'varlinks' =3D> sub { varlinks_select( $template, $who, $var) } + ) + ); + } +# $varexpand .=3D "<button type=3Dsubmit name=3D\"Update\" value=3D\"Updat= e\"></form>\n"; + return $varexpand; +} + +sub varlinks_select { + my ($template, $who, $var) =3D @_; + my $current_val =3D $config->variable($var); + + my $output_string =3D "<select name=3D\"$var\" onChange=3D\"document.vari= ables.submit()\">\n"; + foreach my $val ($config->varrange($var)) { + # Preselect current value of variable + if ($val eq $current_val) { + $output_string .=3D "<option value=3D\"$val\" selected> $val </option>\= n"; + } else { + $output_string .=3D "<option value=3D\"$val\"> $val </option>\n"; + } + } + $output_string .=3D "</select>\n"; + + return $output_string; +} + + + sub devinfo { my ($templ) =3D @_; my (@mods, $mod, $path); @@ -837,7 +876,7 @@ sub makeheader { 'thisurl' =3D> sub { thisurl(@_) }, 'pathname' =3D> sub { pathname(@_) }, 'modes' =3D> sub { modeexpand(@_, $who) }, - 'variables' =3D> sub { varexpand(@_, $who) }, + 'variables' =3D> sub { varexpand_select(@_, $who) }, 'devinfo' =3D> sub { devinfo(@_) }, 'atticlink' =3D> sub { atticlink(@_) }, ) @@ -876,7 +915,7 @@ sub makefooter { 'banner' =3D> sub { bannerexpand(@_, $who) }, 'thisurl' =3D> sub { thisurl(@_) }, 'modes' =3D> sub { modeexpand(@_, $who) }, - 'variables' =3D> sub { varexpand(@_, $who) }, + 'variables' =3D> sub { varexpand_select( @_, $who ) }, 'devinfo' =3D> sub { devinfo(@_) } ) ) diff --git a/templates/html-head.html b/templates/html-head.html index 2dbafa2..6e1b61f 100644 --- a/templates/html-head.html +++ b/templates/html-head.html @@ -1,21 +1,20 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> -<head> -<title>$title</title> -<base href=3D"$baseurl"> -<link href=3D"$stylesheet" rel=3D"STYLESHEET" type=3D"text/css"> -</head> - -<body> -<table width=3D'100%' border=3D'0' cellpadding=3D'0' cellspacing=3D'0'> + <head> + <title>$title</title> + <base href=3D"$baseurl"> + <link href=3D"$stylesheet" rel=3D"STYLESHEET" type=3D"text/css"> + </head> + <body> + <table width=3D"100%" border=3D"0" cellpadding=3D"0" cellspacing=3D"0"> <tr> - <td valign=3D'top'> + <td valign=3D"top"> <!-- put local logo or links here --> </td> <td> - <table width=3D'100%' border=3D'0' cellpadding=3D'0' cellspacing=3D'= 0'> + <table width=3D"100%" border=3D"0" cellpadding=3D"0" cellspacing=3D"0"> <tr> - <td align=3D'center'> + <td align=3D"center"> <h1>The LXR Cross Referencer</h1> </td> </tr> @@ -24,30 +23,40 @@ </tr> </table> </td> - <td align=3D'right'> + <td align=3D"right"> + <!-- diff/source/identifier search/... --> $modes{ - [ $modelink ]<br>} + [ $modelink ]<br> + } </td> </tr> - <tr><td colspan=3D'3'> </td></tr> + <tr> + <td colspan=3D'3'> </td> + </tr> <tr> <td>$atticlink</td> <td colspan=3D'2'> - <table width=3D"100%" border=3D"0" cellpadding=3D'0' cellspacing=3D'0= '> + <form name=3D"variables" method=3D"GET" action=3D""> + <table width=3D"100%" border=3D"0" cellpadding=3D"0" cellspacing=3D"0= "> $variables{ <tr> - <td align=3D"left"> + <td align=3D"right"> $varname: </td> - <td align=3D"right"> + <td align=3D"left"> $varlinks{ - [ $varvalue ]} - <br> + [ $varvalue ] + } </td> - </tr>} + </tr> + } + <tr> + <td> </td> + <td><input type=3D"submit" value=3D"Submit"></td> + </tr> </table> + </form> </td> </tr> -</table> - -<hr> + </table> + <hr> --=20 Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: The real problem with C++ for kernel modules is: the languag= e just sucks. the second : -- Linus Torvalds |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-16 15:11:14
|
On Sat, 2006-12-16 13:21:04 +0000, Malcolm Box <mal...@gm...> wrot= e: > Jan-Benedict Glaw wrote: > > This is our current set of LXR patches. I'd like to get feedback on > > those and if you like to merge them. >=20 > These patches look good to me. Thanks. > Would you like commit access to CVS so that you can get stuff in easier? Who doesn't like to take an offer :) But I'd probably not check in anything without prior discussion anyways. MfG, JBG --=20 Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: Wenn ich wach bin, tr=C3=A4ume ic= h. the second : |
From: Malcolm B. <mal...@gm...> - 2006-12-16 13:20:44
|
Hi, Jan-Benedict Glaw wrote: > This is our current set of LXR patches. I'd like to get feedback on > those and if you like to merge them. These patches look good to me. Would you like commit access to CVS so that you can get stuff in easier? Cheers, Malcolm |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 21:20:17
|
Hi! While looking through the generated HTML, I found two </html>. One =66rom the template, one from Common.pl. Only one needed, drop the other: lib/LXR/Common.pm | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/lib/LXR/Common.pm b/lib/LXR/Common.pm index d507a50..908f690 100644 --- a/lib/LXR/Common.pm +++ b/lib/LXR/Common.pm @@ -879,8 +879,7 @@ sub makefooter { 'variables' =3D> sub { varexpand(@_, $who) }, 'devinfo' =3D> sub { devinfo(@_) } ) - ), - "</html>\n" + ) ); } =20 We're currently looking into getting drop-down boxes. Doesn't yet work full, but I already like it with those ~60 tags in Linus's GIT repo. MfG, JBG --=20 Jan-Benedict Glaw jb...@lu... +49-172-7608481 Signature of: Ich hatte in letzter Zeit ein bi=C3=9Fchen viel Rea= litycheck. the second : Langsam m=C3=B6chte ich mal wieder weitertr=C3= =A4umen k=C3=B6nnen. |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:54
|
--- templates/lxr.conf | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/templates/lxr.conf b/templates/lxr.conf index 06b7011..08a35ab 100644 --- a/templates/lxr.conf +++ b/templates/lxr.conf @@ -60,6 +60,45 @@ # ($files->allreleases($LXR::Common::pathname), # $files->allrevisions($LXR::Common::pathname)) # }, # deferred function call. + # + # 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, + # you can properly sort kernel versions. Just + # leave it off for generic projects. + # + # Simple example for any GIT repo: + # 'range' => sub { + # my $some_dir = "/path/to/project/.git/refs/tags"; + # opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!"; + # my @files = grep { -f "$some_dir/$_" } readdir (DIR); + # closedir DIR; + # return sort @files; + # }, + # + # Advanced example for Linus's upstream + # linux-2.6 kernel repository: + # 'range' => sub { + # use Linux::KernelSort; + # my $kernel = new Linux::KernelSort; + # + # my $some_dir = "/path/to/linux-2.6/.git/refs/tags"; + # opendir (DIR, $some_dir) || die "cannot opendir $some_dir: $!"; + # my @files = grep { -f "$some_dir/$_" } readdir (DIR); + # closedir DIR; + # # Linus's tags all have a leading "v" + # # which we must cut off for sorting + # # add again afterwards. + # for (my $i = 0; $i < scalar (@files); $i++) { + # $files[$i] =~ s/^v//; + # } + # @files = $kernel->sort (@files); + # for (my $i = 0; $i < scalar (@files); $i++) { + # $files[$i] =~ s/^/v/; + # } + # + # return @files; + # }, # The default version to display 'default' => '1.0.6' -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:52
|
--- templates/lxr.conf | 46 ++++++++++++++++++++++------------------------ 1 files changed, 22 insertions(+), 24 deletions(-) diff --git a/templates/lxr.conf b/templates/lxr.conf index b60de12..06b7011 100644 --- a/templates/lxr.conf +++ b/templates/lxr.conf @@ -3,7 +3,6 @@ # ( { - # Global configuration # Path to glimpse executables. @@ -25,10 +24,9 @@ # Location of the ectags.conf file 'ectagsconf' => '/path/to/lib/LXR/Lang/ectags.conf', - - # Paths for CVS module - 'cvspath' => '/bin:/usr/local/bin:/usr/bin:/usr/sbin', + # Paths for CVS module + 'cvspath' => '/bin:/usr/local/bin:/usr/bin:/usr/sbin', }, { @@ -81,17 +79,17 @@ }, # Templates used for headers and footers - 'htmlhead' => 'html-head.html', - 'htmltail' => 'html-tail.html', - 'htmldir' => 'html-dir.html', - 'htmlident' => 'html-ident.html', + 'htmlhead' => 'html-head.html', + 'htmltail' => 'html-tail.html', + 'htmldir' => 'html-dir.html', + 'htmlident' => 'html-ident.html', 'htmlident_refs' => 'html-ident-refs.html', - 'htmlfind' => 'html-find.html', - 'htmlsearch' => 'html-search-swish.html', + 'htmlfind' => 'html-find.html', + 'htmlsearch' => 'html-search-swish.html', - 'sourcehead' => 'html-head.html', - 'sourcedirhead' => 'html-head.html', - 'stylesheet' => 'lxr.css', + 'sourcehead' => 'html-head.html', + 'sourcedirhead' => 'html-head.html', + 'stylesheet' => 'lxr.css', # sourceroot - where to get the source files from @@ -108,9 +106,9 @@ # server access does NOT work. # 'sourceroot' => 'cvs:/hom/karsk/a/CVSROOT/linux', - # For a BitKeeper repository, specify bk: followed by the path to the + # 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 + # the 'sourceparams' value below. This should point to a directory where the # code can write and read files. # 'sourceroot' => 'bk:/some/repository/here', @@ -130,16 +128,16 @@ # # BK: 'cachepath' is used for temporary files # GIT: if `do_annotations' is non-zero, the file revision that - # introduced each line is displayed. - # `do_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! + # introduced each line is displayed. + # `do_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' => { - 'cachepath' => '/a/path/here', - 'do_annotate' => 1, - 'do_blame' => 1, + 'cachepath' => '/a/path/here', + 'do_annotate' => 1, + 'do_blame' => 1, }, # The DBI identifier for the database to use @@ -204,7 +202,7 @@ 'Java' => [ 'Java', '(?i)\.java$', 'LXR::Lang::Java', '4' ], # 'Lisp' => [ - # 'Lisp', '(?i)\.cl$|\.clisp$|\.el$|\.l$|\.lisp$|\.lsp$|\.ml$', 'LXR::Lang::Generic' + # 'Lisp', '(?i)\.cl$|\.clisp$|\.el$|\.l$|\.lisp$|\.lsp$|\.ml$', 'LXR::Lang::Generic' # ], # No tabwidth specified here as an example -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:50
|
--- initdb-postgres | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/initdb-postgres b/initdb-postgres index 89e84c5..7639414 100644 --- a/initdb-postgres +++ b/initdb-postgres @@ -19,7 +19,6 @@ create table lxr_files ( fileid int, primary key (fileid), unique (filename, revision) - ); create table lxr_symbols ( @@ -27,15 +26,14 @@ create table lxr_symbols ( symid int, primary key (symid), unique (symname) - ); create table lxr_declarations ( - declid smallint not null, + declid smallint not null, langid smallint not null, declaration char(255) not null, - primary key (declid, langid) -); + primary key (declid, langid) +); create table lxr_indexes ( symid int references lxr_symbols, @@ -44,10 +42,10 @@ create table lxr_indexes ( langid smallint not null, type smallint not null, relsym int references lxr_symbols, - foreign key (langid, type) references lxr_declarations (langid, declid) + foreign key (langid, type) references lxr_declarations (langid, declid) ); -create table lxr_releases +create table lxr_releases (fileid int references lxr_files, release varchar, primary key (fileid,release) @@ -76,4 +74,4 @@ grant select on lxr_indexes to public; grant select on lxr_releases to public; grant select on lxr_usage to public; grant select on lxr_status to public; -grant select on lxr_declarations to public; \ No newline at end of file +grant select on lxr_declarations to public; -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:49
|
--- INSTALL | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 9da5714..264ff53 100644 --- a/INSTALL +++ b/INSTALL @@ -74,11 +74,15 @@ choice. A good choice could be /usr/local/lxr so you would do Now you have to put the perl modules that LXR uses into a directory on your system that will be searched by mod_perl when the LXR scripts are -executed. Execute: +executed. Being an Apache 1.x user, execute: cp /usr/local/lxr/Local.pm /usr/lib/perl5/site_perl/ cp -r /usr/local/lxr/lib/LXR /usr/lib/perl5/site_perl +For Apache2, there's a clever variant to not clobber your system's +Perl installation with foreign modules documented below in the Apache2 +section. + Now you should copy the template files for LXR to your installation mv /usr/local/lxr/templates/* /usr/local/lxr/ @@ -90,7 +94,7 @@ If you have glimpse installed, you should set 'glimpsebin' => '/path/to/your/glimpse/executable' 'glimpseindex' => '/path/to/your/glimpseindex/executable' - + If you have swish-e installed, you should set 'swishbin' => '/path/to/your/swishe-e/executable' @@ -153,6 +157,24 @@ in /path/to/cvs/repository and your cvs module is called lxr then set 'sourceroot' => 'cvs:/path/to/cvs/repository/lxr' 'sourcerootname' => 'A Friendly Name For Your Repository' +Apache2, modperl2 and LXR +------------------------- +Edit the .htaccess file and change "Apache::Registry" to +"ModPerl::Registry". You also need to let modperl2 know about +where to find LXR perl modules. You can add a line like this +to your Apache2 config: + + PerlRequire /usr/local/lxr/require.pl + +with about this contents: +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +#!/usr/bin/env perl -w +@INC=(@INC, "/usr/local/lxr", + "/usr/local/lxr/lib", + "/usr/local/lxr/lib/Files"); +1; +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Using Swish-e with LXR ---------------------- Create a directory for the swish index files to go in, and put the -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:47
|
--- templates/lxr.conf | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/templates/lxr.conf b/templates/lxr.conf index e578e3c..b60de12 100644 --- a/templates/lxr.conf +++ b/templates/lxr.conf @@ -124,9 +124,23 @@ # The name to display for this source tree 'sourcerootname' => 'Example', - - # Any parameters to the source access method should be specified below - 'sourceparams' => {'cachepath' => '/a/path/here'}, + + # + # Any parameters to the source access method should be specified below. + # + # BK: 'cachepath' is used for temporary files + # GIT: if `do_annotations' is non-zero, the file revision that + # introduced each line is displayed. + # `do_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' => { + 'cachepath' => '/a/path/here', + 'do_annotate' => 1, + 'do_blame' => 1, + }, # The DBI identifier for the database to use # For mysql, the format is dbi:mysql:dbname=<name> -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:46
|
--- lib/LXR/Files/GIT.pm | 461 ++++++++++++++++---------------------------------- 1 files changed, 147 insertions(+), 314 deletions(-) diff --git a/lib/LXR/Files/GIT.pm b/lib/LXR/Files/GIT.pm index 13c8b6a..6ab6685 100644 --- a/lib/LXR/Files/GIT.pm +++ b/lib/LXR/Files/GIT.pm @@ -1,7 +1,9 @@ -# -*- tab-width: 4 -*- ############################################### # -# $Id: GIT.pm,v 1.1 2006/04/08 13:37:58 mbox Exp $ - +# GIT.pm - A file backend for LXR based on GIT. +# +# © 2006 by Jan-Benedict Glaw <jb...@lu...> +# © 2006 by Maximilian Wilhelm <ma...@rf...> +# # 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 @@ -13,409 +15,240 @@ # 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. +# along with this program; if not, write to the Free Software Foundation +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# package LXR::Files::GIT; -$CVSID = '$Id: GIT.pm,v 1.1 2006/04/08 13:37:58 mbox Exp $'; +$CVSID = '$Id$'; use strict; use FileHandle; +use Time::Local; use LXR::Common; -use LXR::Author; +use Git; -# -# We're adding ".git" to the path since we're only dealing with -# low-level stuff and _never_ ever deal with checked-out files. -# sub new { my ($self, $rootpath, $params) = @_; $self = bless({}, $self); $self->{'rootpath'} = $rootpath; + $self->{'do_blame'} = $$params{'do_blame'}; + $self->{'do_annotations'} = $$params{'do_annotations'}; + + if ($self->{'do_blame'}) { + # Blame support will only work when commit IDs are available, + # called annotations here... + $self->{'do_annotations'} = 1; + } - $ENV{'GIT_DIR'} = $self->{'rootpath'}; return $self; } -sub filerev { - my ($self, $filename, $release) = @_; - - $filename = $self->sanitizePath ($filename); - $release = $self->get_treehash_for_branchhead_or_tag ($release); - - my $pid = open(my $F, '-|'); - die $! unless defined $pid; - if (!$pid) { - exec ("git-ls-tree", $release, $filename) - or die "filerev: Cannot exec git-ls-tree"; - } - - my $git_line=<$F>; - chomp $git_line; - close($F); +sub isdir { + my ($self, $pathname, $release) = @_; - if ($git_line =~ m/(\d+)\s(\w+)\s([[:xdigit:]]+)\t(.*)/ ) { - return $3; - + $pathname =~ s/^\///; + if ($pathname eq "") { + return 1 == 1; } else { - die "filerev( $filename, $release ): No entry found.\n"; + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); + my $line = $repo->command_oneline ("ls-tree", "-d", "$release", "$pathname"); + return $line =~ m/^\d+ tree .*$/; } } -sub getfiletime { - my ($self, $filename, $release) = @_; - $filename = $self->sanitizePath ($filename); - - if ($filename =~ m/\/\.\.$/ ) - return undef; -# if ($filename =~ /\/\.\.\$/) -# return undef; - - my $pid1 = open(my $R, '-|' ); - die $! unless defined $pid1; - if(!$pid1) { - exec("git-rev-list", "--max-count=1", "$release", "--", $filename ) or die "getfiletime ($filename, $release): Cannot exec git-rev-list\n"; - } - my $commit = <$R>; - chomp $commit; - close($R); - - my $pid = open(my $F, '-|'); - die $! unless defined $pid; - if(!$pid) { - exec("git-cat-file", "commit", $commit) or die "getfiletime ($filename, $release): Cannot exec git-cat-file\n"; - } +sub isfile { + my ($self, $pathname, $release) = @_; - while(<$F>) { - chomp; - if ( m/^author .*<.*> (\d+)\s.*$/ ) { - close($F); - return $1; - } + $pathname =~ s/^\///; + if ($pathname eq "") { + return 1 == 0; + } else { + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); + my $line = $repo->command_oneline ("ls-tree", "-d", "$release", "$pathname"); + return $line =~ m/^\d+ blob .*$/; } - - close($F); - - die "getfiletime ($filename, $release) : Did not find GIT entry.\n"; } -sub getfilesize { - my ($self, $filename, $release) = @_; +sub getdir { + my ($self, $pathname, $release) = @_; + my ($dir, $node, @dirs, @files); + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); - $filename = $self->sanitizePath ($filename); - my $object_hash = $self->filerev ($filename, $release); + $pathname =~ s/^\///; - print STDERR "getfilesize ($filename, $release)\n"; + my ($fh, $c) = $repo->command_output_pipe ("ls-tree", "$release", "$pathname"); + while (<$fh>) { + if (m/(\d+) (\w+) ([[:xdigit:]]+)\t(.*)/) { + my ($entrymode, $entrytype, $objectid, $entryname) = ($1, $2, $3, $4); - # return `git-cat-file -s $blobhash`; - my $pid = open (my $F, '-|'); - die $! unless defined $pid; - if(!$pid) { - exec ("git-cat-file", "-s", $object_hash) or die "getfilesize ($filename, $release): Cannot exec git-cat-file\n"; - } + # Only get the filename part of the full path + my @array = split (/\//, $entryname); + my $num = @array - 1; + $entryname = @array[$num]; - my $size = <$F>; - close ($F); - chomp $size; - if ( $size ) { - return $size; - } else { - return undef; - } + # Weed out things to ignore + foreach my $ignoredir ($config->{ignoredirs}) { + next if $entryname eq $ignoredir; + } - close ($F); - return undef; -} + next if $entryname =~ /^\.$/; + next if $entryname =~ /^\.\.$/; -sub getfile { - my ($self, $filename, $release) = @_; - my ($buffer); + if ($entrytype eq "blob") { + push (@files, $entryname); + } elsif ($entrytype eq "tree") { + push (@dirs, "$entryname/"); + } + } + } -# my $blobhash = open( "git-ls-tree $release $filename | cut -f 3 -d ' ' | cut -f 1 -d \$'\t' |") or die "Cannot open git-ls-tree $release $filename in getfile\n"; - my $blobhash = $self->filerev( $filename, $release ); -# local ($/) = undef; + $repo->command_close_pipe ($fh, $c); - open(FILE, "git-cat-file blob $blobhash|") || return undef; - $buffer = <FILE>; - close(FILE); - return $buffer; + return sort (@dirs), sort (@files); } -sub getfilehandle { +sub getfilesize { my ($self, $filename, $release) = @_; - my ($fileh); - $filename = $self->sanitizePath ($filename); + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); - my $treeid = $self->get_treehash_for_branchhead_or_tag ($release); + $filename =~ s/^\///; - $filename = $self->sanitizePath ($filename); - my $objectid = $self->getBlobOrTreeOfPathAndTree ($filename, $treeid); + my $sha1hashline = $repo->command_oneline ("ls-tree", "$release", "$filename"); - $fileh = new IO::File; - $fileh->open ("git-cat-file blob $objectid |") or die "Cannot execute git-cat-file blob $objectid"; + if ($sha1hashline =~ m/\d+ blob ([[:xdigit:]]+)\t.*/) { + return $repo->command_oneline ("cat-file", "-s", "$1"); + } - return $fileh; + return undef; } sub tmpfile { my ($self, $filename, $release) = @_; my ($tmp, $fileh); - local ($/) = undef; $tmp = $config->tmpdir . '/lxrtmp.' . time . '.' . $$ . '.' . &LXR::Common::tmpcounter; - open(TMP, "> $tmp") || return undef; - $fileh = $self->getfilehandle( $filename, $release ); - print(TMP <$fileh>); - close($fileh); - close(TMP); + open (TMP, "> $tmp") || return undef; + $fileh = $self->getfilehandle ($filename, $release); + print (TMP <$fileh>); + close ($fileh); + close (TMP); return $tmp; } -sub getannotations { +sub filerev { + my ($self, $filename, $release) = @_; + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); - return (); - my ($self, $pathname, $release) = @_; - my @authors = (); + $filename =~ s/^\///; - if ( $pathname =~ m#^/(.*)$# ) { - $pathname = $1; - } - - open( BLAME, "git-blame -l $pathname $release |"); - while( <BLAME> ) { - if ( m/(^[[:xdigit:]]+)\s.*$/ ) { - my $linehash = $1; - my $authorline = `git-cat-file commit $linehash`; - if ($authorline =~ m/^author ([^<]+)<(([^@])\@[^>]+)>.*$/ ) { - my ($authorname, $authoruser, $authoremail) = ($1, $2, $3); - push(@authors, LXR::Author->new(chomp $authorname, - $authoruser, $authoremail)); - } else { - push(@authors, LXR::Author->new("", "", "")); - } - } else { - print STDERR "getannotations: JB HAT DOOFE OHREN: $_\n"; - } + my $sha1hashline = $repo->command_oneline ("ls-tree", "$release", "$filename"); + + if ($sha1hashline =~ m/\d+ blob ([[:xdigit:]]+)\t.*/) { + return $1; } - close(BLAME); - print STDERR "authors: " . join(" ", @authors) . "\n"; - - return @authors; + return undef; } -sub getauthor { +sub getfiletime { + my ($self, $filename, $release) = @_; - return (); + $filename =~ s/^\///; - my ($self, $filename, $release) = @_; - $filename = $self->sanitizePath ($filename); - print STDERR "getauthr( $filename, $release )\n"; - my $commit = `git-rev-list --max-count=1 $release -- $filename | tr -d \$'\n'`; - my $authorline = `git-cat-file commit $commit | grep '^author' | head -n1 | tr -d \$'\n'`; - - if ($authorline =~ m/^author ([^<]+)<(([^@])\@[^>]+)>.*$/ ) { - my ($authorname, $authoruser, $authoremail) = ($1, $2, $3); - return LXR::Author->new(chomp $authorname, $authoruser, $authoremail); - } else { - return LXR::Author->new("", "", ""); + if ($filename eq "") { + return undef; } -} - -sub getdir { - my ($self, $pathname, $release) = @_; - my ($dir, $node, @dirs, @files); - - my $treeid = $self->get_treehash_for_branchhead_or_tag ($release); - - $pathname = $self->sanitizePath( $pathname ); - if ( $pathname !~ m#..*/# ) { - $pathname = $pathname . '/'; + if ($filename =~ m/\/$/) { + return undef; } - open(DIRLIST, "git-ls-tree $treeid $pathname |") or die "Cannot open git-ls-tree $treeid $pathname"; - while( <DIRLIST> ) { - if ( m/(\d+)\s(\w+)\s([[:xdigit:]]+)\t(.*)/ ) { - my ($entrymode, $entrytype, $objectid, $entryname) = ($1,$2,$3,$4); - - # Weed out things to ignore - foreach my $ignoredir ($config->{ignoredirs}) { - next if $entryname eq $ignoredir; - } - - next if $entryname =~ /^\.$/; - next if $entryname =~ /^\.\.$/; + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); + my $lastcommitline = $repo->command_oneline ("log", "--max-count=1", "--pretty=oneline", "$release", "--", "$filename"); + if ($lastcommitline =~ m/([[:xdigit:]]+) /) { + my $commithash = $1; - if ($entrytype eq "blob") { - push(@files, $entryname); - - } elsif ($entrytype eq "tree") { - push(@dirs, "$entryname/"); - #push(@dirs, "$entryname"); + my (@fh, $c) = $repo->command ("cat-file", "commit", "$commithash"); + foreach my $line (@fh) { + if ($line =~ m/^author .* <.*> (\d+) .[0-9]{4}$/) { + return $1; } } + return undef; } - close(DIRLIST); - - return sort(@dirs), sort(@files); -} - -# This function should not be used outside this module -# except for printing error messages -# (I'm not sure even that is legitimate use, considering -# other possible File classes.) - -##sub toreal { -## my ($self, $pathname, $release) = @_; -## -## nearly all (if not all) method calls eventually call toreal(), so this is a good place to block file access -## foreach my $ignoredir ($config->ignoredirs) { -## return undef if $pathname =~ m|/$ignoredir/|; -## } -## -## return ($self->{'rootpath'} . $release . $pathname); -##} - -sub isdir { - my ($self, $pathname, $release) = @_; - - $pathname = $self->sanitizePath ($pathname); - $release = $self->get_newest_commit_from_branchhead_or_tag ($release); - - print STDERR "isdir ($pathname, $release)\n"; - - my $treeid = $self->get_treehash_for_branchhead_or_tag ($release); - - return $self->getObjectType ($pathname, $treeid) eq "tree"; -} - -sub isfile { - my ($self, $pathname, $release) = @_; - - $pathname = $self->sanitizePath ($pathname); - $release = $self->get_newest_commit_from_branchhead_or_tag ($release); - - print STDERR "isfile($pathname, $release)\n"; - my $treeid = $self->get_treehash_for_branchhead_or_tag ($release); - - return $self->getObjectType ($pathname, $treeid) eq "blob"; -} - -# -# For a given commit (that is, the latest commit on a named branch or -# a tag's name) return the tree object's hash corresponding to it. -# -sub get_treehash_for_branchhead_or_tag () { - my ($self, $release) = @_; - $release = $self->get_newest_commit_from_branchhead_or_tag ($release); - - return `git-cat-file commit $release | grep '^tree' | head -n1 | cut -f 2 -d ' ' | tr -d \$'\n'`; + return undef; } -sub getObjectType() { - my ($self, $pathname, $treeid) = @_; - - open (DIRLIST, "git-ls-tree $treeid $pathname |") or die "Cannot open git-ls-tree $treeid $pathname"; - while (<DIRLIST>) { - if (m/(\d+)\s(\w+)\s([[:xdigit:]]+)\t(.*)/) { - my ($entrymode, $entrytype, $objectid, $entryname) = ($1, $2, $3, $4); - - # Weed out things to ignore -# # This should only be needed in the getdir function. -# foreach my $ignoredir ($config->{ignoredirs}) { -# next if $entryname eq $ignoredir; -# } +sub getfilehandle { + my ($self, $filename, $release) = @_; + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); - $entryname = $self->sanitizePath ($entryname); + $filename =~ s/^\///; -# print STDERR "getBlobOrTreeOfPathAndTree: pathname: \"$pathname\" :: entryname: \"$entryname\"\n"; - next if ( ! $pathname eq $entryname ); + my $sha1hashline = $repo->command_oneline ("ls-tree", "$release", "$filename"); - close (DIRLIST); -# print STDERR "Juhu, wir haben $pathname gefunden :: $objectid\n"; - return $entrytype; - } + if ($sha1hashline =~ m/^\d+ blob ([[:xdigit:]]+)\t.*/) { + my ($fh, $c) = $repo->command_output_pipe ("cat-file", "blob", "$1"); + return $fh; } - close (DIRLIST); return undef; } -sub getBlobOrTreeOfPathAndTree() { - my ($self, $pathname, $treeid ) = @_; +sub getannotations { + my ($self, $filename, $release) = @_; - open (DIRLIST, "git-ls-tree $treeid $pathname |") or die "Cannot open git-ls-tree $treeid $pathname"; - while (<DIRLIST>) { - if (m/(\d+)\s(\w+)\s([[:xdigit:]]+)\t(.*)/) { - my ($entrymode, $entrytype, $objectid, $entryname) = ($1, $2, $3, $4); + if ($self->{'do_annotations'}) { + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); + my @revlist = (); + $filename =~ s/^\///; - # Weed out things to ignore - foreach my $ignoredir ($config->{ignoredirs}) { - next if $entryname eq $ignoredir; - } + my (@lines, $c) = $repo->command ("blame", "-l", "$release", "--", "$filename"); - $entryname = $self->sanitizePath( $entryname ); - next if (! $pathname eq $entryname ); - - close (DIRLIST); - return $objectid; + foreach my $line (@lines) { + if ($line =~ m/^([[:xdigit:]]+) .*/) { + push (@revlist, $1); + } else { + push (@revlist, ""); + } } - } - close (DIRLIST); - - return undef; -} -# -# This function will take a branch name ("master") or a tag name -# (like "v2.6.15") and return either the branch commit object ID, -# or descend from the tag object into the referenced commit object -# and return its commit ID. XXX -# -sub get_newest_commit_from_branchhead_or_tag ($$) { - my ($self, $head_or_tag) = @_; - my $objtype = `git-cat-file -t $head_or_tag | tr -d \$'\n'`; - - if ($objtype eq "commit") { - return $head_or_tag; - } elsif ($objtype eq "tag") { - return `git-cat-file tag $head_or_tag | grep '^object' | head -n1 | cut -f 2 -d ' ' | tr -d \$'\n'`; + return @revlist; } else { - die ("get_newest_commit_from_branchhead_or_tag: Unrecognized object type $objtype for $head_or_tag\n"); + return (); } } -sub sanitizePath() { - my ($self, $pathname) = @_; +sub getauthor { + my ($self, $pathname, $release) = @_; - if ( $pathname eq "" ) { - # Empty? Just beam the client to the root. - $pathname = "."; - } elsif ( $pathname =~ m#^/# ) { - # Absolute? We want them to be relative! - $pathname = ".$pathname"; - } else { - # Filename incurrent directory? Add "./" to - # make them truly relative. - $pathname = "./$pathname"; - } + # + # Note that $release is a real commit this time + # (returned by getannotations() above). This is + # _not_ a tag name! + # - # Don't let them exploit us easily. -# if ( $pathname =~ m#/../# ) { -# die("You are now dead because of $pathname\n"); -# } + if ($self->{'do_blame'}) { + my $repo = Git->repository (Directory => "$self->{'rootpath'}"); + my @authorlist = (); - # Doubled slashes? We remove them. - $pathname =~ s#//#/#g; + $pathname =~ s/^\///; + + my (@lines, $c) = $repo->command ("cat-file", "commit", "$release"); + foreach my $line (@lines) { + if ($line =~ m/^author (.*) </) { + return $1 + } + } - # Delete leading slashes. - $pathname =~ s#/*$##g; + return undef; + } - return $pathname; + return undef; } 1; -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:46
|
--- lib/LXR/Files/BK.pm | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/LXR/Files/BK.pm b/lib/LXR/Files/BK.pm index dd2c895..93c488f 100644 --- a/lib/LXR/Files/BK.pm +++ b/lib/LXR/Files/BK.pm @@ -149,7 +149,7 @@ sub getannotations { sub openbkcommand { my ($self, $command) = @_; - my $dir = getcwd(); + my $dir = getcwd(); chdir($self->{'rootpath'}); my $fileh = new IO::File; $fileh->open($command) or die "Can't execute $command"; @@ -238,12 +238,12 @@ sub fill_cache { sub get_tree { my ($self, $release) = @_; - + # Return entire tree as provided by 'bk rset' # First, check if cache exists - + my $fileh = new IO::File; - + if (-r $self->cachename($release)) { $fileh->open($self->cachename($release)) or die "Whoops, can't open cached version"; } else { @@ -261,7 +261,7 @@ sub get_tree { $fileh->open($self->cachename($release)) or die "Couldn't open cached version!"; } } - + my @files = <$fileh>; close $fileh; chomp @files; @@ -276,7 +276,7 @@ sub cachename { my ($self, $release) = @_; return $self->{'cache'}."/treecache-".$release; } - + sub canonise { my $path = shift; $path =~ s!^/!!; -- 1.4.4.1 |
From: Jan-Benedict G. <jb...@lu...> - 2006-12-07 10:17:41
|
--- lib/LXR/Files/BK.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/LXR/Files/BK.pm b/lib/LXR/Files/BK.pm index 979832c..dd2c895 100644 --- a/lib/LXR/Files/BK.pm +++ b/lib/LXR/Files/BK.pm @@ -302,4 +302,4 @@ sub getfileinfo { return $tree_cache{$release}{$path}{$file}; } -1; \ No newline at end of file +1; -- 1.4.4.1 |