From: Peter Rabbitson Date: Fri, 29 Nov 2013 10:27:25 +0000 (+0100) Subject: 'Bundled' is a legitimate non-DANGER-conveying namespace - rename to something scary X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0937fe254986921dd95b836aad800bbb8384506;p=dbsrgits%2FDBIx-Class.git 'Bundled' is a legitimate non-DANGER-conveying namespace - rename to something scary --- diff --git a/.gitignore b/.gitignore index c7ccb96..233a2fb 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,4 @@ t/var/ *~ maint/.Generated_Pod examples/Schema/db - -lib/DBIx/Class/Bundled +lib/DBIx/Class/_TempExtlib \ No newline at end of file diff --git a/Makefile.PL b/Makefile.PL index 95d1d5e..46643f1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,30 +8,35 @@ use inc::Module::Install 1.06; ## TEMPORARY (and non-portable) ## Get the dq stuff ## -if ($Module::Install::AUTHOR) { - `rm -rf lib/DBIx/Class/Bundled`; - `mkdir lib/DBIx/Class/Bundled`; - for ( - [ 'Data-Query' => 'master' ], - [ 'SQL-Abstract' => 'dq' ], - ) { - my $tdir = '/tmp/dqlib_tmp_clone'; - - `rm -rf $tdir`; - - `GIT_SSH=maint/careless_ssh.bash git clone --quiet git://git.shadowcat.co.uk/dbsrgits/$_->[0] $tdir`; - printf "\nIncluding %s git rev %s\n", - $_->[0], - scalar `GIT_DIR=$tdir/.git git rev-parse origin/$_->[1]`, - ; - `git archive --format=tar --remote=file://$tdir origin/$_->[1] lib/ | tar --strip-components=1 -xC lib/DBIx/Class/Bundled`; - - `rm -rf $tdir`; +my $target_libdir; +BEGIN { + $target_libdir = 'lib/DBIx/Class/_TempExtlib'; + + if ($Module::Install::AUTHOR) { + + `rm -rf $target_libdir`; + `mkdir $target_libdir`; + for ( + [ 'Data-Query' => 'master' ], + [ 'SQL-Abstract' => 'dq' ], + ) { + my $tdir = "/tmp/dqlib/$_->[0]/_tmp_clone"; + + `rm -rf $tdir`; + + `GIT_SSH=maint/careless_ssh.bash git clone --quiet git://git.shadowcat.co.uk/dbsrgits/$_->[0] $tdir`; + printf "\nIncluding %s git rev %s\n", + $_->[0], + scalar `GIT_DIR=$tdir/.git git rev-parse origin/$_->[1]`, + ; + `git archive --format=tar --remote=file://$tdir origin/$_->[1] lib/ | tar --strip-components=1 -xC $target_libdir`; + + `rm -rf $tdir`; + } } - `cpanm SQL::ReservedWords 2>&1`; } -use lib 'lib/DBIx/Class/Bundled'; +use lib $target_libdir; ## ## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad) diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 8578878..7d9580c 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -3,7 +3,7 @@ package DBIx::Class; use strict; use warnings; -use DBIx::Class::Bundled; +use DBIx::Class::_TempExtlib; our $VERSION; # Always remember to do all digits for the version even if they're 0 diff --git a/lib/DBIx/Class/Bundled.pm b/lib/DBIx/Class/Bundled.pm deleted file mode 100644 index 6c97cad..0000000 --- a/lib/DBIx/Class/Bundled.pm +++ /dev/null @@ -1,18 +0,0 @@ -package DBIx::Class::Bundled; - -use strict; -use warnings; -use File::Spec; - -our $HERE = File::Spec->catdir( - File::Spec->rel2abs( - join '', (File::Spec->splitpath(__FILE__))[0,1] - ), - 'Bundled' - ); - -($HERE) = ($HERE =~ /^(.*)$/); # screw you, taint mode - -unshift @INC, $HERE; - -1; diff --git a/lib/DBIx/Class/_TempExtlib.pm b/lib/DBIx/Class/_TempExtlib.pm new file mode 100644 index 0000000..e461459 --- /dev/null +++ b/lib/DBIx/Class/_TempExtlib.pm @@ -0,0 +1,30 @@ +package # hide from the pauses + DBIx::Class::_TempExtlib; + +use strict; +use warnings; +use File::Spec; +use Module::Runtime; + +# There can be only one of these, make sure we get the bundled part and +# *not* something off the site lib +for (qw( + DBIx::Class::SQLMaker + SQL::Abstract + SQL::Abstract::Test +)) { + if ($INC{Module::Runtime::module_notional_filename($_)}) { + die "\nUnable to continue - a part of the bundled templib contents " + . "was already loaded (likely an older version from CPAN). " + . "Make sure that @{[ __PACKAGE__ ]} is loaded before $_\n\n" + ; + } +} + +our ($HERE) = File::Spec->rel2abs( + File::Spec->catdir( (File::Spec->splitpath(__FILE__))[1], '_TempExtlib' ) +) =~ /^(.*)$/; # screw you, taint mode + +unshift @INC, $HERE; + +1; diff --git a/maint/Makefile.PL.inc/21_meta_noindex.pl b/maint/Makefile.PL.inc/21_meta_noindex.pl index 0c944d1..9816981 100644 --- a/maint/Makefile.PL.inc/21_meta_noindex.pl +++ b/maint/Makefile.PL.inc/21_meta_noindex.pl @@ -5,7 +5,7 @@ no_index directory => $_ for (qw| lib/DBIx/Class/Admin lib/DBIx/Class/PK/Auto lib/DBIx/Class/CDBICompat - lib/DBIx/Class/Bundled + lib/DBIx/Class/_TempExtlib maint |); no_index package => $_ for (qw/ @@ -13,6 +13,7 @@ no_index package => $_ for (qw/ DBIx::Class::Storage::BlockRunner DBIx::Class::Carp DBIx::Class::_Util + DBIx::Class::_TempExtlib DBIx::Class::ResultSet::Pager /); diff --git a/t/55namespaces_cleaned.t b/t/55namespaces_cleaned.t index 96e1203..92d1dfe 100644 --- a/t/55namespaces_cleaned.t +++ b/t/55namespaces_cleaned.t @@ -60,7 +60,7 @@ my @modules = grep { (); # empty RV for @modules }; -} grep !/Bundled::/, find_modules(); +} grep { $_ !~ /_TempExtlib/ } find_modules(); # have an exception table for old and/or weird code we are not sure # we *want* to clean in the first place diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 8988db9..c75a077 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -4,6 +4,9 @@ package # hide from PAUSE use strict; use warnings; +# Needs to load 1st so that the correct SQLA::Test is picked up +use DBIx::Class::_TempExtlib; + # this noop trick initializes the STDOUT, so that the TAP::Harness # issued IO::Select->can_read calls (which are blocking wtf wtf wtf) # keep spinning and scheduling jobs