Date: Mon, 24 Dec 2012 22:37:53 +0000 (GMT) From: Chris Rees <crees@bayofrum.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/174688: [PATCH] ports-mgmt/portlint Check the Makefile header Message-ID: <20121224223753.F19321B672@pegasus.bayofrum.net> Resent-Message-ID: <201212242240.qBOMe25I097205@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 174688 >Category: ports >Synopsis: [PATCH] ports-mgmt/portlint Check the Makefile header >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Dec 24 22:40:02 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Chris Rees >Release: FreeBSD 9.0-RELEASE amd64 >Organization: >Environment: System: FreeBSD pegasus.bayofrum.net 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Sun Apr 29 12:29:02 BST 2012 root@pegasus.bayofrum.net:/usr/obj/usr/src/sys/PEGASUS amd64 >Description: This will make portlint accept only # Created by: followed by a space as an optional line, then # $FreeBSD$ in the Makefile, which should work as a check to avoid unneccessary churn when people correct mistakes. >How-To-Repeat: >Fix: It's not very elegant, but it works. --- portlint-header.diff begins here --- Index: Makefile =================================================================== --- Makefile (revision 309465) +++ Makefile (working copy) @@ -6,7 +6,7 @@ # PORTNAME= portlint -PORTVERSION= 2.13.13 +PORTVERSION= 2.13.14 CATEGORIES= ports-mgmt MASTER_SITES= # none DISTFILES= # none Index: src/portlint.pl =================================================================== --- src/portlint.pl (revision 309465) +++ src/portlint.pl (working copy) @@ -1460,6 +1460,26 @@ } # + # whole file: header + # + my @lines = split("\n", $whole); + print "OK: checking header in $file.\n" if ($verbose); + if ($lines[1] =~ /^# (?:New )?[Pp]orts collection [mM]akefile/) { + &perror("FATAL", $file, 1, "old style headers found."); + } elsif ($lines[1] =~ /^# Created by: \S/) { + if ($lines[2] !~ /^# \$$rcsidstr[:\$]/) { + &perror("FATAL", $file, 2, "header should be ". + "followed by \$$rcsidstr\$."); + } elsif ($lines[3] !~ /^$/) { + &perror("FATAL", $file, 3, "do not add extra ". + "empty comments after header."); + } + } elsif ($lines[1] !~ /^# \$$rcsidstr[:\$]/ or $lines[2] !~ /^$/) { + &perror("FATAL", $file, 1, "incorrect header; ". + "use Created by: with a space, then \$$rcsidstr\$."); + } + + # # whole file: $(VARIABLE) # if ($parenwarn) { --- portlint-header.diff ends here --- -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121224223753.F19321B672>