From 8cc059a92085f99e59f1386338bdbb8f16716d9d Mon Sep 17 00:00:00 2001 From: wiz Date: Thu, 8 Mar 2001 10:14:49 +0000 Subject: [PATCH] Update pkglint to 2.40. Now handles the digests other than md5. Expands variables in ${PKGNAME}; doesn't check Makefile comments or COMMENTs for use of reserved words; and some minor cleanup. (Removes ~100 bogus warnings from lintpkgsrc -l). --- pkgtools/pkglint/Makefile | 4 +- pkgtools/pkglint/files/pkglint.pl | 72 ++++++++++++++++++------------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index 16a3acc4f466..3cfc333b9ed4 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.81 2001/02/25 05:20:02 hubertf Exp $ +# $NetBSD: Makefile,v 1.82 2001/03/08 10:14:49 wiz Exp $ # -DISTNAME= pkglint-2.39 +DISTNAME= pkglint-2.40 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 1fe3c0911e58..340a08bff530 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -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.41 2001/02/25 05:20:02 hubertf Exp $ +# $NetBSD: pkglint.pl,v 1.42 2001/03/08 10:14:50 wiz Exp $ # # This version contains some changes necessary for NetBSD packages # done by Hubert Feyrer , @@ -204,11 +204,11 @@ if (-f "$portdir/$patchsumfile") { &perror("WARN: no $portdir/$patchsumfile file. Please run 'make makepatchsum'."); } } -if (-e <$portdir/$md5file>) { - $i = "$md5file"; +if (-e <$portdir/$digestfile>) { + $i = "$digestfile"; next if (defined $checker{$i}); push(@checker, $i); - $checker{$i} = 'checkmd5'; + $checker{$i} = 'checkdigest'; } foreach $i (@checker) { print "OK: checking $i.\n"; @@ -217,19 +217,19 @@ foreach $i (@checker) { } else { $proc = $checker{$i}; &$proc($i) || &perror("WARN: Cannot open the file $i\n"); - if ($i !~ /^patches\//) { + if ($i !~ /patches\/patch/) { &checklastline($i) || &perror("WARN: Cannot open the file $i\n"); } } } -if (-e <$portdir/$md5file> ) { +if (-e <$portdir/$digestfile> ) { if ( $seen_NO_CHECKSUM ) { - &perror("WARN: NO_CHECKSUM set, but $portdir/$md5file exists. Please remove it."); + &perror("WARN: NO_CHECKSUM set, but $portdir/$digestfile exists. Please remove it."); } } else { if ( ! $seen_NO_CHECKSUM ) { - &perror("WARN: no $portdir/$md5file file. Please run 'make makesum'."); + &perror("WARN: no $portdir/$digestfile file. Please run 'make makesum'."); } } if (-e <$pkgdir/COMMENT> ) { @@ -309,9 +309,10 @@ sub checkpatchsum { open(SUM,"<$portdir/$file") || return 0; while() { - next if !/^MD5 \(([^)]+)\) = (.*)$/; - $patch=$1; - $sum=$2; + next if !/^(MD5|SHA1|RMD160) \(([^)]+)\) = (.*)$/; + $alg=$1; + $patch=$2; + $sum=$3; # bitch about *~ if ($patch =~ /~$/) { @@ -319,7 +320,7 @@ sub checkpatchsum { } if (-T "$portdir/$patchdir/$patch") { - $calcsum=`sed -e '/\$NetBSD.*/d' $portdir/$patchdir/$patch | md5`; + $calcsum=`sed -e '/\$NetBSD.*/d' $portdir/$patchdir/$patch | digest $alg`; chomp($calcsum); if ( "$sum" ne "$calcsum" ) { &perror("FATAL: checksum of $patch differs between $portdir/$file and\n" @@ -570,7 +571,7 @@ sub checkpatch { close(IN); } -sub checkmd5 { +sub checkdigest { local($file) = @_; local($rcsidseen) = 0; @@ -580,7 +581,7 @@ sub checkmd5 { } if (!$rcsidseen) { &perror("FATAL: RCS tag \"\$$rcsidstr\$\" must be present ". - "in md5 $file.") + "in digest $file.") } close(IN); } @@ -685,10 +686,10 @@ sub checkmakefile { # # whole file: get FILESDIR, PATCHDIR, PKGDIR, SCRIPTDIR, - # PATCH_SUM_FILE and MD5_FILE + # PATCH_SUM_FILE and DIGEST_FILE # print "OK: checking for PATCHDIR, SCRIPTDIR, FILESDIR, PKGDIR,". - " MD5_FILE.\n" if ($verbose); + " DIGEST_FILE.\n" if ($verbose); $filesdir = "files"; $filesdir = $1 if ($whole =~ /\nFILESDIR[+?]?=[ \t]*([^\n]+)\n/); @@ -706,16 +707,17 @@ sub checkmakefile { $scriptdir = $1 if ($whole =~ /\nSCRIPTDIR[+?]?=[ \t]*([^\n]+)\n/); $scriptdir =~ s/\$\{.CURDIR\}/./; - $md5file = "$filesdir/md5"; - $md5file = $1 if ($whole =~ /\nMD5_FILE[+?]?=[ \t]*([^\n]+)\n/); - $md5file =~ s/\$\{.CURDIR\}/./; + $digestfile = "$filesdir/md5"; + $digestfile = $1 if ($whole =~ /\nDIGEST_FILE[+?]?=[ \t]*([^\n]+)\n/); + $digestfile =~ s/\$\{.CURDIR\}/./; $patchsumfile = "$filesdir/patch-sum"; $patchsumfile = $1 if ($whole =~ /\nPATCH_SUM_FILE[+?]?=[ \t]*([^\n]+)\n/); $patchsumfile =~ s/\$\{.CURDIR\}/./; print("OK: PATCHDIR: $patchdir, SCRIPTDIR: $scriptdir, ". - "FILESDIR: $filesdir, PKGDIR: $pkgdir, MD5_FILE: $md5file, ". + "FILESDIR: $filesdir, PKGDIR: $pkgdir, ". + "DIGEST_FILE: $digestfile, ". "PATCH_SUM_FILE: $patchsumfile\n") if ($verbose); # @@ -760,6 +762,11 @@ sub checkmakefile { &perror("FATAL: LIBTOOL_OVERRIDE is deprecated, ". "try to use LTCONFIG_OVERRIDE instead."); } + print "OK: checking MD5_FILE.\n" if ($verbose); + if ($whole =~ /\nMD5_FILE/) { + &perror("FATAL: MD5_FILE is deprecated, ". + "use DIGEST_FILE instead."); + } print "OK: checking MIRROR_DISTFILE.\n" if ($verbose); if ($whole =~ /\nMIRROR_DISTFILE/) { &perror("WARN: use of MIRROR_DISTFILE deprecated, ". @@ -772,8 +779,8 @@ sub checkmakefile { } print "OK: checking NO_PACKAGE.\n" if ($verbose); if ($whole =~ /\nNO_PACKAGE/) { - &perror("WARN: use of NO_PACKAGE to enforce license restrictions ". - "is deprecated."); + &perror("WARN: use of NO_PACKAGE to enforce license ". + "restrictions is deprecated."); } print "OK: checking for MKDIR.\n" if ($verbose); if ($whole =~ m|\${MKDIR}.*(\${PREFIX}[/0-9a-zA-Z\${}]*)|) { @@ -799,7 +806,7 @@ sub checkmakefile { # print "OK: checking direct use of command names.\n" if ($verbose); foreach $i (split(/\s+/, <