From: aph Date: Mon, 27 Jan 2003 19:41:40 +0000 (+0000) Subject: script to make the manual TOC into a substvar for debian/control X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=943f8ce503acb6d3bf1eb3aacdb434239bba40a1;p=developers-reference.git script to make the manual TOC into a substvar for debian/control description use git-svn-id: svn://anonscm.debian.org/ddp/manuals/trunk/developers-reference@2121 313b444b-1b9f-4f58-a734-7bb04f332e8d --- diff --git a/debian/tocsubstvars b/debian/tocsubstvars new file mode 100755 index 0000000..9e40a38 --- /dev/null +++ b/debian/tocsubstvars @@ -0,0 +1,38 @@ +#!/usr/bin/perl -w + +use strict; +use Debian::Debhelper::Dh_Lib; + +init(); + +sub gettoc { + my $f = shift; + my @toc; + + open(FILE, "<$f") || die("opening $f: $!\n"); + while () { + chomp; + /^\d+\.\s/ && push(@toc, $_); + } + close(FILE) || die("closing $f: $!\n"); + return @toc; +} + +my @entoc = gettoc("developers-reference.txt"); + +# sanity test +if ( $#entoc == -1 ) { + error("found no entries in the TOC, aborting"); +} elsif ( $#entoc < 4 ) { + error("only found " . $#entoc . " entries in the TOC, aborting"); +} +verbose_print("found " . $#entoc . " entries in TOC"); + +my $entoc = " " . join('${Newline} ', @entoc); +$entoc =~ s/\'//g; + +foreach my $package (@{$dh{DOPACKAGES}}) { + addsubstvar($package, "TOC:en", $entoc); +} + +