|
@@ -29,11 +29,11 @@ use IPC::Open2;
|
|
|
use POSIX qw(strftime);
|
|
|
|
|
|
sub perror($$$$);
|
|
|
-our ($opt_a, $opt_A, $opt_b, $opt_C, $opt_c, $opt_g, $opt_h, $opt_t, $opt_v, $opt_M, $opt_N, $opt_B, $opt_V, @ALLOWED_FULL_PATHS, @MASTERSITES_WHITELIST);
|
|
|
+our ($opt_a, $opt_A, $opt_b, $opt_C, $opt_c, $opt_g, $opt_h, $opt_m, $opt_t, $opt_v, $opt_M, $opt_N, $opt_B, $opt_V, @ALLOWED_FULL_PATHS, @MASTERSITES_WHITELIST);
|
|
|
|
|
|
my ($err, $warn);
|
|
|
my ($extrafile, $parenwarn, $committer, $verbose, $usetabs, $newport,
|
|
|
- $grouperrs);
|
|
|
+ $grouperrs, $checkmfiles);
|
|
|
my $contblank;
|
|
|
my $portdir;
|
|
|
my $makeenv = "";
|
|
@@ -42,6 +42,7 @@ my %errcache = ();
|
|
|
|
|
|
$err = $warn = 0;
|
|
|
$extrafile = $parenwarn = $committer = $verbose = $usetabs = $newport = 0;
|
|
|
+$checkmfiles = 0;
|
|
|
$contblank = 1;
|
|
|
$portdir = '.';
|
|
|
|
|
@@ -98,16 +99,17 @@ my $re_lang_short = '(' . join('|', @lang_short) . ')-';
|
|
|
my ($prog) = ($0 =~ /([^\/]+)$/);
|
|
|
sub usage {
|
|
|
print STDERR <<EOF;
|
|
|
-usage: $prog [-AabCcghvtN] [-M ENV] [-B#] [port_directory]
|
|
|
+usage: $prog [-AabCcghmvtN] [-M ENV] [-B#] [port_directory]
|
|
|
-a additional check for scripts/* and pkg-*
|
|
|
- -A turn on all additional checks (equivalent to -abcNt)
|
|
|
+ -A turn on all additional checks (equivalent to -abcmNt)
|
|
|
-b warn \$(VARIABLE)
|
|
|
- -c committer mode
|
|
|
- -C pedantic committer mode (equivalent to -abct)
|
|
|
+ -c committer mode (implies -m)
|
|
|
+ -C pedantic committer mode (equivalent to -abcmt)
|
|
|
-g group errors together to avoid duplication (disabled if -v is specified)
|
|
|
-h show summary of command line options
|
|
|
-v verbose mode
|
|
|
-t nit pick about use of spaces
|
|
|
+ -m check \${PORTSDIR}/MOVED, UIDs, and GIDs files
|
|
|
-N writing a new port
|
|
|
-V print the version and exit
|
|
|
-M ENV set make variables to ENV (ex. PORTSDIR=/usr/ports.work)
|
|
@@ -121,7 +123,7 @@ sub version {
|
|
|
exit $major;
|
|
|
}
|
|
|
|
|
|
-getopts('AabCcghtvB:M:NV');
|
|
|
+getopts('AabCcghmtvB:M:NV');
|
|
|
|
|
|
&usage if $opt_h;
|
|
|
&version if $opt_V;
|
|
@@ -130,6 +132,7 @@ $parenwarn = 1 if $opt_b || $opt_A || $opt_C;
|
|
|
$committer = 1 if $opt_c || $opt_A || $opt_C;
|
|
|
$verbose = 1 if $opt_v;
|
|
|
$grouperrs = 1 if $opt_g && !$opt_v;
|
|
|
+$checkmfiles = 1 if $opt_m || $opt_c || $opt_A || $opt_C;
|
|
|
$newport = 1 if $opt_N || $opt_A;
|
|
|
$usetabs = 1 if $opt_t || $opt_A || $opt_C;
|
|
|
$contblank = $opt_B if $opt_B;
|
|
@@ -159,6 +162,9 @@ foreach my $i (@osdep) {
|
|
|
# The PORTSDIR environment variable overrides our defaults.
|
|
|
$portsdir = $ENV{PORTSDIR} if ( defined $ENV{'PORTSDIR'} );
|
|
|
$ENV{'PL_CVS_IGNORE'} //= '';
|
|
|
+my $mfile_moved = "${portsdir}/MOVED";
|
|
|
+my $mfile_uids = "${portsdir}/UIDs";
|
|
|
+my $mfile_gids = "${portsdir}/GIDs";
|
|
|
|
|
|
if ($verbose) {
|
|
|
print "OK: config: portsdir: \"$portsdir\" ".
|
|
@@ -288,6 +294,14 @@ if ($extrafile) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+if ($checkmfiles) {
|
|
|
+ foreach my $i ($mfile_moved, $mfile_uids, $mfile_gids) {
|
|
|
+ next if (! -T $i);
|
|
|
+ next if (defined $checker{$i});
|
|
|
+ push(@checker, $i);
|
|
|
+ $checker{$i} = \&checkmfile;
|
|
|
+ }
|
|
|
+}
|
|
|
foreach my $i (<$makevar{PATCHDIR}/patch-*>) {
|
|
|
next if (! -T $i);
|
|
|
next if (defined $checker{$i});
|
|
@@ -1015,7 +1029,62 @@ sub checkplist {
|
|
|
|
|
|
close(IN);
|
|
|
}
|
|
|
+#
|
|
|
+# ${PORTSDIR}/MOVED, UIDs, GIDs files
|
|
|
+#
|
|
|
+sub checkmfile {
|
|
|
+ my ($file) = @_;
|
|
|
+ my $line = 0;
|
|
|
+ my $format;
|
|
|
+ my @entries;
|
|
|
+ my @sorted;
|
|
|
+ my $dosort;
|
|
|
+
|
|
|
+ if ($file =~ m/MOVED$/) {
|
|
|
+ $format = '^[^|]*\|[^|]*\|[^|]*\|[^|]*$';
|
|
|
+ $dosort = 0;
|
|
|
+ } elsif ($file =~ m/UIDs$/) {
|
|
|
+ $format = '^[^:]+:\*:[0-9]+:[0-9]+::0:0:[^:]+:[^:]+:[^:]+$';
|
|
|
+ $dosort = 1;
|
|
|
+ } elsif ($file =~ m/GIDs$/) {
|
|
|
+ $format = '^[^:]+:\*:[0-9]+:[^:]*$';
|
|
|
+ $dosort = 1;
|
|
|
+ } else {
|
|
|
+ &perror("FATAL", $file, -1, "Internal error. ".
|
|
|
+ "Invalid name for mfiles.");
|
|
|
+ }
|
|
|
|
|
|
+ open(IN, "<$file") || return 0;
|
|
|
+ while (<IN>) {
|
|
|
+ chomp;
|
|
|
+ $line++;
|
|
|
+ next if (m,^\s*#,);
|
|
|
+
|
|
|
+ if (!m,${format},) {
|
|
|
+ &perror("FATAL", $file, -1,
|
|
|
+ "malformed line at ".
|
|
|
+ "${line}.\n => $_");
|
|
|
+ } else {
|
|
|
+ push @entries, "$line:$_";
|
|
|
+ next;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($dosort) {
|
|
|
+ my $errline;
|
|
|
+ @sorted = sort {(split /:/, $a)[3] <=> (split /:/, $b)[3] } @entries;
|
|
|
+
|
|
|
+ for (my $n = 0; $n < @entries; $n++) {
|
|
|
+ if (!defined($sorted[$n]) or
|
|
|
+ $entries[$n] ne $sorted[$n]) {
|
|
|
+ ($line, $errline) = ($entries[$n] =~ m/([0-9]+):(.*)/);
|
|
|
+ &perror("WARN", $file, -1,
|
|
|
+ "malformed sorting order at " .
|
|
|
+ "${line}.\n => $errline");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ close(IN);
|
|
|
+}
|
|
|
#
|
|
|
# misc files
|
|
|
#
|