~ubuntu-branches/ubuntu/precise/globus-core/precise

« back to all changes in this revision

Viewing changes to doxygen/globus-update-doxygen-index.in

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2011-12-20 09:23:16 UTC
  • mfrom: (3.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20111220092316-il3t47k5p2v1wq6y
Tags: 8.5-1
* Update to Globus Toolkit 5.2.0
* Drop patches accepted upstream
* Drop the globus-gpt2pkg-config script (now part of grid-packaging-tools)
* Use dpkg's build flags

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env perl
 
2
 
 
3
 
4
# Copyright 1999-2006 University of Chicago
 
5
 
6
# Licensed under the Apache License, Version 2.0 (the "License");
 
7
# you may not use this file except in compliance with the License.
 
8
# You may obtain a copy of the License at
 
9
 
10
# http://www.apache.org/licenses/LICENSE-2.0
 
11
 
12
# Unless required by applicable law or agreed to in writing, software
 
13
# distributed under the License is distributed on an "AS IS" BASIS,
 
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
15
# See the License for the specific language governing permissions and
 
16
# limitations under the License.
 
17
 
18
 
 
19
 
 
20
=head1 NAME
 
21
 
 
22
B<globus-update-doxygen-index> - Replace the share/doc/index.html file
 
23
with one which contains links to all of the installed package documentation.
 
24
 
 
25
=head1 SYNOPSIS
 
26
 
 
27
B<globus-update-doxygen-index> [path to documentation]
 
28
 
 
29
=head1 DESCRIPTION
 
30
 
 
31
B<globus-update-doxygen-index> creates an index.html file suitable for
 
32
browsing all globus-related documentation located in a documentation
 
33
directory.  By default, it builds an index in $GLOBUS_LOCATION/share/doc;
 
34
an option command line argument should point to a similarly structured
 
35
directory structure in another location.
 
36
 
 
37
=cut
 
38
 
 
39
@GLOBUS_PERL_INITIALIZER@
 
40
 
 
41
use strict;
 
42
use IO::File;
 
43
 
 
44
use Grid::GPT::PackageFactory;
 
45
 
 
46
 
 
47
my %pkgs = ();
 
48
my %functional_groups = ();
 
49
my %descs = ();
 
50
 
 
51
my $docpath="$datadir/doc";
 
52
if(defined($ARGV[0]))
 
53
{
 
54
    $docpath = $ARGV[0];
 
55
}
 
56
my $output_docpath;
 
57
if(defined($ARGV[1]))
 
58
{
 
59
    $output_docpath = $ARGV[1];
 
60
}
 
61
 
 
62
print "Searching documentation tree $docpath\n";
 
63
 
 
64
foreach (glob("$docpath/*"))
 
65
{
 
66
    my $nonempty = `wc -l $_/html/*.tag 2> /dev/null`;
 
67
    chomp($nonempty);
 
68
    if($nonempty > 3)
 
69
    {
 
70
        my $pkgname = $_;
 
71
        $pkgname =~ s|.*/||g;
 
72
        my $_pkgname = $pkgname;
 
73
        $_pkgname =~ s|-[0-9].*||g;
 
74
        $_pkgname =~ s|-|_|g;
 
75
 
 
76
        $pkgs{$_pkgname} = $pkgname;
 
77
    }
 
78
}
 
79
 
 
80
print "Sorting into functional groups\n";
 
81
foreach (keys %pkgs) {
 
82
    my $package_factory = new Grid::GPT::PackageFactory();
 
83
    my @package_files = glob("$datadir/globus/packages/$_/pkg_data*.gpt");
 
84
    my $package_file = $package_files[0];
 
85
 
 
86
    if ($package_file eq '') {
 
87
        print "No package data for $_\n";
 
88
        next;
 
89
    }
 
90
    my $package = $package_factory->type_of_package($package_file);
 
91
    $package->read_metadata_file($package_file);
 
92
 
 
93
    push(@{$functional_groups{$package->{Functional_Group}}}, $_);
 
94
    $descs{$_} = $package->{Description};
 
95
}
 
96
 
 
97
if ($output_docpath ne '') {
 
98
    $docpath = $output_docpath;
 
99
}
 
100
my $file = new IO::File(">$docpath/index.html")
 
101
    || die "unable to write to $docpath/index.html";
 
102
print $file <<EOF;
 
103
 
 
104
<html>
 
105
<head>
 
106
<title>API Documentation</title>
 
107
<link href="globus.css" title="Globus" rel="stylesheet" type="text/css">
 
108
</head>
 
109
<body>
 
110
<h1>API Documentation</h1>
 
111
 
 
112
EOF
 
113
 
 
114
foreach (keys %functional_groups)
 
115
{
 
116
    my $group = $_;
 
117
    $group =~ s|.*/||;
 
118
 
 
119
    print $file "<h2>$_</h2>\n";
 
120
 
 
121
    print $file "<ul>\n";
 
122
 
 
123
    foreach my $pkg (@{$functional_groups{$_}})
 
124
    {
 
125
        print $file <<EOF;
 
126
            <li> <a href='$pkgs{$pkg}/html/index.html' target='_top'>$descs{$pkg}</a>
 
127
                [<a href='$pkgs{$pkg}/html/main.html' target='_top'>no frames</a>]
 
128
            </li>
 
129
EOF
 
130
    }
 
131
    print $file "</ul>\n";
 
132
}
 
133
print "Done\n";
 
134
 
 
135
print $file "</body></html>\n";
 
136
 
 
137
$file->close();
 
138
 
 
139
print "Run the following command to modify the documention for globus.org stylesheets:\n";
 
140
print "find $docpath -name \"*.html\" -print | xargs sed -i \"s#globus.css#/toolkit/css/c-api.css#\" \n";
 
141