#!/usr/bin/perl -w use strict; use Getopt::Long; use IO::Handle; use File::Find; # These modules reside under webwml/Perl use lib ($0 =~ m|(.*)/|, $1 or ".") ."/../webwml/Perl"; use Webwml::L10n::Db; our ($verbose, $MANDB_FILE); $MANDB_FILE = 'mandb'; Getopt::Long::Configure("no_ignore_case", "bundling"); GetOptions( 'verbose|v' => \$verbose, 'o|output=s' => \$MANDB_FILE, ); my $mandata = Webwml::L10n::Db->new(); sub get_infos { return unless $_ eq 'INFOS'; my $pkg = $File::Find::dir; $pkg =~ s#^./(.*)/##; my $lang = $1; unless ($mandata->has_package($pkg)) { $mandata->package($pkg, $pkg); $mandata->version($pkg, 1); $mandata->maintainer($pkg, 1); $mandata->section($pkg, 1); $mandata->priority($pkg, 1); $mandata->pooldir($pkg, 1); $mandata->type($pkg, 1); $mandata->upstream($pkg, 1); }; open (INFOS, "< INFOS"); my ($manpage, $location, $line); while ($line = ) { $line =~ s/\s*$//s; if ($line eq '') { $mandata->add_man($pkg, $manpage, $lang, $location); $manpage = $location = ''; } elsif ($line =~ s/^manpage:\s*//i) { $manpage = $line; } elsif ($line =~ s/^location:\s*//i) { $location = $line; } elsif ($line =~ s/^Build-Source:\s*//i) { $location = $line; } } $mandata->add_man($pkg, $manpage, $lang, $location) if $manpage; close (INFOS); } File::Find::find(\&get_infos, '.'); $mandata->write($MANDB_FILE); 1;