In perl.git, the branch smoke-me/nicholas/regen has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/cf792e5bc7ff1bb6401cc97117501dee219f2930?hp=d2252d8f0bf2fd28d344e1ffb25b48d19dee46ff>

- Log -----------------------------------------------------------------
commit cf792e5bc7ff1bb6401cc97117501dee219f2930
Author: Nicholas Clark <[email protected]>
Date:   Sat Jul 20 14:08:41 2013 +0200

    Remove 3 redundant lines from .gitignore
    
    These test files are no longer generated in directories beneath lib/

M       .gitignore

commit a3684bcf3210372d28da930d361ec4129557b0fc
Author: Nicholas Clark <[email protected]>
Date:   Sat Jul 20 12:50:21 2013 +0200

    Generate lib/.gitignore from MANIFEST.
    
    It's possible to programmatically determine almost all the files and
    directories which will be created in lib/ by building the extensions.
    Hence add a new script regen/lib_cleanup.pl to do this.
    
    This saves having to manually update lib/.gitignore to reflect changes in
    the build products of extensions, which has become a small but reoccurring
    instance of scut-work.

M       MANIFEST
M       lib/.gitignore
A       regen/lib_cleanup.pl

commit 221a726109cdae87d4bd694bb7fa3a820e7d1c9f
Author: Nicholas Clark <[email protected]>
Date:   Sat Jul 20 11:08:53 2013 +0200

    Move all the "special case" build products from lib/.gitignore to .gitignore
    
    These are all the build products that we can't programmatically infer will 
be
    generated from extensions in ext, dist and cpan.

M       .gitignore
M       lib/.gitignore

commit f7e8f4d980f7120103a2bd19131c1def26d9fbb9
Author: Nicholas Clark <[email protected]>
Date:   Sat Jul 20 10:33:00 2013 +0200

    Make .gitignore and lib/.gitignore more consistent.
    
    Move the ignore of lib/App/, lib/mro.pm, lib/TAP/, lib/Test/Harness.pm,
    lib/File/DosGlob.pm, lib/inc/, Win32.pm, Win32API/ and Win32Core.pm from
    .gitignore to lib/.gitignore, where they more logically belong.
    Consistently use trailing / for ignored directories.
    Add a leading / to the ignore of unicore/TestProp.pl
    (The line was added by commit 3df51b85ce4a5664 in Nov 2009, and it's not
    clear why it did not have a leading / from the start.)
    
    Re-sort lib/.gitignore lexically.

M       .gitignore
M       lib/.gitignore

commit 9d19238070ddb7e1f0e77fb6d0b96046464d1863
Author: Nicholas Clark <[email protected]>
Date:   Sat Jul 20 10:10:12 2013 +0200

    Prune some .gitignore files.
    
    Class::ISA was removed by 3df51b85ce4a5664 in April 2010.
    Module::Pluggable was removed by commit 482cac4d574f8c6c in May 2013.
    Module/Build/ConfigData.pm was moved from lib/ to cpan/ by commit
    0b93a7997e668a67 in Nov 2009.
    Pod::Plainer was removed by commit afbe215fcafe7a92 in April 2010.
    Shell was removed by commit a1e75797c204ade8 in June 2011.
    Switch was removed by commit 75108aefc8b50fcf in April 2010.

M       .gitignore
M       lib/.gitignore
-----------------------------------------------------------------------

Summary of changes:
 .gitignore           |  39 ++++---
 MANIFEST             |   1 +
 lib/.gitignore       | 310 ++++++++++++++-------------------------------------
 regen/lib_cleanup.pl | 116 +++++++++++++++++++
 4 files changed, 224 insertions(+), 242 deletions(-)
 create mode 100644 regen/lib_cleanup.pl

diff --git a/.gitignore b/.gitignore
index 06a5f51..7356473 100644
--- a/.gitignore
+++ b/.gitignore
@@ -93,22 +93,32 @@ MYMETA.*
 /bitcount.h
 /mg_data.h
 
-lib/inc/
-lib/Win32.pm
-lib/Win32API/
-lib/Win32CORE.pm
+# Build products that we can't infer are generated by conventional extensions
+# (ie all the special cases that would take more code than just adding them
+# here):
 lib/CORE/
+lib/Config_git.pl
+lib/Config_heavy.pl
+lib/Config.pm
+lib/Config.pod
+lib/Cross.pm
+lib/ExtUtils/MANIFEST.SKIP
+lib/ExtUtils/xsubpp
+lib/auto/
+lib/buildcustomize.pl
+lib/unicore/CombiningClass.pl
+lib/unicore/Decomposition.pl
+lib/unicore/Heavy.pl
+lib/unicore/Name.pl
+lib/unicore/Name.pm
+lib/unicore/TestProp.pl
+lib/unicore/To/
+lib/unicore/UCD.pl
+lib/unicore/lib/
+lib/unicore/mktables.lst
 
 # test byproducts
 ext/Test-Harness/t/ext/
-lib/App/
-lib/Archive/Tar/t/src/long/foo.tbz
-lib/Archive/Tar/t/src/short/foo.tbz
-lib/IPC/Cmd/t/src/x.tgz
-lib/mro.pm
-lib/TAP/
-lib/Test/Harness.pm
-lib/File/DosGlob.pm
 t/rantests
 t/tmp*
 t/perl
@@ -156,8 +166,3 @@ MANIFEST.new
 
 # generated by the top level install.html target. XXX Why does it need this?
 /vms/README_vms.pod
-
-#stuff to ignore from Module::Pluggable:
-cpan/Module-Pluggable/t/lib/EditorJunk/Plugin/#Bar.pm#
-cpan/Module-Pluggable/t/lib/OddTest/Plugin/-Dodgy.pm
-
diff --git a/MANIFEST b/MANIFEST
index 5623df6..47acdfc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4757,6 +4757,7 @@ regen/embed.pl                    Produces 
{embed,embedvar,proto}.h
 regen/feature.pl               Generates feature.pm
 regen/genpacksizetables.pl     Generate the size tables for pack/unpack
 regen/keywords.pl              Program to write keywords.h
+regen/lib_cleanup.pl           Generate lib/.gitignore from MANIFEST
 regen/mg_vtable.pl             generate mg_vtable.h
 regen/miniperlmain.pl          generate miniperlmain.c
 regen/mk_invlists.pl           Generates charclass_invlists.h
diff --git a/lib/.gitignore b/lib/.gitignore
index 138f495..8337da0 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,102 +1,52 @@
-/Archive/Tar.pm
-/Archive/Tar/Constant.pm
-/Archive/Tar/File.pm
-/Attribute
+# -*- buffer-read-only: t -*-
+# !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+# This file is built by regen/lib_cleanup.pl from MANIFEST and parsing files
+# in cpan/ dist/ and ext/.
+# Any changes made here will be lost!
+
+# If this generated file has problems, it may be simpler to add more special
+# cases to the top level .gitignore than to code one-off logic into the
+# generation script regen/lib_cleanup.pl
+
+/App/
+/Archive/
+/Attribute/
 /AutoLoader.pm
 /AutoSplit.pm
-/B
 /B.pm
-/CGI
+/B/
 /CGI.pm
-/CPAN
+/CGI/
 /CPAN.pm
-/CPAN/API
-/CPAN/API/HOWTO.pod
-/CPAN/Author.pm
-/CPAN/Bundle.pm
-/CPAN/CacheMgr.pm
-/CPAN/Complete.pm
-/CPAN/Debug.pm
-/CPAN/DeferredCode.pm
-/CPAN/Distribution.pm
-/CPAN/Distroprefs.pm
-/CPAN/Distrostatus.pm
-/CPAN/Exception
-/CPAN/Exception/RecursiveDependency.pm
-/CPAN/Exception/blocked_urllist.pm
-/CPAN/Exception/yaml_not_installed.pm
-/CPAN/FTP
-/CPAN/FTP.pm
-/CPAN/FTP/netrc.pm
-/CPAN/FirstTime.pm
-/CPAN/HandleConfig.pm
-/CPAN/Index.pm
-/CPAN/InfoObj.pm
-/CPAN/Kwalify
-/CPAN/Kwalify.pm
-/CPAN/Kwalify/distroprefs.dd
-/CPAN/Kwalify/distroprefs.yml
-/CPAN/LWP
-/CPAN/LWP/UserAgent.pm
-/CPAN/Meta
-/CPAN/Meta.pm
-/CPAN/Module.pm
-/CPAN/Nox.pm
-/CPAN/PAUSE2003.pub
-/CPAN/PAUSE2005.pub
-/CPAN/PAUSE2007.pub
-/CPAN/PAUSE2009.pub
-/CPAN/Prompt.pm
-/CPAN/Queue.pm
-/CPAN/SIGNATURE
-/CPAN/Shell.pm
-/CPAN/Tarzip.pm
-/CPAN/URL.pm
-/CPAN/Version.pm
+/CPAN/
 /Carp.pm
-/Carp/Heavy.pm
-/Class/ISA.pm
-/Compress
-/Config.pm
-/Config.pod
-/Config/Perl
-/Config/Perl/V.pm
-/Config_git.pl
-/Config_heavy.pl
-/Cross.pm
+/Carp/
+/Compress/
+/Config/Perl/
 /Cwd.pm
 /DB_File.pm
-/Data
-/Devel/DProf.pm
-/Devel/DProf/
-/Devel/InnerPackage.pm
-/Devel/PPPort.pm
-/Devel/Peek.pm
-/Devel/SelfStubber.pm
+/Data/
+/Devel/
 /Digest.pm
-/Digest/MD5.pm
-/Digest/SHA.pm
-/Digest/base.pm
-/Digest/file.pm
+/Digest/
 /Dumpvalue.pm
 /DynaLoader.pm
-/Encode
 /Encode.pm
+/Encode/
 /Env.pm
 /Errno.pm
 /Exporter.pm
-/Exporter/Heavy.pm
+/Exporter/
 /ExtUtils/CBuilder.pm
 /ExtUtils/CBuilder/
 /ExtUtils/Command.pm
-/ExtUtils/Command/MM.pm
-/ExtUtils/Constant
+/ExtUtils/Command/
 /ExtUtils/Constant.pm
+/ExtUtils/Constant/
 /ExtUtils/Install.pm
 /ExtUtils/Installed.pm
 /ExtUtils/Liblist.pm
-/ExtUtils/Liblist/Kid.pm
-/ExtUtils/MANIFEST.SKIP
+/ExtUtils/Liblist/
 /ExtUtils/MM.pm
 /ExtUtils/MM_AIX.pm
 /ExtUtils/MM_Any.pm
@@ -116,14 +66,12 @@
 /ExtUtils/MM_Win95.pm
 /ExtUtils/MY.pm
 /ExtUtils/MakeMaker.pm
-/ExtUtils/MakeMaker/Config.pm
-/ExtUtils/MakeMaker/FAQ.pod
-/ExtUtils/MakeMaker/YAML.pm
-/ExtUtils/MakeMaker/Tutorial.pod
+/ExtUtils/MakeMaker/
 /ExtUtils/Manifest.pm
 /ExtUtils/Miniperl.pm
 /ExtUtils/Mkbootstrap.pm
 /ExtUtils/Mksymlists.pm
+/ExtUtils/Myconst2perl.pm
 /ExtUtils/Packlist.pm
 /ExtUtils/ParseXS.pm
 /ExtUtils/ParseXS.pod
@@ -131,116 +79,42 @@
 /ExtUtils/Typemaps.pm
 /ExtUtils/Typemaps/
 /ExtUtils/testlib.pm
-/ExtUtils/xsubpp
 /Fatal.pm
 /Fcntl.pm
-/File/CheckTree.pm
+/File/DosGlob.pm
 /File/Fetch.pm
 /File/Find.pm
 /File/Glob.pm
 /File/GlobMapper.pm
 /File/Path.pm
-/File/Spec/
 /File/Spec.pm
+/File/Spec/
 /File/Temp.pm
 /FileCache.pm
-/Filter/Simple.pm
-/Filter/Util
+/Filter/
 /GDBM_File.pm
-/Hash
-/I18N/Collate.pm
-/I18N/LangTags
-/I18N/LangTags.pm
-/I18N/Langinfo.pm
-/IO.pm
-/IO/Compress
-/IO/Dir.pm
-/IO/File.pm
-/IO/Handle.pm
-/IO/Pipe.pm
-/IO/Poll.pm
-/IO/Seekable.pm
-/IO/Select.pm
-/IO/Socket
-/IO/Socket.pm
-/IO/Uncompress
-/IO/Zlib.pm
-/IPC/Cmd.pm
-/IPC/Msg.pm
-/IPC/Open2.pm
-/IPC/Open3.pm
-/IPC/Semaphore.pm
-/IPC/SharedMem.pm
-/IPC/SysV.pm
-/HTTP/Tiny.pm
-/JSON/PP.pm
-/JSON/PP/Boolean.pm
 /Getopt/Long.pm
-/List
-/Locale
-/Locale/Constants.pm
-/Locale/Constants.pod
-/Locale/Country.pm
-/Locale/Country.pod
-/Locale/Currency.pm
-/Locale/Currency.pod
-/Locale/Language.pm
-/Locale/Language.pod
-/Locale/Maketext
-/Locale/Maketext.pm
-/Locale/Maketext.pod
-/Locale/Maketext/Guts.pm
-/Locale/Maketext/GutsLoader.pm
-/Locale/Maketext/Simple.pm
-/Locale/Maketext/TPJ13.pod
-/Locale/Script.pm
-/Locale/Script.pod
-/MIME
-/Math
-/Math/BigFloat
-/Math/BigFloat.pm
-/Math/BigFloat/Trace.pm
-/Math/BigInt
-/Math/BigInt.pm
-/Math/BigInt/Calc.pm
-/Math/BigInt/CalcEmu.pm
-/Math/BigInt/FastCalc.pm
-/Math/BigInt/Trace.pm
-/Math/BigRat.pm
-/Math/Complex.pm
-/Math/Trig.pm
-/Memoize
+/HTTP/
+/Hash/
+/I18N/
+/IO.pm
+/IO/
+/IPC/
+/JSON/
+/List/
+/Locale/
+/MIME/
+/Math/
 /Memoize.pm
-/Memoize/AnyDBM_File.pm
-/Memoize/Expire.pm
-/Memoize/ExpireFile.pm
-/Memoize/ExpireTest.pm
-/Memoize/NDBM_File.pm
-/Memoize/SDBM_File.pm
-/Memoize/Storable.pm
-/Module/Build
-/Module/Build.pm
-!/Module/Build/ConfigData.pm
-/Module/CoreList
-/Module/CoreList.pm
-/Module/CoreList.pod
-/Module/CoreList/TieHashDelta.pm
-/Module/Load.pm
-/Module/Load/Conditional.pm
-/Module/Loaded.pm
-/Module/Metadata.pm
+/Memoize/
+/Module/
 /NDBM_File.pm
 /NEXT.pm
 /Net/Cmd.pm
 /Net/Config.pm
 /Net/Domain.pm
-/Net/FTP
 /Net/FTP.pm
-/Net/FTP/A.pm
-/Net/FTP/E.pm
-/Net/FTP/I.pm
-/Net/FTP/L.pm
-/Net/FTP/dataconn.pm
+/Net/FTP/
 /Net/NNTP.pm
 /Net/Netrc.pm
 /Net/POP3.pm
@@ -253,68 +127,48 @@
 /Opcode.pm
 /POSIX.pm
 /POSIX.pod
-/Package/Constants.pm
-/Params/Check.pm
-/Parse/CPAN/
-/Perl/OSType.pm
-/PerlIO/encoding.pm
-/PerlIO/mmap.pm
-/PerlIO/scalar.pm
-/PerlIO/via.pm
-/PerlIO/via/QuotedPrint.pm
+/Package/
+/Params/
+/Parse/
+/Perl/
+/PerlIO/
 /Pod/Checker.pm
 /Pod/Escapes.pm
-/Pod/Functions.pm
 /Pod/Find.pm
+/Pod/Functions.pm
 /Pod/Html.pm
 /Pod/InputObjects.pm
 /Pod/Man.pm
 /Pod/ParseLink.pm
 /Pod/ParseUtils.pm
 /Pod/Parser.pm
-/Pod/Perldoc
 /Pod/Perldoc.pm
+/Pod/Perldoc/
 /Pod/PlainText.pm
-/Pod/Plainer.pm
 /Pod/Select.pm
-/Pod/Simple
 /Pod/Simple.pm
 /Pod/Simple.pod
-/Pod/Simple/t/corpus/2202jp.txt
-/Pod/Simple/t/corpus/2202jpx.txt
-/Pod/Simple/t/corpus/2202jpy.txt
-/Pod/Simple/t/corpus2/polish_utf16be_bom.txt
-/Pod/Simple/t/corpus2/polish_utf16le_bom.txt
+/Pod/Simple/
 /Pod/Text.pm
 /Pod/Text/
 /Pod/Usage.pm
 /Pod/perldoc.pod
 /SDBM_File.pm
 /Safe.pm
-/Scalar
+/Scalar/
 /Search/
 /SelfLoader.pm
-/Shell.pm
 /Socket.pm
 /Storable.pm
-/Switch.pm
-/Sys
-/Term
+/Sys/
+/TAP/
+/Term/
 /Test.pm
-/Test/Builder
-/Test/Builder.pm
-/Test/More.pm
-/Test/Simple.pm
-/Test/Tutorial.pod
-/Text/Balanced.pm
-/Text/ParseWords.pm
-/Text/Soundex.pm
-/Text/Tabs.pm
-/Text/Wrap.pm
-/Text/Abbrev.pm
-/Thread
+/Test/
+/Text/
+/Thread/
 /Tie/File.pm
-/Tie/Hash/NamedCapture.pm
+/Tie/Hash/
 /Tie/Memoize.pm
 /Tie/RefHash.pm
 /Time/HiRes.pm
@@ -324,45 +178,51 @@
 /Unicode/Collate.pm
 /Unicode/Collate/
 /Unicode/Normalize.pm
-/XS
+/VMS/
+/Win32.pm
+/Win32API/
+/Win32CORE.pm
+/XS/
 /XSLoader.pm
 /arybase.pm
 /attributes.pm
-/auto
-/autodie
 /autodie.pm
+/autodie/
 /autouse.pm
 /base.pm
 /bigint.pm
 /bignum.pm
 /bigrat.pm
-/buildcustomize.pl
 /constant.pm
-/encoding
 /encoding.pm
+/encoding/
 /fields.pm
 /if.pm
+/inc/
 /lib.pm
+/mro.pm
 /ops.pm
 /parent.pm
-/perlfaq*
+/perlfaq.pm
+/perlfaq.pod
+/perlfaq1.pod
+/perlfaq2.pod
+/perlfaq3.pod
+/perlfaq4.pod
+/perlfaq5.pod
+/perlfaq6.pod
+/perlfaq7.pod
+/perlfaq8.pod
+/perlfaq9.pod
 /perlglossary.pod
 /perlxs.pod
 /perlxstut.pod
 /perlxstypemap.pod
 /re.pm
-/threads
 /threads.pm
-/unicore/CombiningClass.pl
-/unicore/Decomposition.pl
-/unicore/Heavy.pl
-/unicore/mktables.lst
-/unicore/Name.pl
-/unicore/Name.pm
-unicore/TestProp.pl
-/unicore/To
-/unicore/UCD.pl
-/unicore/lib
+/threads/
 /version.pm
 /version.pod
 /version/
+
+# ex: set ro:
diff --git a/regen/lib_cleanup.pl b/regen/lib_cleanup.pl
new file mode 100644
index 0000000..1ab5cc8
--- /dev/null
+++ b/regen/lib_cleanup.pl
@@ -0,0 +1,116 @@
+#!./perl -w
+use strict;
+require 'regen/regen_lib.pl';
+
+# For processing later
+my @ext;
+# Lookup hash of all directories in lib/ in a clean distribution
+my %libdirs;
+
+open my $fh, '<', 'MANIFEST'
+    or die "Can't open MANIFEST: $!";
+
+while (<$fh>) {
+    if (m<^((?:cpan|dist|ext)/[^/]+/              # In an extension directory
+           (?!t/|private/|corpus/|demo/|testdir/) # but not a test or similar
+           \S+                                    # filename characters
+           (?:\.pm|\.pod|_pm\.PL|_pod\.PL))       # useful ending
+           (?:\s|$)                               # whitespace or end of line
+          >x) {
+        push @ext, $1;
+    } elsif (m!^lib/([^ \t\n]+)/[^/ \t\n]+!) {
+        # All we are interested in are shipped directories in lib/
+        # leafnames (and package names) are actually irrelevant.
+        my $dirs = $1;
+        do {
+            # lib/Pod/t is in MANIFEST, but lib/Pod is not. Rather than
+            # special-casing this, generalise the code to ensure that all
+            # parent directories of anything add are also added:
+            ++$libdirs{$dirs}
+        } while ($dirs =~ s!/.*!!);
+    }
+}
+
+close $fh
+    or die "Can't close MANIFEST: $!";
+
+# Lines we need in lib/.gitignore
+my %ignore;
+
+FILE:
+foreach my $file (@ext) {
+    my ($extname, $path) = $file =~ m!^(?:cpan|dist|ext)/([^/]+)/(.*)!
+        or die "Can't parse '$file'";
+
+    if ($path =~ /\.pod$/) {
+        unless ($path =~ s!^lib/!!) {
+            # ExtUtils::MakeMaker will install it to a path based on the
+            # extension name:
+            if ($extname =~ s!-[^-]+$!!) {
+                $extname =~ tr!-!/!;
+                $path = "$extname/$path";
+            }
+        }
+    } elsif ($extname eq 'Unicode-Collate'  # Trust the package lines
+             || $extname eq 'Encode'        # Trust the package lines
+             || $path eq 'win32/Win32.pm'   # Trust the package line
+             || ($path !~ tr!/!!            # No path
+                 && $path ne 'DB_File.pm'   # ... but has multiple package 
lines
+                )) {
+        # Too many special cases to encode, so just open the file and figure it
+        # out:
+        my $package;
+        open my $fh, '<', $file
+            or die "Can't open $file: $!";
+        while (<$fh>) {
+            if (/^\s*package\s+([A-Za-z0-9_:]+)/) {
+                $package = $1;
+                last;
+            }
+        }
+        close $fh
+            or die "Can't close $file: $!";
+        die "Can't locate package statement in $file"
+            unless defined $package;
+        $package =~ s!::!/!g;
+        $path = "$package.pm";
+    } else {
+        if ($path =~ s/\.PL$//) {
+            # .PL files generate other files. By convention the output filename
+            # has the .PL stripped, and any preceding _ changed to ., to comply
+            # with historical VMS filename rules that only permit one .
+            $path =~ s!_([^_/]+)$!.$1!;
+        }
+        $path =~ s!^lib/!!;
+    }
+    my @parts = split '/', $path;
+    my $prefix = shift @parts;
+    while (@parts) {
+        if (!$libdirs{$prefix}) {
+            # It is a directory that we will create. Ignore everything in it:
+            ++$ignore{"/$prefix/"};
+            next FILE;
+        }
+        $prefix .= '/' . shift @parts;
+        # If we've just shifted the leafname back onto $prefix, then @parts is
+        # empty, so we should terminate this loop.
+    } 
+    # We are creating a file in an existing directory. We must ignore the file
+    # explicitly:
+    ++$ignore{"/$path"};
+}
+
+$fh = open_new('lib/.gitignore', '>',
+               { by => $0,
+                 from => 'MANIFEST and parsing files in cpan/ dist/ and 
ext/'});
+
+print $fh <<"EOT";
+# If this generated file has problems, it may be simpler to add more special
+# cases to the top level .gitignore than to code one-off logic into the
+# generation script $0
+
+EOT
+
+print $fh "$_\n" foreach sort keys %ignore;
+
+read_only_bottom_close_and_rename($fh);

--
Perl5 Master Repository

Reply via email to