diff --git a/core/lib/Foswiki/Contrib/core/MANIFEST b/core/lib/Foswiki/Contrib/core/MANIFEST index 370fc6f031..a28f3180a9 100644 --- a/core/lib/Foswiki/Contrib/core/MANIFEST +++ b/core/lib/Foswiki/Contrib/core/MANIFEST @@ -818,6 +818,11 @@ lib/Foswiki/Store/VC/Handler.pm 0444 lib/Foswiki/Store/VC/RcsLiteHandler.pm 0444 lib/Foswiki/Store/VC/RcsWrapHandler.pm 0444 lib/Foswiki/Store/VC/Store.pm 0444 +lib/Foswiki/Tables/Cell.pm 0444 +lib/Foswiki/Tables/Parser.pm 0444 +lib/Foswiki/Tables/Reader.pm 0444 +lib/Foswiki/Tables/Row.pm 0444 +lib/Foswiki/Tables/Table.pm 0444 lib/Foswiki/Templates.pm 0444 lib/Foswiki/Time.pm 0444 lib/Foswiki/UI.pm 0444 diff --git a/core/tools/check_manifest.pl b/core/tools/check_manifest.pl index 5fc8a59a58..2900fd079b 100755 --- a/core/tools/check_manifest.pl +++ b/core/tools/check_manifest.pl @@ -1,64 +1,164 @@ -#! /usr/bin/perl +#! /usr/bin/env perl use strict; +use warnings; # cruise back up the tree until we find lib and data subdirs -require Cwd; +use Cwd; +use File::Spec; use File::Find; -my $manifest = 'MANIFEST'; +my $manifest = shift || 'MANIFEST'; +my @skip = + qw(tools/develop tools/githooks tools/pkg tools/benchmark tools/distro test working logs MANIFEST DEPENDENCIES build\.pl PREINSTALL TIDY .*?\.psd .*?\.xcf \.gitignore); +my $cvs = 'subversion'; +my $skipPattern = join( '|', @skip ); -#unless (-f $manifest) { -# File::Find::find( sub { /^MANIFEST\z/ && ( $manifest = $File::Find::name ) -# }, "$root/lib/TWiki" ); -#} -die "No such MANIFEST $manifest" unless -e $manifest; +#print "SKIPPING $skipPattern\n"; +my @lost; # Files on disk not in MANIFEST +my %man; # Hash of MANIFEST content: file => perm +my %alt; # Hash of alternate version of _src file +my $checkperm = 0; +my @manfiles; -my %man; +# Search the current working directory and its parents +# for a directory called like the first parameter +sub findPathToDir { + my $lookForDir = shift; -open MAN, '<', $manifest or die "Can't open $manifest for reading: $!"; -while () { - next if /^!include/; - $man{$1} = 1 if /^(\S+)\s+\d+.*$/; + my @dirlist = File::Spec->splitdir( Cwd::getcwd() ); + do { + my $dir = File::Spec->catdir( @dirlist, $lookForDir ); + return File::Spec->catdir(@dirlist) if -d $dir; + } while ( pop @dirlist ); + return; } -close MAN; -my @cwd = split( /[\/\\]/, Cwd::getcwd() ); -my $root; +# Checks if a file is in the MANIFEST, and removes it +# otherwise, adds it to @lost +sub isFileInManifest { + my ( $root, $file ) = @_; + + my $diskfile = "$root/$file"; + return if -d $diskfile; # For Subversion + if ( my $mode = delete $man{$file} ) { + my $cmode = ( stat($diskfile) )[2] & 07777; + printf "Permissions for $file differ" + . " in MANIFEST ($mode) and on disk (%lo)\n", $cmode + if ( $checkperm && oct( 0 + $mode ) != $cmode ); + } + else { + return if $file =~ m#^(?:$skipPattern)/#; # For git + #print "Checking ($file) against #/(?:$skipPattern)\$# \n"; + return if $file =~ m#(?:^|/)(?:$skipPattern)$#; # For git + return if $file =~ m#/TestCases/#; + push @lost, $file; + } -while ( scalar(@cwd) > 1 ) { - $root = join( '/', @cwd ); - if ( -d "$root/lib" && -d "$root/data" ) { - last; + # Try to save file alternate versions, just in case + $alt{"$file.gz"}++; + if ( $file =~ /^(.*)_src(\..*)$/ ) { + $alt{"$1$2"}++; + $alt{"$1$2.gz"}++; + } + if ( $file =~ /^(.*)\.uncompressed(\..*)$/ ) { + $alt{"$1$2"}++; + $alt{"$1$2.gz"}++; } - pop(@cwd); } -die "Can't find root" unless ( -d "$root/lib" && -d "$root/data" ); +# Prints some "helpful" messages +sub help { + print <<"END"; +Run this script from a directory with a MANIFEST file, or from a top level of +an extension, or from within an extension, passing the path of the MANIFEST as +first parameter. -my @skip = qw(tools test working logs); -print <catdir( $root, 'lib' ) + ); +} +die "No such MANIFEST $manifest" unless -e $manifest; + +#foreach my $mf ( @manfiles ) { +# print " .. FOUND $mf \n"; +# } + +open my $man, '<', $manifest or die "Can't open $manifest for reading: $!"; +print "Processing manifest $manifest\n"; +while (<$man>) { + next if /^!include/; + $man{$1} = $2 if /^#?(\S+)\s+(\d+)/; +} +close $man; + +if ( my $gitdir = findPathToDir('.git') ) { + $cvs = 'git'; + + #help($cvs); + for my $file ( split /\n/, qx{cd $root && git ls-files} ) { + $file =~ s#^$root/##; # Should never happen, but safer + $file =~ s#^(?:\.\./)*##; # If checking not from top level + isFileInManifest( $root => $file ); + } +} +else { + help($cvs); + foreach my $dir ( + grep { -d "$root/$_" } + split( /\n/, `svn ls $root` ) + ) + { + next if $dir =~ m#/(?:$skipPattern)/#o; + print "Examining $root/$dir\n"; + for my $file ( + map { "$dir$_" } + split( /\n/, `svn ls -R $root/$dir` ) + ) + { + isFileInManifest( $root => $file ); + } + } } -print "The following files were found in subversion, but are not in MANIFEST\n"; -print join( "\n", @lost ), "\n"; + +if (@lost) { + my $lost = scalar @lost; + print "The following $lost file" + . ( $lost > 1 ? 's' : '' ) + . " files were found in $cvs, but are not in MANIFEST:\n"; + print join( "\n", @lost, '' ); +} + +#else { +# print "All files in MANIFEST are checked in.\n"; +#} +my @found = sort grep { !delete $alt{$_} } keys %man; +if (@found) { + my $found = scalar @found; + print "The following $found file" + . ( $found > 1 ? 's' : '' ) + . " were found in MANIFEST, but not in $cvs:\n"; + print join( "\n", @found, '' ); +} + +#else { +# print "All files in MANIFEST are in $cvs.\n"; +#} diff --git a/core/tools/check_manifests.sh b/core/tools/check_manifests.sh new file mode 100644 index 0000000000..bbf53ef2af --- /dev/null +++ b/core/tools/check_manifests.sh @@ -0,0 +1,25 @@ +perl tools/check_manifest.pl +cd ../AutoViewTemplatePlugin && perl ../core/tools/check_manifest.pl +cd ../CompareRevisionsAddOn && perl ../core/tools/check_manifest.pl +cd ../CommentPlugin && perl ../core/tools/check_manifest.pl +cd ../EditTablePlugin && perl ../core/tools/check_manifest.pl +cd ../EmptyPlugin && perl ../core/tools/check_manifest.pl +cd ../FamFamFamContrib && perl ../core/tools/check_manifest.pl +cd ../HistoryPlugin && perl ../core/tools/check_manifest.pl +cd ../InterwikiPlugin && perl ../core/tools/check_manifest.pl +cd ../JSCalendarContrib && perl ../core/tools/check_manifest.pl +cd ../JQueryPlugin && perl ../core/tools/check_manifest.pl +cd ../MailerContrib && perl ../core/tools/check_manifest.pl +cd ../PatternSkin && perl ../core/tools/check_manifest.pl +cd ../PreferencesPlugin && perl ../core/tools/check_manifest.pl +cd ../RenderListPlugin && perl ../core/tools/check_manifest.pl +cd ../SlideShowPlugin && perl ../core/tools/check_manifest.pl +cd ../SmiliesPlugin && perl ../core/tools/check_manifest.pl +cd ../SpreadSheetPlugin && perl ../core/tools/check_manifest.pl +cd ../TablePlugin && perl ../core/tools/check_manifest.pl +cd ../TinyMCEPlugin && perl ../core/tools/check_manifest.pl +cd ../TipsContrib && perl ../core/tools/check_manifest.pl +cd ../TopicUserMappingContrib && perl ../core/tools/check_manifest.pl +cd ../TWikiCompatibilityPlugin && perl ../core/tools/check_manifest.pl +cd ../TwistyPlugin && perl ../core/tools/check_manifest.pl +cd ../WysiwygPlugin && perl ../core/tools/check_manifest.pl