Package: pdl / 1:2.019-5

absolute-doc-paths.patch Patch series | download
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
Description: Use absolute paths for symlinked documentation.
 On Debian the documentation is installed under /var/lib/pdl
 and symlinks are used for compatibility:
 .
  /<vendorarch>/PDL/pdldoc.db    -> /var/lib/pdl/pdldoc.db
  /<vendorarch>/PDL/Index.pod    -> /var/lib/pdl/Index.pod
  /<vendorarch>/PDL/HtmlDocs/PDL -> /var/lib/pdl/html
 .
 The path to documentation is assumed to be relative to pdldoc.db,
 resulting in errors such as the following without resolving the
 absolute paths first:
 .
  pdl> help PDL::Core
  pod2text: unable to format 
  Documentation error: couldn't find absolute path to ../../../usr/lib/x86_64-linux-gnu/perl5/5.22/PDL/Core.pm
 .
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: not-needed

--- a/Doc/Doc.pm
+++ b/Doc/Doc.pm
@@ -6,6 +6,7 @@ use PDL::Core '';
 use Pod::Select;
 use File::Spec;
 use File::Basename;
+use Cwd ();
 
 @ISA = qw(Pod::Select);
 
@@ -647,6 +648,17 @@ sub scan {
   $verbose = 0 unless defined $verbose;
   barf "can't find file '$file'" unless -f $file;
 
+  # Convert symlink to absolute path.
+  #
+  # On Debian the documentation is installed under /var/lib/pdl
+  # and symlinks are used for compatibility:
+  #
+  #  /<vendorarch>/PDL/pdldoc.db    -> /var/lib/pdl/pdldoc.db
+  #  /<vendorarch>/PDL/Index.pod    -> /var/lib/pdl/Index.pod
+  #  /<vendorarch>/PDL/HtmlDocs/PDL -> /var/lib/pdl/html
+
+  $file = Cwd::abs_path($file);
+
   # First HTMLify file in the tree
 
   # Does not work yet
@@ -765,6 +777,19 @@ sub funcdocs {
   barf "unknown function '$func'" unless defined($hash->{$func});
   my $file = $hash->{$func}->{File};
   my $dbf = $hash->{$func}->{Dbfile};
+
+  # Convert symlink to absolute path.
+  #
+  # On Debian the documentation is installed under /var/lib/pdl
+  # and symlinks are used for compatibility:
+  #
+  #  /<vendorarch>/PDL/pdldoc.db    -> /var/lib/pdl/pdldoc.db
+  #  /<vendorarch>/PDL/Index.pod    -> /var/lib/pdl/Index.pod
+  #  /<vendorarch>/PDL/HtmlDocs/PDL -> /var/lib/pdl/html
+
+  $file = Cwd::abs_path($file);
+  $dbf  = Cwd::abs_path($dbf);
+
   if (!File::Spec->file_name_is_absolute($file) && $dbf) {
     $file = File::Spec->rel2abs($file, dirname($dbf)); 
   }
--- a/Doc/Doc/Perldl.pm
+++ b/Doc/Doc/Perldl.pm
@@ -42,6 +42,7 @@ use PDL::Doc;
 use Pod::Select;
 use IO::File;
 use Pod::PlainText;
+use Cwd ();
 
 $PDL::onlinedoc = undef;
 $PDL::onlinedoc = PDL::Doc->new(FindStdFile());
@@ -267,6 +268,17 @@ sub finddoc  {
 	   my $absfile = undef;
 	   my @scnd = @{$PDL::onlinedoc->{Scanned}};
 	   for my $dbf(@scnd){
+	       # Convert symlink to absolute path.
+	       #
+	       # On Debian the documentation is installed under /var/lib/pdl
+	       # and symlinks are used for compatibility:
+	       #
+	       #  /<vendorarch>/PDL/pdldoc.db    -> /var/lib/pdl/pdldoc.db
+	       #  /<vendorarch>/PDL/Index.pod    -> /var/lib/pdl/Index.pod
+	       #  /<vendorarch>/PDL/HtmlDocs/PDL -> /var/lib/pdl/html
+
+	       $dbf = Cwd::abs_path($dbf);
+
 	       $dbf =~ s:\/[^\/]*$::; # Trim file name off the end of the database file to get just the directory
 	       $dbf .= "/$relfile";
 	       $absfile = $dbf if( -e $dbf );