From owner-ports-jp@jp.freebsd.org  Tue Jun 10 15:16:56 1997
Received: by jaz.jp.freebsd.org (8.8.5+2.7Wbeta5/8.7.3) id PAA28760
	Tue, 10 Jun 1997 15:16:56 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.5+2.7Wbeta5/8.7.3) with ESMTP id PAA28749
	for <ports-jp@jp.freebsd.org>; Tue, 10 Jun 1997 15:16:53 +0900 (JST)
From: itojun@itojun.org
Received: from localhost (itojun@localhost [127.0.0.1]) by itojun.csl.sony.co.jp (8.8.5/3.3W3) with ESMTP id PAA23710 for <ports-jp@jp.freebsd.org>; Tue, 10 Jun 1997 15:16:50 +0900 (JST)
To: ports-jp@jp.freebsd.org
X-Template-Reply-To: itojun@itojun.org
X-Template-Return-Receipt-To: itojun@itojun.org
X-PGP-Fingerprint: F8 24 B4 2C 8C 98 57 FD  90 5F B4 60 79 54 16 E2
X-Mailer: comp (MHng project) version 1997/04/30 02:23:09, by Jun-ichiro Itoh
MIME-Version: 1.0
Content-type: text/plain; charset=iso-2022-jp
Content-transfer-encoding: 7bit
Content-ID: <top.865923403.23702@itojun.csl.sony.co.jp>
Date: Tue, 10 Jun 1997 15:16:44 +0900
Message-ID: <23707.865923404@itojun.csl.sony.co.jp>
Reply-To: ports-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: ports-jp 1136
Subject: [ports-jp 1136] portlint
Errors-To: owner-ports-jp@jp.freebsd.org
Sender: owner-ports-jp@jp.freebsd.org

	$BB?J,4{$KN`;w$N$b$N$,B8:_$9$k$N$G$O$J$$$+$H;W$&$N$G$9$,(B...

	port$B$r$D$/$C$?$H$-$K!"(Bsubmit$B$9$kA0$K4JC1$J%A%'%C%/$r$9$k$?$a$N(B
	$B%9%/%j%W%H$G$9!#$^$@$^$@MDCU$G$9$,!"$b$C$H8-$/$7$F!"$R$H$G$K$h$k(B
	$B%A%'%C%/$r3Z$K$G$-$?$i!"$H;W$$$^$9!#(B
	($B>!<j$K@6=q$7$F$/$l$l$P$b$C$H$h$7(B)

	$B3F(Bport$B$N%G%#%l%/%H%j$K9T$C$F!"(B
	% perl portlint.pl
	$B$r<B9T$7$F$_$F$/$@$5$$!#(B
	$B$"$^$j;n$7$F$$$J$$$N$G(B($B$$$^(BBSD/OS$B%^%7%s$N>e$K$$$^$9(B)$B8f0U8+4?7^!#(B

itojun



#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1997-06-10 15:14 JST by <itojun@itojun.csl.sony.co.jp>.
# Source directory was `/tmp/x'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   5783 -rw-r--r-- portlint.pl
#
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  echo 'WARNING: not restoring timestamps.  Consider getting and'
  echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
# ============= portlint.pl ==============
if test -f 'portlint.pl' && test X"$1" != X"-c"; then
  echo 'x - skipping portlint.pl (file already exists)'
else
  echo 'x - extracting portlint.pl (text)'
  sed 's/^X//' << 'SHAR_EOF' > 'portlint.pl' &&
#
# portlint
#
$err = $warn = 0;
$verbose = 1;
X
#
# check for files.
#
if (! -f 'pkg/PLIST') {
X	print STDERR "FATAL: no pkg/PLIST.";
X	$err++;
}
if (! -f 'pkg/COMMENT') {
X	print STDERR "FATAL: no pkg/COMMENT.";
X	$err++;
} else {
X	&checkcomment;
}
if (! -f 'pkg/DESCR') {
X	print STDERR "FATAL: no pkg/DESCR.";
X	$err++;
} else {
X	&checkdescr;
}
if (! -f 'Makefile') {
X	print STDERR "FATAL: no Makefile.";
X	$err++;
} else {
X	&checkmakefile;
}
X
print STDERR "$err fatal errors and $warn warnings found.\n"
X	if ($err || $warn);
X
exit $err;
X
#
# pkg/COMMENT
#
sub checkcomment {
X	local($linecnt);
X
X	print STDERR "OK: looking into pkg/COMMENT.\n" if ($verbose);
X
X	open(IN, '< pkg/COMMENT');
X	$linecnt = 0;
X	while (<IN>) {
X		$linecnt++;
X		$tmp .= $_;
X	}
X	if ($linecnt != 1 || 80 < length($tmp)) {
X		print STDERR "FATAL: pkg/COMMENT must be one-liner.\n";
X		$err++;
X	}
X	if ($tmp =~ /[\033\200-\377]/) {
X		print STDERR "WARN: pkg/COMMENT includes iso-8859-1, or ";
X		print STDERR "other local characters.  pkg/DESCR should be";
X		print STDERR "plain English file.\n";
X		$warn++;
X	}
X	close(IN);
}
X
#
# pkg/DESCR
#
sub checkdescr {
X	local($linecnt);
X
X	print STDERR "OK: looking into pkg/DESCR.\n" if ($verbose);
X
X	open(IN, '< pkg/DESCR');
X	$linecnt = 0;
X	while (<IN>) {
X		$linecnt++;
X		$tmp .= $_;
X	}
X	if (20 < $linecnt) {
X		print STDERR "WARN: pkg/DESCR exceeds 20 lines, ";
X		print STDERR "could you trim it if possible?.\n";
X		$warn++;
X	}
X	if ($tmp =~ /[\033\200-\377]/) {
X		print STDERR "WARN: pkg/DESCR includes iso-8859-1, or ";
X		print STDERR "other local characters.  pkg/DESCR should be";
X		print STDERR "plain English file.\n";
X		$warn++;
X	}
X	close(IN);
}
X
#
# Makefile
#
sub checkmakefile {
X	print STDERR "OK: looking into Makefile.\n" if ($verbose);
X
X	open(IN, '< Makefile');
X
X	# Makefile 1: comment lines.
X	print STDERR "OK: looking into comment section of Makefile.\n" if ($verbose);
X	@linestocheck = split("\n", <<EOF);
Whom
Version required
Date created
EOF
X	$tmp = '';
X
X	while (<IN>) {
X		last if (!/^#/);
X
X		$tmp .= $_;
X	}
X	if ($_ ne "\n") {
X		print STDERR "WARN: no blank line after the Makefile comment section.\n";
X		$warn++;
X	}
X
X	foreach $i (@linestocheck) {
X		if ($tmp !~ /# $i:[ 	]+\S+/) {
X			print STDERR "FATAL: no <$i> line in Makefile comment section.\n";
X			$err++;
X		}
X	}
X	if ($tmp !~ /# (New )?ports collection makefile for:[ 	]+\S+/) {
X		print STDERR "FATAL: no <ports collection makefile for> ";
X		print STDERR "line in Makefile comment section.\n";
X		$err++;
X	}
X	if ($tmp !~ /#\n# \$Id([^\$]+)\$\n/) {
X		print STDERR "FATAL: no <\$Id\$> line in Makefile comment section.\n";
X		$err++;
X	} else {
X		if ($1 ne '') {
X			print STDERR "WARN: is it a new port? ";
X			print STDERR "if so, make <\$Id\$> tag in comment section empty ";
X			print STDERR "to make CVS happy.\n";
X			$warn++;
X		}
X	}
X
X	# Makefile 2: DISTNAME/PKGNAME/...
X	print STDERR "OK: looking into first section of Makefile. (DISTNAME/...)\n"
X		if ($verbose);
X	$tmp = '';
X	while (<IN>) {
X		last if ($_ eq "\n");
X		next if ($_ =~ /^#/);
X
X		$tmp .= $_;
X	}
X	$tmp =~ s/\\\n//g;
X	if ($tmp !~ /^DISTNAME=/) {
X		print STDERR "FATAL: DISTNAME must come first.\n";
X		$err++;
X	} else {
X		print STDERR "OK: seen DISTNAME.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp =~ /^PKGNAME=/) {
X		print STDERR "OK: seen PKGNAME.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp !~ /^CATEGORIES=/) {
X		print STDERR "FATAL: CATEGORIES must be placed after DISTNAME.";
X		print STDERR "(or after PKGNAME, if there is PKGNAME)\n";
X		$err++;
X	} else {
X		print STDERR "OK: seen CATEGORIES.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp !~ /^MASTER_SITES=/) {
X		print STDERR "FATAL: MASTER_SITES must be placed after CATEGORIES.\n";
X		$err++;
X	} else {
X		print STDERR "OK: seen MASTER_SITES.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp =~ /^MASTER_SITES_SUBDIR=/) {
X		print STDERR "OK: seen MASTER_SITES_SUBDIR.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp =~ /^EXTRACT_SUFX=/) {
X		print STDERR "OK: seen EXTRACT_SUFX.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp =~ /^DISTFILES=/) {
X		print STDERR "OK: seen EXTRACT_SUFX.\n" if ($verbose);
X		$tmp =~ s/^[^\n]+\n//;
X	}
X	if ($tmp ne '') {
X		print STDERR "FATAL: extra item placed in the DISTNAME/... section.\n";
X		$err++;
X	}
X
X	# Makefile 3: PATCH_SITES/PATCHFILES(optional)
X	print STDERR "OK: looking into second section of Makefile, (PATCH*: optinal).\n"
X		if ($verbose);
X	$tmp = '';
X	while (<IN>) {
X		last if ($_ eq "\n");
X		next if ($_ =~ /^#/);
X
X		$tmp .= $_;
X	}
X	$tmp =~ s/\\\n//g;
X	if ($tmp =~ /^MAINTAINER=/) {
X		$alreadyread = $tmp;
X	} else {
X		if ($tmp =~ /^PATCH_SITES=/) {
X			print STDERR "OK: seen PATCH_SITES.\n" if ($verbose);
X			$tmp =~ s/^[^\n]+\n//;
X		}
X		if ($tmp =~ /^PATCHFILES=/) {
X			print STDERR "OK: seen PATCHFILES.\n" if ($verbose);
X			$tmp =~ s/^[^\n]+\n//;
X		}
X	}
X
X	# Makefile 4: MAINTAINER
X	print STDERR "OK: looking into third section of Makefile (MAINTAINER).\n"
X		if ($verbose);
X	if ($alreadyread ne '') {
X		$tmp = $alreadyread;
X	} else {
X		$tmp = '';
X		while (<IN>) {
X			last if ($_ eq "\n");
X			next if ($_ =~ /^#/);
X
X			$tmp .= $_;
X		}
X		$tmp =~ s/\\\n//g;
X	}
X
X	if ($tmp !~ /^MAINTAINER=[^\n]+\n$/) {
X		print STDERR "FATAL: extra item placed in MAINTAINER section.\n";
X		$err++;
X	}
X
X	# Makefile 5: DEPENDS
X	print STDERR "OK: looking into fourth section of Makefile(*_DEPENDS).\n"
X		if ($verbose);
X	@linestocheck = split("\n", <<EOF);
LIB_DEPENDS
BUILD_DEPENDS
RUN_DEPENDS
FETCH_DEPENDS
DEPENDS
EOF
X	$tmp = '';
X	while (<IN>) {
X		last if ($_ eq "\n");
X		next if ($_ =~ /^#/);
X
X		$tmp .= $_;
X	}
X	$tmp =~ s/\\\n//g;
X	foreach $i (@linestocheck) {
X		$tmp =~ s/$i=[^\n]+\n//g;
X	}
X	if ($tmp ne '') {
X		print STDERR "FATAL: extra item placed in *_DEPENDS section.\n";
X		$err++;
X	}
X
X	close(IN);
}
X
SHAR_EOF
  $shar_touch -am 0610151197 'portlint.pl' &&
  chmod 0644 'portlint.pl' ||
  echo 'restore of portlint.pl failed'
  shar_count="`wc -c < 'portlint.pl'`"
  test 5783 -eq "$shar_count" ||
    echo "portlint.pl: original size 5783, current size $shar_count"
fi
exit 0
