This is an automated email from the git hooks/post-receive script.

abe pushed a commit to annotated tag 0.2.2-source
in repository libdist-zilla-role-bootstrap-perl.

commit c4b7b7c17e51f9a1cc9231bf9b64fe2db69f9571
Author: Kent Fredric <kentfred...@gmail.com>
Date:   Mon Nov 4 22:16:46 2013 +1300

    try an even crazier approach to sterilizing
---
 corelist-data/gen_modules.pl | 13 ++++----
 corelist-data/gen_perl.pl    |  6 ++--
 sterilize_env.pl             | 79 ++++++++++++++++++++++++++++++++++++--------
 3 files changed, 75 insertions(+), 23 deletions(-)

diff --git a/corelist-data/gen_modules.pl b/corelist-data/gen_modules.pl
index 3b4b780..19d892c 100644
--- a/corelist-data/gen_modules.pl
+++ b/corelist-data/gen_modules.pl
@@ -7,15 +7,14 @@ open my $fh, '>', './modules.zsv';
 
 use Module::CoreList;
 
-
 my $seen_modules = {};
 
 for my $version ( sort keys %Module::CoreList::version ) {
-    my ($hash) = $Module::CoreList::version{$version};
-    for my $module ( sort keys %{$hash} ) {
-        next if exists $seen_modules->{$module};
-        $fh->printf( "%s\0\n", $module );
-        $seen_modules->{$module}++;
-    }
+  my ($hash) = $Module::CoreList::version{$version};
+  for my $module ( sort keys %{$hash} ) {
+    next if exists $seen_modules->{$module};
+    $fh->printf( "%s\0\n", $module );
+    $seen_modules->{$module}++;
+  }
 }
 
diff --git a/corelist-data/gen_perl.pl b/corelist-data/gen_perl.pl
index 4cd9c1c..d0678a4 100644
--- a/corelist-data/gen_perl.pl
+++ b/corelist-data/gen_perl.pl
@@ -6,7 +6,7 @@ use utf8;
 use Module::CoreList;
 
 if ( not $ARGV[0] ) {
-    die "GIVE US A PERL VERSION";
+  die "GIVE US A PERL VERSION";
 }
 
 my $version = $ARGV[0];
@@ -14,14 +14,14 @@ my $version = $ARGV[0];
 use Module::CoreList;
 
 if ( not exists $Module::CoreList::version{$version} ) {
-    die "Version $version not in corelist";
+  die "Version $version not in corelist";
 }
 my ($hash) = $Module::CoreList::version{$version};
 
 open my $fh, '>', './' . $version . '.zsv';
 
 for my $module ( sort keys %{$hash} ) {
-    $fh->printf( "%s\0%s\0\n", $module, $hash->{$module} );
+  $fh->printf( "%s\0%s\0\n", $module, $hash->{$module} );
 }
 $fh->close;
 
diff --git a/sterilize_env.pl b/sterilize_env.pl
index fc66668..2301e58 100644
--- a/sterilize_env.pl
+++ b/sterilize_env.pl
@@ -6,26 +6,30 @@ use FindBin;
 use lib "$FindBin::Bin/lib";
 use tools;
 
+my $corelists = "$FindBin::Bin/corelist-data";
+
 sub no_sterile_warning {
-  if ( env_is( 'TRAVIS_PERL_VERSION', '5.8' ) or env_is( 
'TRAVIS_PERL_VERSION', '5.10' ) ) {
+  if ( env_is( 'TRAVIS_PERL_VERSION', '5.8' )
+    or env_is( 'TRAVIS_PERL_VERSION', '5.10' ) )
+  {
     diag("\e[31m TREE STERILIZATION IMPOSSIBLE <= 5.10\e[0m");
-    diag("\e[32m ... because prior to 5.11.*, dual-life installed to 
\e[33mprivlib\e[0m");
-    diag("\e[32m ... because prior to 5.11.*, \e[33m\@INC\e[32m order was 
\e[33mprivlib,sitelib\e[0m");
-    diag("\e[32m ... whereas after to 5.11.*, \e[33m\@INC\e[32m order is 
\e[33msitelib,privlib\e[0m");
-    diag("\e[32m ... and now most dual-life things simply install to 
\e[33msitelib\e[0m");
-    diag("\e[34m ( However, there are still a few naughty CPAN modules that 
install to \e[33mprivlib\e[34m )");
+    diag( "\e[32m ... because prior to 5.11.*, dual-life installed to 
\e[33mprivlib\e[0m" );
+    diag( "\e[32m ... because prior to 5.11.*, \e[33m\@INC\e[32m order was 
\e[33mprivlib,sitelib\e[0m" );
+    diag( "\e[32m ... whereas after to 5.11.*, \e[33m\@INC\e[32m order is 
\e[33msitelib,privlib\e[0m" );
+    diag( "\e[32m ... and now most dual-life things simply install to 
\e[33msitelib\e[0m" );
+    diag( "\e[34m ( However, there are still a few naughty CPAN modules that 
install to \e[33mprivlib\e[34m )" );
     diag(
       "\e[32m but the net effect of this is that installing 
\e[33mModule::Build 0.4007\e[32m which pulls \e[33mPerl::OSType\e[0m"
     );
-    diag("\e[32m and results in  \e[33mPerl::OSType\e[32m being later removed 
\e[0m");
-    diag("\e[32m leaving behind a broken  \e[33mModule::Build 
0.4007\e[32m\e[0m");
-    diag("\e[34m Set \e[35m MAYBE_BREAK_MODULE_BUILD=1\e[34m if this is 
ok\e[0m");
+    diag( "\e[32m and results in  \e[33mPerl::OSType\e[32m being later removed 
\e[0m" );
+    diag( "\e[32m leaving behind a broken  \e[33mModule::Build 
0.4007\e[32m\e[0m" );
+    diag( "\e[34m Set \e[35m MAYBE_BREAK_MODULE_BUILD=1\e[34m if this is 
ok\e[0m" );
     exit 0 unless env_true('MAYBE_BREAK_MODULE_BUILD');
     diag("\e[35m PROCEEDING\e[0m");
   }
 }
 if ( not env_exists('STERILIZE_ENV') ) {
-  diag("\e[31STERILIZE_ENV is not set, skipping, because this is probably 
Travis's Default ( and unwanted ) target");
+  diag( "\e[31STERILIZE_ENV is not set, skipping, because this is probably 
Travis's Default ( and unwanted ) target" );
   exit 0;
 }
 if ( not env_true('STERILIZE_ENV') ) {
@@ -55,7 +59,7 @@ my $extra_sterile = {
       'Module::Build~<=0.3603',    'ExtUtils::MakeMaker~<=6.56',   
'Test::Harness~<=3.17',     'ExtUtils::Liblist~<=6.56',
       'ExtUtils::Manifest~<=1.57', 'ExtUtils::Mkbootstrap~<=6.56', 
'ExtUtils::MM_OS2~<=6.56',  'ExtUtils::MM_Unix~<=6.56',
       'ExtUtils::MM_VMS~<=6.56',   'ExtUtils::Mksymlists~<=6.56',  
'ExtUtils::testlib~<=6.56', 'ExtUtils::MM_Win32~<=6.56',
-      'File::Spec~<=3.3101',      'File::Spec::Mac~<=3.30',       
'File::Spec::OS2~<=3.30',   'File::Spec::Unix~<=3.30',
+      'File::Spec~<=3.3101',       'File::Spec::Mac~<=3.30',       
'File::Spec::OS2~<=3.30',   'File::Spec::Unix~<=3.30',
       'File::Spec::VMS~<=3.30',    'File::Spec::Win32~<=3.30',     
'Data::Dumper~<=2.125',     'File::Spec::Functions~<=3.30',
     ],
   },
@@ -68,9 +72,58 @@ if ( not env_true('TRAVIS') ) {
 
 use Config;
 
-my @all_libs  = grep { defined and length and -e $_ } map { $Config{$_} } grep 
{ $_ =~ /(lib|arch)exp$/ } keys %Config;
-my @site_libs = grep { defined and length and -e $_ } map { $Config{$_} } grep 
{ $_ =~ /site(lib|arch)exp$/ } keys %Config;
+my @all_libs =
+  grep { defined and length and -e $_ }
+  map { $Config{$_} } grep { $_ =~ /(lib|arch)exp$/ } keys %Config;
+my @site_libs =
+  grep { defined and length and -e $_ }
+  map { $Config{$_} } grep { $_ =~ /site(lib|arch)exp$/ } keys %Config;
+
+my ($corelist_file) = $corelists . '/' . $] . '.zsv';
+my ($skiplist_file) = $corelists . '/' . $] . '_skip.zsv';
+
+my $skip = {};
+
+if ( -e $skiplist_file and -f $skiplist_file ) {
+  open my $fh, '<', $skiplist_file;
+  local $/ = "\0\n";
+  while ( my $line = <$fh> ) {
+    my ($module) = split /\0/, $line;
+    $skip->{$module} = 1;
+  }
+}
+my $protect = {};
+if ( -e $corelist_file and -f $corelist_file ) {
+  diag("\e[32m Found corelist file for this perl: $], sterilizing with\e[0m");
+  open my $fh, '<', $corelist_file;
+  local $/ = "\0\n";
+  while ( my $line = <$fh> ) {
+    my ( $module, $version ) = split /\0/, $line;
+    my $fn = $module;
+    $fn =~ s/::/\//g;
+    $fn .= '.pm';
+    $protect->{$fn} = 1;
+    next if $skip->{$module};
+    cpanm( '--skip-satisfied', '--dev', '--quiet', '--notest', 
'--no-man-pages', $module . '~<=' . $version );
+  }
+  diag("Removing Bad things from all Config paths");
+  safe_exec( 'find', $libdir, '-type', 'f', '-delete' );
+  safe_exec( 'find', $libdir, '-depth', '-type', 'd', '-delete' );
 
+  for my $libdir (@all_libs) {
+    open my $finder, '-|', 'find', $libdir, '-type', 'f', '-print0';
+    local $/ = "\0";
+    while ( my $file = <$finder> ) {
+      require File::Spec;
+      my $rel = File::Spec->abs2rel( $file, $libdir );
+      if ( not exists $protect->{$rel} ) {
+        diag("\e[33m Unprotected, Removed: $rel");
+        unlink $file;
+      }
+    }
+  }
+  exit 0;
+}
 for my $perl_ver ( keys %{$extra_sterile} ) {
   if ( env_is( 'TRAVIS_PERL_VERSION', $perl_ver ) ) {
     diag("Running custom sterilization fixups");

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-role-bootstrap-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to