You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/12/02 19:35:40 UTC
[06/10] lucy git commit: Rework PAUSE exclusions
Rework PAUSE exclusions
Remove class lists in Lucy::Redacted and `_gen_pause_exclusion_list`.
The generated `no_index` section was essentially ineffective, because
it was overridden by the auto-generated `provides` section. It was
also cluttered with files that wouldn't be indexed anyway.
Add `no_index` section manually in Build.PL. Since version 0.40_11,
this stops Module::Build from creating a `provides` section in the
CPAN META files. Add directories `sample` and `devel` to `no_index`
in order to stop MetaCPAN from indexing their contents.
Remove the custom `distmeta` action which checked version numbers in
.pm files and relied on the `provides` section being generated.
Part of LUCY-313.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/71015909
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/71015909
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/71015909
Branch: refs/heads/master
Commit: 710159091b19149088cc77147006730f31931a25
Parents: 05fc618
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 24 15:05:39 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Dec 2 20:15:07 2016 +0100
----------------------------------------------------------------------
perl/Build.PL | 4 ++
perl/buildlib/Lucy/Build.pm | 76 ++-----------------------------------
perl/buildlib/Lucy/Redacted.pm | 63 ------------------------------
3 files changed, 7 insertions(+), 136 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/71015909/perl/Build.PL
----------------------------------------------------------------------
diff --git a/perl/Build.PL b/perl/Build.PL
index 3fddd54..f4484aa 100644
--- a/perl/Build.PL
+++ b/perl/Build.PL
@@ -55,6 +55,10 @@ my $builder = Lucy::Build->new(
'Clownfish' => 0.006000,
'Clownfish::CFC' => 0.006000,
},
+ no_index => {
+ directory => [qw( buildlib devel sample )],
+ package => [qw( Lucy::Test )],
+ },
meta_merge => { keywords => [qw( search lucy lucene )], },
meta_add => {
resources => {
http://git-wip-us.apache.org/repos/asf/lucy/blob/71015909/perl/buildlib/Lucy/Build.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build.pm b/perl/buildlib/Lucy/Build.pm
index 87047ba..50a4ba5 100644
--- a/perl/buildlib/Lucy/Build.pm
+++ b/perl/buildlib/Lucy/Build.pm
@@ -216,20 +216,11 @@ limitations under the License.
END_AUTOGEN
}
-sub _check_module_build_for_dist {
- eval "use Module::Build 0.38;";
- die "./Build dist reqiures Module::Build 0.38 or higher--this is only "
- . Module::Build->VERSION . $/ if $@;
-}
-
-sub ACTION_distdir {
- _check_module_build_for_dist;
- shift->SUPER::ACTION_distdir(@_);
-}
-
sub ACTION_dist {
my $self = shift;
- _check_module_build_for_dist;
+
+ die("Module::Build 0.40_11 is required for ./Build dist")
+ if $Module::Build::VERSION < 0.40_11;
# Create POD.
$self->depends_on('pod');
@@ -263,10 +254,6 @@ sub ACTION_dist {
move( "MANIFEST", "MANIFEST.bak" ) or die "move() failed: $!";
$self->depends_on('manifest');
- my $no_index = $self->_gen_pause_exclusion_list;
- my $meta_add = $self->meta_add || {};
- $meta_add->{no_index} = $no_index;
- $self->meta_add( $meta_add );
$self->SUPER::ACTION_dist;
# Clean up.
@@ -277,63 +264,6 @@ sub ACTION_dist {
move( "MANIFEST.bak", "MANIFEST" ) or die "move() failed: $!";
}
-sub ACTION_distmeta {
- my $self = shift;
- $self->SUPER::ACTION_distmeta(@_);
- # Make sure everything has a version.
- require CPAN::Meta;
- my $v = version->new($self->dist_version);
- my $meta = CPAN::Meta->load_file('META.json');
- my $provides = $meta->provides;
- while (my ($pkg, $data) = each %{ $provides }) {
- die "$pkg, defined in $data->{file}, has no version\n"
- unless $data->{version};
- die "$pkg, defined in $data->{file}, is "
- . version->new($data->{version})->normal
- . " but should be " . $v->normal . "\n"
- unless $data->{version} == $v;
- }
-}
-
-# Generate a list of files for PAUSE, search.cpan.org, etc to ignore.
-sub _gen_pause_exclusion_list {
- my $self = shift;
-
- # Only exclude files that are actually on-board.
- open( my $man_fh, '<', 'MANIFEST' ) or die "Can't open MANIFEST: $!";
- my @manifest_entries = <$man_fh>;
- chomp @manifest_entries;
-
- my @excluded_files;
- for my $entry (@manifest_entries) {
- # Allow README and Changes.
- next if $entry =~ m#^(README|Changes)#;
-
- # Allow public modules.
- if ( $entry =~ m#^(perl/)?lib\b.+\.(pm|pod)$# ) {
- open( my $fh, '<', $entry ) or die "Can't open '$entry': $!";
- my $content = do { local $/; <$fh> };
- next if $content =~ /=head1\s*NAME/;
- }
-
- # Disallow everything else.
- push @excluded_files, $entry;
- }
-
- # Exclude redacted modules.
- if ( eval { require "buildlib/Lucy/Redacted.pm" } ) {
- my @redacted = map {
- my @parts = split( /\W+/, $_ );
- catfile( $LIB_DIR, @parts ) . '.pm'
- } Lucy::Redacted->redacted, Lucy::Redacted->hidden;
- push @excluded_files, @redacted;
- }
-
- my %uniquifier;
- @excluded_files = sort grep { !$uniquifier{$_}++ } @excluded_files;
- return { file => \@excluded_files };
-}
-
sub ACTION_semiclean {
my $self = shift;
print "Cleaning up most build files.\n";
http://git-wip-us.apache.org/repos/asf/lucy/blob/71015909/perl/buildlib/Lucy/Redacted.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Redacted.pm b/perl/buildlib/Lucy/Redacted.pm
deleted file mode 100644
index 21abca8..0000000
--- a/perl/buildlib/Lucy/Redacted.pm
+++ /dev/null
@@ -1,63 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-use strict;
-use warnings;
-
-package Lucy::Redacted;
-
-our $VERSION = '0.006000';
-$VERSION = eval $VERSION;
-
-use Exporter 'import';
-our @EXPORT_OK = qw( list );
-
-# Return a partial list of Lucy classes which were once public but are
-# now either deprecated, removed, or moved.
-
-sub redacted {
- return qw(
- Lucy::Analysis::LCNormalizer
- Lucy::Analysis::Token
- Lucy::Analysis::TokenBatch
- Lucy::Index::Term
- Lucy::InvIndex
- Lucy::InvIndexer
- Lucy::Object::Obj
- Lucy::QueryParser::QueryParser
- Lucy::Search::BooleanQuery
- Lucy::Search::QueryFilter
- Lucy::Search::SearchServer
- Lucy::Search::SearchClient
- );
-}
-
-# Hide additional stuff from PAUSE and search.cpan.org.
-sub hidden {
- return qw(
- Lucy::Analysis::Inversion
- Clownfish::Num
- Lucy::Plan::Int32Type
- Lucy::Plan::Int64Type
- Lucy::Plan::Float32Type
- Lucy::Plan::Float64Type
- Lucy::Redacted
- Lucy::Test::Object::TestCharBuf
- Lucy::Test::TestUtils
- Lucy::Util::BitVector
- );
-}
-
-1;