~ubuntu-branches/ubuntu/natty/lxr-cvs/natty

« back to all changes in this revision

Viewing changes to lib/LXR/Tagger.pm

  • Committer: Bazaar Package Importer
  • Author(s): Giacomo Catenazzi
  • Date: 2006-02-24 07:52:13 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060224075213-2fn6kna2y9p3l65m
Tags: 0.9.4-1
* WARNING: see /usr/share/doc/lxr-cvs/README.Debian if you upgrade
  from an old verion (0.9.2 and previous), because of some changes
  in configuration and structure
* New upstream release (Closes: #310729)
* Moved configuration files in /etc/lxr and binary files in /usr/bin
  (Closes: #326467).
* Some small updates (policy, debhelper, ...)
* Support for mysql 5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- tab-width: 4 -*- ###############################################
2
2
#
3
 
# $Id: Tagger.pm,v 1.19 2001/10/23 14:30:18 mbox Exp $
 
3
# $Id: Tagger.pm,v 1.22 2004/07/21 20:44:30 brondsem Exp $
4
4
 
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
 
14
#
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
18
 
19
19
package LXR::Tagger;
20
20
 
21
 
$CVSID = '$Id: Tagger.pm,v 1.19 2001/10/23 14:30:18 mbox Exp $ ';
 
21
$CVSID = '$Id: Tagger.pm,v 1.22 2004/07/21 20:44:30 brondsem Exp $ ';
22
22
 
23
23
use strict;
24
24
use FileHandle;
36
36
        return unless $revision;
37
37
 
38
38
        print(STDERR "--- $pathname $release $revision\n");
39
 
        
 
39
 
40
40
        if ($index) {
41
 
          my $fileid = $index->fileid($pathname, $revision);
42
 
          
43
 
          $index->release($fileid, $release);
44
 
          
45
 
          if ($index->toindex($fileid)) {
46
 
                $index->empty_cache();
47
 
                print(STDERR "--- $pathname $fileid\n");
48
 
                
49
 
                my $path = $files->tmpfile($pathname, $release);
50
 
                
51
 
                $lang->indexfile($pathname, $path, $fileid, $index, $config);
52
 
                unlink($path);
53
 
          } else {
54
 
                print(STDERR "$pathname was already indexed\n");
55
 
          }
56
 
        } else { print(STDERR " **** FAILED ****\n"); }
57
 
        $lang = undef;
 
41
                my $fileid = $index->fileid($pathname, $revision);
 
42
 
 
43
                $index->release($fileid, $release);
 
44
 
 
45
                if ($index->toindex($fileid)) {
 
46
                        $index->empty_cache();
 
47
                        print(STDERR "--- $pathname $fileid\n");
 
48
 
 
49
                        my $path = $files->tmpfile($pathname, $release);
 
50
 
 
51
                        $lang->indexfile($pathname, $path, $fileid, $index, $config);
 
52
                        $index->setindexed($fileid);
 
53
                        unlink($path);
 
54
                } else {
 
55
                        print(STDERR "$pathname was already indexed\n");
 
56
                }
 
57
        } else {
 
58
                print(STDERR " **** FAILED ****\n");
 
59
        }
 
60
        $lang     = undef;
58
61
        $revision = undef;
59
62
}
60
63
 
61
 
 
62
64
sub processrefs {
63
65
        my ($pathname, $release, $config, $files, $index) = @_;
64
66
 
65
67
        my $lang = new LXR::Lang($pathname, $release);
66
68
 
67
69
        return unless $lang;
68
 
        
 
70
 
69
71
        my $revision = $files->filerev($pathname, $release);
70
72
 
71
73
        return unless $revision;
72
74
 
73
75
        print(STDERR "--- $pathname $release $revision\n");
74
 
        
 
76
 
75
77
        if ($index) {
76
 
          my $fileid = $index->fileid($pathname, $revision);
77
 
          
78
 
          if ($index->toreference($fileid)) {
79
 
                $index->empty_cache();
80
 
                print(STDERR "--- $pathname $fileid\n");
81
 
                
82
 
                my $path = $files->tmpfile($pathname, $release);
83
 
                
84
 
                $lang->referencefile($pathname, $path, $fileid, $index, $config);
85
 
                unlink($path);
86
 
          } else {
87
 
                print STDERR "$pathname was already referenced\n";
88
 
          }
89
 
        } else { print( STDERR " **** FAILED ****\n"); }
90
 
 
91
 
        $lang = undef;
 
78
                my $fileid = $index->fileid($pathname, $revision);
 
79
 
 
80
                if ($index->toreference($fileid)) {
 
81
                        $index->empty_cache();
 
82
                        print(STDERR "--- $pathname $fileid\n");
 
83
 
 
84
                        my $path = $files->tmpfile($pathname, $release);
 
85
 
 
86
                        $lang->referencefile($pathname, $path, $fileid, $index, $config);
 
87
                        $index->setreferenced($fileid);
 
88
                        unlink($path);
 
89
                } else {
 
90
                        print STDERR "$pathname was already referenced\n";
 
91
                }
 
92
        } else {
 
93
                print(STDERR " **** FAILED ****\n");
 
94
        }
 
95
 
 
96
        $lang     = undef;
92
97
        $revision = undef;
93
 
  }
 
98
}
94
99
 
95
100
1;