ports/104042: [patch] devel/portlint: check format of EXPIRATION_DATE
Vasil Dimov
vd at FreeBSD.org
Fri Oct 6 08:50:26 UTC 2006
>Number: 104042
>Category: ports
>Synopsis: [patch] devel/portlint: check format of EXPIRATION_DATE
>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: Fri Oct 06 08:50:22 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Vasil Dimov
>Release: FreeBSD 6.2-PRERELEASE amd64
>Organization:
N/A
>Environment:
>Description:
According to
http://www.FreeBSD.org/doc/en/books/porters-handbook/dads-deprecated.html
EXPIRATION_DATE format should be YYYY-MM-DD.
Add check for this to portlint.
>How-To-Repeat:
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/cscout-devel/Makefile.diff?r1=1.4&r2=1.5
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw/Makefile.diff?r1=1.6&r2=1.7
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-bin-msvcrt/Makefile.diff?r1=1.8&r2=1.9
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-binutils/Makefile.diff?r1=1.18&r2=1.19
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-gcc/Makefile.diff?r1=1.24&r2=1.25
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-opengl-headers/Makefile.diff?r1=1.7&r2=1.8
>Fix:
Here are two patches addressing the same issue, the first one was
crafted by dds@ and the second one (a little changed version of the
first one) by vd@
--- portlint.pl.diff begins here ---
Index: portlint.pl
===================================================================
RCS file: /home/pcvs/ports/devel/portlint/src/portlint.pl,v
retrieving revision 1.91
diff -u -r1.91 portlint.pl
--- portlint.pl 6 Aug 2006 22:36:45 -0000 1.91
+++ portlint.pl 3 Oct 2006 13:37:43 -0000
@@ -1338,6 +1338,20 @@
}
#
+ # whole file: EXPIRATION_DATE
+ #
+ print "OK: checking for EXPIRATION_DATE.\n" if ($verbose);
+ my $date;
+ if (($date) = ($whole =~ m/\nEXPIRATION_DATE\??=[ \t]*([^\n]*)\n/)) {
+ my $lineno = &linenumber($`);
+ if ($date !~ m/(\d{4})-(\d{2})-(\d{2})/) {
+ &perror("FATAL", $file, $lineno, "EXPIRATION_DATE is not in YYYY-MM-DD format.");
+ } elsif ($1 < 1970 || $2 < 1 || $2 > 12 || $3 < 1 || $3 > 31) {
+ &perror("FATAL", $file, $lineno, "EXPIRATION_DATE has an incorrect year, month, or day value.");
+ }
+ }
+
+ #
# whole file: IS_INTERACTIVE/NOPORTDOCS
#
print "OK: checking IS_INTERACTIVE.\n" if ($verbose);
--- portlint.pl.diff ends here ---
--- portlint.pl_strftime.diff begins here ---
Index: portlint.pl
===================================================================
RCS file: /home/pcvs/ports/devel/portlint/src/portlint.pl,v
retrieving revision 1.91
diff -u -r1.91 portlint.pl
--- portlint.pl 6 Aug 2006 22:36:45 -0000 1.91
+++ portlint.pl 6 Oct 2006 08:17:05 -0000
@@ -24,6 +24,7 @@
use Getopt::Std;
use File::Find;
use IPC::Open2;
+use POSIX qw(strftime);
use strict;
sub perror($$$$);
@@ -1338,6 +1339,21 @@
}
#
+ # whole file: EXPIRATION_DATE
+ #
+ print "OK: checking for EXPIRATION_DATE.\n" if ($verbose);
+ my $date;
+ if (($date) = ($whole =~ m/\nEXPIRATION_DATE\??=[ \t]*([^\n]*)\n/)) {
+ my $lineno = &linenumber($`);
+ if ($date ne strftime("%Y-%m-%d", 0, 0, 0,
+ substr($date, 8, 2),
+ substr($date, 5, 2) - 1,
+ substr($date, 0, 4) - 1900)) {
+ &perror("FATAL", $file, $lineno, "EXPIRATION_DATE ($date) is not in YYYY-MM-DD format.");
+ }
+ }
+
+ #
# whole file: IS_INTERACTIVE/NOPORTDOCS
#
print "OK: checking IS_INTERACTIVE.\n" if ($verbose);
--- portlint.pl_strftime.diff ends here ---
--
Vasil Dimov
gro.DSBeerF at dv
%
The man who sets out to carry a cat by its tail learns something that
will always be useful and which never will grow dim or doubtful.
-- Mark Twain
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list