ports/96923: [patch] devel/portlint lacks distinfo file check
Sergey Matveychuk
sem at FreeBSD.org
Sun May 7 16:20:17 UTC 2006
>Number: 96923
>Category: ports
>Synopsis: [patch] devel/portlint lacks distinfo file check
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sun May 07 16:20:16 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Sergey Matveychuk
>Release: FreeBSD 7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD solem.sem-home.ciam.ru 7.0-CURRENT FreeBSD 7.0-CURRENT #33: Sat Apr 29 14:09:38 MSD 2006 root at solem.sem-home.ciam.ru:/usr/obj/usr/src/sys/SOLEM i386
>Description:
portlint does not checks distinfo file.
The patch add the feature to portlint.
I've tested it running portlint on all ports tree.
There are a couple things I'm not sure:
1) May be warning of IGNOREFILES should be moved in other place?
2) Syntax of FATAL and WARN message. Check it please.
>How-To-Repeat:
>Fix:
--- portlint.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/devel/portlint/Makefile,v
retrieving revision 1.108
diff -u -r1.108 Makefile
--- Makefile 7 Apr 2006 00:08:00 -0000 1.108
+++ Makefile 7 May 2006 12:42:07 -0000
@@ -8,7 +8,7 @@
#
PORTNAME= portlint
-PORTVERSION= 2.8.7
+PORTVERSION= 2.8.8
CATEGORIES= devel
MASTER_SITES= # none
DISTFILES= # none
Index: src/portlint.pl
===================================================================
RCS file: /home/pcvs/ports/devel/portlint/src/portlint.pl,v
retrieving revision 1.88
diff -u -r1.88 portlint.pl
--- src/portlint.pl 12 Mar 2006 19:19:43 -0000 1.88
+++ src/portlint.pl 7 May 2006 12:42:08 -0000
@@ -177,6 +177,7 @@
PKGREQ PKGMESSAGE MD5_FILE .CURDIR INSTALLS_SHLIB USE_AUTOTOOLS
INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION PKGINSTALLVER
PLIST_FILES OPTIONS INSTALLS_OMF USE_GETTEXT USE_RC_SUBR
+ DIST_SUBDIR ALLFILES IGNOREFILES CHECKSUM_ALGORITHMS
);
my $cmd = join(' -V ', "make $makeenv MASTER_SITE_BACKUP=''", @varlist);
@@ -257,7 +258,7 @@
my %checker = (
$makevar{DESCR} => \&checkdescr,
'Makefile' => \&checkmakefile,
- $makevar{MD5_FILE} => \&TRUE
+ $makevar{MD5_FILE} => \&checkdistinfo
);
if ($extrafile) {
my @files = (
@@ -502,6 +503,74 @@
exit $err;
#
+# distinfo
+#
+sub checkdistinfo {
+ my($file) = @_;
+ my($dist_subdir) = $makevar{DIST_SUBDIR};
+ my(@allfiles) = split (/\s+/, $makevar{ALLFILES});
+ my %ignorefiles = ();
+ my %algorithms = ();
+ my %records = ();
+
+ foreach my $i (split (/\s+/, $makevar{IGNOREFILES})) {
+ $ignorefiles{$i} = 1;
+ }
+ foreach my $i (split (/\s+/, uc ($makevar{CHECKSUM_ALGORITHMS}))) {
+ $algorithms{$i} = 1;
+ }
+
+ if (scalar (%ignorefiles)) {
+ &perror("WARN: Found IGNOREFILES. It's not recomended.");
+ }
+
+ open(IN, "< $file") || return 0;
+ while (<IN>) {
+ if (/^\s*$/) {
+ &perror("FATAL: $file [$.]: a blank line.");
+ next;
+ }
+ m/(\S+)\s+\((\S+)\)\s+=\s+(\S+)/;
+
+ if ($1 ne "" && $2 ne "" && $3 ne "") {
+ my ($tag, $path, $value) = ($1, $2, $3);
+ $records{$path}{$tag} = $value;
+
+ if (!$algorithms{$tag} && $tag ne "SIZE") {
+ &perror("FATAL: $file [$.]: unsupported checksum algorithm found: $tag.");
+ }
+ } else {
+ &perror("FATAL: $file [$.]: line format error.");
+ }
+ }
+ close(IN);
+
+ # For all files check SIZE and checksums
+ foreach my $f (@allfiles) {
+ # Remove hindering chars from DISTNAME
+ $f =~ s/['\\]//g;
+
+ my $path = $f;
+ $path = "$dist_subdir/$f" if $dist_subdir;
+ if (!defined($records{$path}{SIZE}) && !$ignorefiles{$f}) {
+ &perror("FATAL: $file has no SIZE record for $path.");
+ }
+ my $n = 0;
+ foreach my $alg (keys %algorithms) {
+ $n++ if exists($records{$path}{$alg});
+ }
+ if ($n == 0) {
+ &perror("FATAL: $file has no checksum record for $path.");
+ }
+ if ($n < scalar(keys %algorithms)) {
+ &perror("WARN: $file has checksum records not for all supported ".
+ "algorithms (".join(" ",keys %algorithms).") for $path.");
+ }
+ }
+ return 1;
+}
+
+#
# pkg-descr
#
sub checkdescr {
--- portlint.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list