Skip to content

Commit

Permalink
3.31: Check MESSAGE file format. Patch from sco at openface ca in pkg…
Browse files Browse the repository at this point in the history
…/18276.
  • Loading branch information
wiz committed Sep 12, 2002
1 parent 6c01b38 commit 38e973d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkgtools/pkglint/Makefile
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.134 2002/08/13 15:05:30 wiz Exp $
# $NetBSD: Makefile,v 1.135 2002/09/12 17:03:04 wiz Exp $
#

DISTNAME= pkglint-3.30
DISTNAME= pkglint-3.31
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
48 changes: 46 additions & 2 deletions pkgtools/pkglint/files/pkglint.pl
Expand Up @@ -12,7 +12,7 @@
# Freely redistributable. Absolutely no warranty.
#
# From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
# $NetBSD: pkglint.pl,v 1.68 2002/07/02 15:26:18 wiz Exp $
# $NetBSD: pkglint.pl,v 1.69 2002/09/12 17:03:04 wiz Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by Hubert Feyrer <hubertf@netbsd.org>,
Expand Down Expand Up @@ -137,7 +137,10 @@
next if ($i =~ /Makefile$/);
$i =~ s/^\Q$portdir\E\///;
next if (defined $checker{$i});
if ($i =~ /PLIST/) {
if ($i =~ /MESSAGE/) {
unshift(@checker, $i);
$checker{$i} = 'checkmessage';
} elsif ($i =~ /PLIST/) {
unshift(@checker, $i);
$checker{$i} = 'checkplist';
} else {
Expand Down Expand Up @@ -327,6 +330,47 @@ sub checkdistinfo {
return 1;
}

#
# MESSAGE
#
sub checkmessage {
local($file) = @_;
local(%maxchars) = ('MESSAGE', 80);
local($longlines, $lastline, $tmp) = (0, "", "");

$shortname = basename($file);
open(IN, "< $portdir/$file") || return 0;

$_ = <IN>;
if (! /^={75}$/) {
&perror("WARN: $file should begin with a 75-character ".
"double-dashed line.");
}
$_ = <IN>;
if (! /^\$NetBSD(:.*|)\$$/) {
&perror("FATAL: missing RCS Id in MESSAGE file: $file");
}
while (<IN>) {
$longlines++ if ($maxchars{$shortname} < length($_));
$lastline = $_;
$tmp .= $_;
}
if ($lastline !~ /^={75}$/) {
&perror("WARN: $file should end with a 75-character ".
"double-dashed line.");
}
if ($longlines > 0) {
&perror("WARN: $file includes lines that exceed ".
"$maxchars{$shortname} characters.");
}
if ($tmp =~ /[\033\200-\377]/) {
&perror("WARN: $file includes iso-8859-1, or ".
"other local characters. $file should be ".
"plain ascii file.");
}
close(IN);
}

#
# PLIST
#
Expand Down

0 comments on commit 38e973d

Please sign in to comment.