[SCM] Debian package checker branch, master, updated. 2.2.0-40-gd8f9e52
The following commit has been merged in the master branch:
commit 891ba04ced383c3782073ec652e76d558a153911
Author: Russ Allbery <rra@debian.org>
Date: Sat Jan 31 16:48:55 2009 -0800
Improve manual reference refresh script
* data/output/manual-references:
+ [RA] Added an explanatory header.
* private/refresh-manual-refs:
+ [RA] Renamed from manual_refs_update.pl. Add a section heading to
the output file and update the file in Lintian's data directory
directly rather than printing to standard output.
diff --git a/data/output/manual-references b/data/output/manual-references
index 37fb9af..8676587 100644
--- a/data/output/manual-references
+++ b/data/output/manual-references
@@ -1,3 +1,14 @@
+# Data about titles, sections, and URLs of manuals, used to expand references
+# in tag descriptions and add links for HTML output. Each line of this file
+# has four fields separated by double colons:
+#
+# <manual> :: <section> :: <title> :: <url>
+#
+# If <section> is empty, that line specifies the title and URL for the whole
+# manual. If <url> is empty, that manual is not available on the web.
+#
+# Last updated: 2009-01-31
+
debconf-spec::::Configuration management::http://www.debian.org/doc/packaging-manuals/debconf_specification.html
debconf-spec::aen27::Introduction::http://www.debian.org/doc/packaging-manuals/debconf_specification.html#AEN27
debconf-spec::aen30::Configuration Data::http://www.debian.org/doc/packaging-manuals/debconf_specification.html#AEN30
diff --git a/debian/changelog b/debian/changelog
index f72e7e9..77f6cb3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,7 +37,7 @@ lintian (2.2.1) UNRELEASED; urgency=low
* data/output/manual-references:
+ [RA] Manual reference data used for formatting tag descriptions.
- Moved from lib/manual_refs.
+ Moved from lib/manual_refs and added an explanatory header.
* frontend/lintian-info:
+ [RA] Use Lintian::Tag::Info instead of Read_taginfo.
@@ -81,6 +81,11 @@ lintian (2.2.1) UNRELEASED; urgency=low
+ [ADB] Fix the spelling of "pedantic". Thanks, Michal Čihař.
(Closes: #513083)
+ * private/refresh-manual-refs:
+ + [RA] Renamed from manual_refs_update.pl. Add a section heading to
+ the output file and update the file in Lintian's data directory
+ directly rather than printing to standard output.
+
* reporting/config:
+ [RA] Set a bin directory and disable signature checks by default.
* reporting/harness
diff --git a/private/manual_refs_update.pl b/private/refresh-manual-refs
similarity index 73%
rename from private/manual_refs_update.pl
rename to private/refresh-manual-refs
index 4c15b10..47eb132 100755
--- a/private/manual_refs_update.pl
+++ b/private/refresh-manual-refs
@@ -19,14 +19,28 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
-# Invoke as ./manual_refs_update.pl > manual_refs.new
-# You need copies of all the relevant manuals installed in the standard
-# places locally (packages debian-policy, developers-reference, doc-base,
-# python, lintian, menu and libpkg-guide).
+# Should be run from the top level of the Lintian source tree or with
+# LINTIAN_ROOT set appropriately. You need copies of all the relevant manuals
+# installed in the standard places locally (packages debian-policy,
+# developers-reference, doc-base, python, lintian, menu and libpkg-guide).
use strict;
use warnings;
+
use File::Basename;
+use POSIX qw(strftime);
+
+BEGIN {
+ my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'};
+ if (not $LINTIAN_ROOT) {
+ use Cwd ();
+ $ENV{'LINTIAN_ROOT'} = $LINTIAN_ROOT = Cwd::cwd();
+ } else {
+ chdir $LINTIAN_ROOT or die "Cannot chdir to $LINTIAN_ROOT: $!\n";
+ }
+}
+
+my $LINTIAN_ROOT = $ENV{'LINTIAN_ROOT'};
# For each manual, we need:
# * Location of the manual index on the local filesystem
@@ -112,12 +126,12 @@ my %manuals = (
# extract_refs -- Extract manual references from HTML file.
#
-# This function takes the path to the page and the regex to match, and prints
-# references to stdout. The second argument is used to decide whether to look
-# for the title (0) or not (1). It returns a list of pages linked by the
-# extracted references.
+# This function takes the output file handle, the path to the page, and the
+# regex to match, and prints references to stdout. The second argument is used
+# to decide whether to look for the title (0) or not (1). It returns a list of
+# pages linked by the extracted references.
sub extract_refs {
- my ($manual, $title, $page, $url, $ref_re, $fields) = @_;
+ my ($fh, $manual, $title, $page, $url, $ref_re, $fields) = @_;
my @linked_pages = ();
open(PAGE, "$page") or die "Couldn't open $page: $!";
@@ -130,7 +144,7 @@ sub extract_refs {
if (not $title and m/$title_re/) {
$title = 1;
my @out = ( $manual, '', $1, $url );
- print join('::', @out) . "\n";
+ print $fh join('::', @out) . "\n";
}
while (m/$ref_re/g) {
@@ -159,7 +173,7 @@ sub extract_refs {
$ref{url} = '' if not $url;
my @out = ( $manual, $ref{section}, $ref{title}, $ref{url} );
- print join('::', @out) . "\n";
+ print $fh join('::', @out) . "\n";
}
}
@@ -168,6 +182,24 @@ sub extract_refs {
return @linked_pages;
}
+# Create a new reference file.
+open(OUT, '>', 'data/output/manual-references.new')
+ or die "Cannot create data/output/manual-references.new: $!\n";
+my $date = strftime('%Y-%m-%d', localtime);
+print OUT <<"HEADER";
+# Data about titles, sections, and URLs of manuals, used to expand references
+# in tag descriptions and add links for HTML output. Each line of this file
+# has four fields separated by double colons:
+#
+# <manual> :: <section> :: <title> :: <url>
+#
+# If <section> is empty, that line specifies the title and URL for the whole
+# manual. If <url> is empty, that manual is not available on the web.
+#
+# Last updated: $date
+
+HEADER
+
for my $manual (sort keys %manuals) {
my ($index, $url, $ref_re, $fields, $sub_re) = @{$manuals{$manual}};
@@ -176,14 +208,25 @@ for my $manual (sort keys %manuals) {
}
# Extract references from the index.
- my @subpages = extract_refs($manual, 0, $index, $url, $ref_re, $fields);
+ my @subpages
+ = extract_refs(\*OUT, $manual, 0, $index, $url, $ref_re, $fields);
# Extract additional subsection references if not available in the index.
next if not $sub_re;
foreach my $pagename (@subpages) {
my $page = dirname($index) . "/$pagename";
- extract_refs($manual, 1, $page, $url, $sub_re, $fields);
+ extract_refs(\*OUT, $manual, 1, $page, $url, $sub_re, $fields);
}
}
-# vim: sw=4 sts=4 ts=4 et sr
+# Replace the old reference file.
+close OUT or die "Cannot flush data/output/manual-references.new: $!\n";
+rename('data/output/manual-references.new',
+ 'data/output/manual-references')
+ or die "Cannot rename data/output/manual-references: $!\n";
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 ts=4 et sr
--
Debian package checker
Reply to: