Package: libglib-perl / 3:1.260-1

fix-gtks-whatis 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
Description: if a man page doesn't have a whatis, try to figure out
 which ctype corresponds to that (using regexps), check if they really
 do (using the Glib::Type register stuff), and if they do add a whatis
 that says "wrapper for $ctype"
Forwarded: no
Author: Ryan Niebur <ryan@debian.org>

--- a/lib/Glib/GenPod.pm
+++ b/lib/Glib/GenPod.pm
@@ -278,7 +278,15 @@
 		# end.  But all the other =head1 below need a closing =cut.
 
 		print "=head1 NAME\n\n$package";
-		print ' - '.$pkgdata->{blurb} if (exists ($pkgdata->{blurb}));
+                if(exists ($pkgdata->{blurb})) {
+		print ' - '.$pkgdata->{blurb};
+                } elsif($package =~ m/^Gtk2::Pango/) {
+                my $newname = $package;
+                $newname =~ s/Gtk2:://;
+                print ' - moved to ' . $newname . ', kept for backwards compatibility'
+                } elsif(convert_to_cname($package)) {
+                print ' - wrapper for '.convert_to_cname($package);
+                }
 		print "\n\n=cut\n\n";
 
 		#                   pods            , position 
@@ -1156,6 +1164,8 @@
 
 sub set_main_mod {
 	$MAIN_MOD = shift;
+        eval "use $MAIN_MOD";
+        die($@) if($@);
 }
 
 sub preprocess_pod
@@ -1522,6 +1532,27 @@
 	} while (@dirs);
 }
 
+sub convert_to_cname {
+    my $perlname = shift;
+    my $cname = $perlname;
+    if($perlname =~ /^Gtk2::Gdk::/) {
+        $cname =~ s/^Gtk2::Gdk::/Gdk/;
+    } elsif($perlname =~ m/^Gtk2::/) {
+        $cname =~ s/^Gtk2::/Gtk/;
+    } elsif($perlname =~ m/^Gnome2::Bonobo::/) {
+        $cname =~ s/^Gnome2::Bonobo::/Bonobo/;
+    } elsif($perlname =~ m/^Gnome2::/) {
+        $cname =~ s/^Gnome2::/Gnome/;
+    }
+    $cname =~ s/:://g;
+    my $tmp;
+    eval { $tmp = Glib::Type->package_from_cname($cname); };
+    if($@ || $tmp ne $perlname) {
+        return;
+    }
+    return $cname;
+}
+
 1;
 __END__