lintian: r155 - in trunk: checks debian lib
Author: he
Date: 2004-04-14 17:54:18 +0200 (Wed, 14 Apr 2004)
New Revision: 155
Modified:
trunk/checks/debconf
trunk/debian/changelog
trunk/lib/Util.pm
Log:
* lib/Utils.pm
+ [HE] Changed {read,parse}_dpkg_control a bit to cope with the fact
that template files sometimes contain lines consisting only of
whitespace which do *not* separate to blocks. (Closes: #242479)
Modified: trunk/checks/debconf
===================================================================
--- trunk/checks/debconf 2004-04-14 15:49:23 UTC (rev 154)
+++ trunk/checks/debconf 2004-04-14 15:54:18 UTC (rev 155)
@@ -104,7 +104,7 @@
# Lots of template checks.
-my @templates = $seentemplates ? read_dpkg_control("control/templates") : ();
+my @templates = $seentemplates ? read_dpkg_control("control/templates", "templates file") : ();
foreach my $template (@templates) {
my $isselect='';
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2004-04-14 15:49:23 UTC (rev 154)
+++ trunk/debian/changelog 2004-04-14 15:54:18 UTC (rev 155)
@@ -10,6 +10,10 @@
+ [FL] Fixed some semantic errors (since noone ever observed the
correspoding perl warnings the fixed parts are probably never
used in the current code)
+ * lib/Utils.pm
+ + [HE] Changed {read,parse}_dpkg_control a bit to cope with the fact
+ that template files sometimes contain lines consisting only of
+ whitespace which do *not* separate to blocks. (Closes: #242479)
* frontend/lintian:
+ [HE] Added a --dont-check-parts|-X option to allow users to specify
Modified: trunk/lib/Util.pm
===================================================================
--- trunk/lib/Util.pm 2004-04-14 15:49:23 UTC (rev 154)
+++ trunk/lib/Util.pm 2004-04-14 15:54:18 UTC (rev 155)
@@ -28,13 +28,14 @@
# this function can parse output of `dpkg-deb -f', .dsc,
# and .changes files (and probably all similar formats)
# arguments:
-# $file
+# $filehandle
+# $debconf_flag (true if the file is a debconf template file)
# output:
# list of hashes
# (a hash contains one sections,
# keys in hash are lower case letters of control fields)
sub parse_dpkg_control {
- my ($CONTROL) = @_;
+ my ($CONTROL, $debconf_flag) = @_;
my @data;
my $cur_section = 0;
@@ -42,13 +43,14 @@
my $last_tag;
while (<$CONTROL>) {
- chop;
+ chomp;
# tabs at the beginning are illegal, but handle them anyways
s/^\t/ \t/o;
# empty line?
- if (m/^\s*$/) {
+ if ((!$debconf_flag && m/^\s*$/) or
+ ($debconf_flag && m/^$/)) {
if ($open_section) { # end of current section
$cur_section++;
$open_section = 0;
@@ -96,7 +98,7 @@
}
sub read_dpkg_control {
- my ($file) = @_;
+ my ($file, $debconf_flag) = @_;
if (not _ensure_file_is_sane($file)) {
return undef;
@@ -105,7 +107,7 @@
my $CONTROL = FileHandle->new;
open($CONTROL,$file)
or fail("cannot open control file $file for reading: $!");
- my @data = parse_dpkg_control($CONTROL);
+ my @data = parse_dpkg_control($CONTROL, $debconf_flag);
close($CONTROL)
or fail("pipe for control file $file exited with status: $?");
return @data;
Reply to: