This file is indexed.

/usr/share/perl5/graphincludes/project.pm is in libdeps-perl 0.13-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# This file is part of the DEPS/graph-includes package
#
# (c) 2005,2006 Yann Dirson <ydirson@altern.org>
# Distributed under version 2 of the GNU GPL.

package graphincludes::project;
use strict;
use warnings;

use graphincludes::params;
our @ISA;

use graphincludes::graph;

use File::Spec::Functions qw(catfile catpath splitdir splitpath canonpath);
use Hash::Util qw(lock_keys);
use Carp qw(croak);

# set_language: class method that sets the language to be used when extracting deps.
# This is a hack, which does not allow to mix several languages in a single project.
# It is only a temporary measure that allows support for languages other than C/C++.
our $_language;
sub set_language {
  my $class = shift;
  $_language = shift;
  my $langmodule = "graphincludes::extractor::" . $_language;
  eval "require $langmodule" or die "cannot load $langmodule from " . join ':', @INC;
  push @ISA, $langmodule;
}

sub new {
  my $class = shift;
  my %args = @_;
  my $prefixstrip = $args{prefixstrip};
  my @files = map { canonpath($_) } @{$args{files}}; # take a (cleaned up) copy of @ARGV
  my $self = {};

#   if (defined $_language) {
#     $self = ("graphincludes::extractor::" . $_language)->new;
#   }

  $self->{TRANSGRAPH} = new graphincludes::graph; # graph of graph transformations
  my $graphnode = new DEPS::Node('files');
  $self->{TRANSGRAPH}->add_node($graphnode);
  $self->{ROOTGRAPH} = $graphnode->{DATA} = new graphincludes::graph; # the file dependency graph
  $self->{ROOTGRAPH}->set_nodes_from_names(\@files);

  $self->{PFXSTRIP} = $prefixstrip;
  $self->{SPECIALEDGES} = {};
  $self->{IGNOREDEDGES} = {};	# to be computed in getdeps
  $self->{REPORT} = { HDR => {},
		      SYS => {},
		    };

  bless ($self, $class);
  lock_keys (%$self);

  return $self;
}

sub init {
  my $self = shift;

  $self->getdeps($self->{ROOTGRAPH});
}

sub nlevels { return 0; }
sub filelabel {
  my $self = shift;
  my ($file,$level) = @_;

  return $file;
}

sub locatefile {
  my $self = shift;
  my ($dst, @path) = @_;

  print STDERR "Trying to locate \`$dst'\n" if $graphincludes::params::debug;

  sub fullpath {
    my ($dstpath, $strip, $srcpath) = @_;
    catfile (@$srcpath[0..($#$srcpath-$strip)], @$dstpath);
  }

  (undef, my $dstdir, my $filename) = splitpath($dst);
  my @dstpath = (splitdir ($dstdir), $filename);
  # count number of leading "../" in the #include reference
  my $strip = 0;
  while ($dstpath[0] eq '..') {
    $strip++; shift @dstpath;
  }
  # find the file in @path
  my $dstfile;
  foreach my $dir (@path) {
    my @srcpath = splitdir ($dir);
    if (defined($dstfile = canonpath(fullpath(\@dstpath,$strip,\@srcpath))) and
	grep { $_->{LABEL} eq $dstfile } $self->{ROOTGRAPH}->get_nodes) {
      print STDERR " Found from $dir ($dstfile)\n" if $graphincludes::params::debug;
      last;
    } else {
      print STDERR " Not from $dir ($dstfile)\n" if $graphincludes::params::debug;
      $dstfile = undef;
    }
  }

  return $dstfile;		# can be undef !
}

sub _fileexists {
  my ($file, @path) = @_;
  foreach my $dir (@path) {
    my $f = catpath('', $dir, $file);
    return $f if -r $f;
  }
  return undef;
}

sub record_missed_dep {
  my $self = shift;
  my ($src, $dst) = @_;

  if (defined _fileexists ($dst, @graphincludes::params::sysinclpath)) {
    # list as system include
    $self->{REPORT}->{SYS}->{$dst} = 1;
  } else {
    # list as unknown header
    push @{$self->{REPORT}->{HDR}->{$dst}}, $src;
  }
}

sub special_edge {
  my $self = shift;
  my ($src, $dst) = @_;

  my $attrs = $self->{SPECIALEDGES}->{$src}->{$dst};

  if (defined $attrs) {
    return $attrs;
  } else {
    return undef;
  }
}

sub apply_transform {
  my $self = shift;
  my ($transform, $args, $newname, @graphnames) = @_;

  # load the required transform package
  eval "require $transform" or die "cannot load '$transform': $@";

  # find graphs from graphnames
  my @parentnodes = map { $self->{TRANSGRAPH}->get_node_from_name($_)
			    or croak "no graph named '$_'" } @graphnames;
  my @graphs = map { $_->{DATA} } @parentnodes;

  # apply transform
  my $result;
  eval '$result = '.$transform.'::apply (graphs => \@graphs, %$args)' or croak "transform failed: $@";

  # record in project's transform graph
  my $node = new DEPS::Node($newname);
  $node->{DATA} = $result;
  $self->{TRANSGRAPH}->add_node($node);

  # record deps
  foreach my $parent (@parentnodes) {
    $self->{TRANSGRAPH}->add_edge (new DEPS::Edge($parent, $node));
  }

  return $result;
}

1;