summaryrefslogtreecommitdiffstats
path: root/ports-mgmt
diff options
context:
space:
mode:
authorknu <knu@FreeBSD.org>2001-03-20 20:54:24 +0000
committerknu <knu@FreeBSD.org>2001-03-20 20:54:24 +0000
commitab84f9c497ce3a435c1db87fa7c702bd8e320a90 (patch)
tree5fef286715546810023314330d4ff98b40944f9e /ports-mgmt
parentf739481409e72e62084035208f78e074a51282de (diff)
downloadFreeBSD-ports-ab84f9c497ce3a435c1db87fa7c702bd8e320a90.zip
FreeBSD-ports-ab84f9c497ce3a435c1db87fa7c702bd8e320a90.tar.gz
Bring in the enhancements I submitted to mharo some time ago and bump
the version to 2.3.2. - Add checks for empty files, empty directories, core files, more possible backup files, dotfiles, symlinks and CVS directories. - Do not assume PATCHDIR always includes "/files/". Use the best method to check whether a file is added to @checker as a patch file. - Some trivial message style fixes.
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/portlint/Makefile2
-rw-r--r--ports-mgmt/portlint/src/portlint.pl63
2 files changed, 48 insertions, 17 deletions
diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile
index fc78e9d..92bc56f 100644
--- a/ports-mgmt/portlint/Makefile
+++ b/ports-mgmt/portlint/Makefile
@@ -8,7 +8,7 @@
#
PORTNAME= portlint
-PORTVERSION= 2.3.1
+PORTVERSION= 2.3.2
CATEGORIES= devel
MASTER_SITES= # none
DISTFILES= # none
diff --git a/ports-mgmt/portlint/src/portlint.pl b/ports-mgmt/portlint/src/portlint.pl
index a72f344..d40afa0 100644
--- a/ports-mgmt/portlint/src/portlint.pl
+++ b/ports-mgmt/portlint/src/portlint.pl
@@ -22,6 +22,7 @@
use vars qw/ $opt_a $opt_b $opt_c $opt_h $opt_t $opt_v $opt_M $opt_N $opt_B $opt_V /;
use Getopt::Std;
+use File::Find;
use IPC::Open2;
#use strict;
@@ -275,26 +276,56 @@ foreach my $i (@checker) {
} else {
my $proc = $checker{$i};
&$proc($i) || &perror("Cannot open the file $i\n");
- if ($i !~ m@/files/patch-@) {
+ if ($proc ne 'checkpatch') {
&checklastline($i)
|| &perror("Cannot open the file $i\n");
}
}
}
if ($committer) {
- if (scalar(@_ = <work/*>) || -d "work") {
- &perror("FATAL: be sure to cleanup $portdir/work ".
- "before committing the port.");
- }
- if (scalar(@_ = <*/*~>) || scalar(@_ = <*~>)) {
- &perror("FATAL: for safety, be sure to cleanup ".
- "editor backup files before committing the port.");
- }
- if (scalar(@_ = <*/*.orig>) || scalar(@_ = </*.orig>)
- || scalar(@_ = <*/*.rej>) || scalar(@_ = <*.rej>)) {
- &perror("FATAL: for safety, be sure to cleanup ".
- "patch backup files before committing the port.");
+ sub find_proc {
+ return if /^\.\.?$/;
+
+ (my $fullname = $File::Find::name) =~ s#^\./##;
+
+ print "OK: checking the file name of $fullname.\n" if ($verbose);
+
+ if ($fullname eq 'work') {
+ &perror("FATAL: $fullname: be sure to cleanup the working directory ".
+ "before committing the port.");
+
+ $File::Find::prune = 1;
+ } elsif (-l) {
+ &perror("Warning: $fullname: this is a symlink. ".
+ "CVS will ignore it.");
+ } elsif (-z) {
+ &perror("FATAL: $fullname: empty file and should be removed. ".
+ "If it still needs to be there, put a dummy comment ".
+ "to state that the file is intentionally left empty.");
+ $problem = 1;
+ } elsif (-d && scalar(@x = <$_/{*,.?*}>) <= 1) {
+ &perror("FATAL: $fullname: empty directory should be removed.");
+ } elsif (/^\./) {
+ &perror("Warning: $fullname: dotfiles are not preferred. ".
+ "If this file is a dotfile to be installed as an example, ".
+ "consider importing it as \"dot$_\".");
+ } elsif (/\.(orig|rej|bak)$/ || /~$/ || /^\#/) {
+ &perror("FATAL: $fullname: for safety, be sure to cleanup ".
+ "backup files before committing the port.");
+ } elsif (/(^|\.)core$/) {
+ &perror("FATAL: $fullname: for safety, be sure to cleanup ".
+ "core files before committing the port.");
+ } elsif ($_ eq 'CVS' && -d) {
+ if ($newport) {
+ &perror("FATAL: $fullname: for safety, be sure to cleanup ".
+ "CVS directories before importing the new port.");
+ }
+
+ $File::Find::prune = 1;
+ }
}
+
+ find(\&find_proc, '.');
}
if ($err || $warn) {
print "$err fatal errors and $warn warnings found.\n"
@@ -899,7 +930,7 @@ EOF
#
# section 2: PORTNAME/PORTVERSION/...
#
- print "OK: checking first section of $file. (PORTNAME/...)\n"
+ print "OK: checking first section of $file (PORTNAME/...).\n"
if ($verbose);
$tmp = $sections[$idx++];
@@ -1123,7 +1154,7 @@ DISTFILES EXTRACT_ONLY
#
# section 3: PATCH_SITES/PATCHFILES(optional)
#
- print "OK: checking second section of $file, (PATCH*: optinal).\n"
+ print "OK: checking second section of $file (PATCH*: optinal).\n"
if ($verbose);
$tmp = $sections[$idx];
@@ -1179,7 +1210,7 @@ PATCH_SITES PATCHFILES PATCH_DIST_STRIP
#
# section 5: *_DEPENDS (may not be there)
#
- print "OK: checking fourth section of $file(*_DEPENDS).\n"
+ print "OK: checking fourth section of $file (*_DEPENDS).\n"
if ($verbose);
$tmp = $sections[$idx];
OpenPOWER on IntegriCloud