From fe02934c5a5bba11e351be5a2f3f95a4461779af Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sat, 21 Oct 2017 15:37:11 +1300 Subject: Patch around annoying CPAN-initialization test This is a terrible way of doing this, but its good enough for now and convinces CPAN that its already configured and doesn't block waiting for input. A more sensible narrow set is probably viable, and OS specifics probably need to be considered. Bug: https://rt.cpan.org/Ticket/Display.html?id=96782 --- t/1-basic.t | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/t/1-basic.t b/t/1-basic.t index dbf7e27..2cdffab 100644 --- a/t/1-basic.t +++ b/t/1-basic.t @@ -10,6 +10,7 @@ my $mm_args; my @prompts = qw/y n n y y/; use ExtUtils::MakeMaker; +use File::Temp qw( tempdir ); sub ExtUtils::MakeMaker::WriteMakefile { $mm_args = {@_} } sub ExtUtils::MakeMaker::prompt ($;$) { return 'n' } @@ -24,6 +25,80 @@ my $fh = Symbol::gensym; my $out = tie *$fh, __PACKAGE__; select(*$fh); +my $tempdir = tempdir( 'tmp-XXXXXXX', DIR => './t' , CLEANUP => 1 ); +$ENV{HOME} = $tempdir; +mkdir "$tempdir/.cpan"; +mkdir "$tempdir/.cpan/CPAN"; +{ + open my $fh, '>', "$tempdir/.cpan/CPAN/MyConfig.pm" or die "can't open test MyConfig.pm: $! $?"; + print $fh <<"EOF"; +\$CPAN::Config = { + 'applypatch' => q[], + 'auto_commit' => q[0], + 'build_cache' => q[100], + 'build_dir' => q[\Q$tempdir\E/build], + 'build_dir_reuse' => q[0], + 'build_requires_install_policy' => q[yes], + 'bzip2' => q[/bin/bzip2], + 'cache_metadata' => q[1], + 'check_sigs' => q[0], + 'colorize_output' => q[0], + 'commandnumber_in_prompt' => q[1], + 'connect_to_internet_ok' => q[1], + 'cpan_home' => q[\Q$tempdir\E], + 'ftp_passive' => q[1], + 'ftp_proxy' => q[], + 'getcwd' => q[cwd], + 'gpg' => q[/usr/bin/gpg], + 'gzip' => q[/bin/gzip], + 'halt_on_failure' => q[0], + 'histfile' => q[\Q$tempdir\E/histfile], + 'histsize' => q[100], + 'http_proxy' => q[], + 'inactivity_timeout' => q[0], + 'index_expire' => q[1], + 'inhibit_startup_message' => q[0], + 'keep_source_where' => q[\Q$tempdir\E/sources], + 'load_module_verbosity' => q[none], + 'make' => q[/usr/bin/make], + 'make_arg' => q[], + 'make_install_arg' => q[], + 'make_install_make_command' => q[/usr/bin/make], + 'makepl_arg' => q[], + 'mbuild_arg' => q[], + 'mbuild_install_arg' => q[], + 'mbuild_install_build_command' => q[./Build], + 'mbuildpl_arg' => q[], + 'no_proxy' => q[], + 'pager' => q[/usr/bin/less], + 'patch' => q[/usr/bin/patch], + 'perl5lib_verbosity' => q[none], + 'prefer_external_tar' => q[1], + 'prefer_installer' => q[MB], + 'prefs_dir' => q[\Q$tempdir\E/prefs], + 'prerequisites_policy' => q[follow], + 'scan_cache' => q[atstart], + 'shell' => q[/bin/bash], + 'show_unparsable_versions' => q[0], + 'show_upload_date' => q[0], + 'show_zero_versions' => q[0], + 'tar' => q[/bin/tar], + 'tar_verbosity' => q[none], + 'term_is_latin' => q[1], + 'term_ornaments' => q[1], + 'test_report' => q[0], + 'trust_test_report_history' => q[0], + 'unzip' => q[/usr/bin/unzip], + 'urllist' => [q[http://cpan.kinghost.net/], q[http://cpan.dcc.uchile.cl/], q[http://www.laqee.unal.edu.co/CPAN/]], + 'use_sqlite' => q[0], + 'version_timeout' => q[15], + 'wget' => q[/usr/bin/wget], + 'yaml_load_code' => q[0], + 'yaml_module' => q[YAML], + }; +EOF +} + # test from a clean state $ENV{PERL_EXTUTILS_AUTOINSTALL} = ''; require ExtUtils::AutoInstall; -- 2.14.2