perl-toolchain-gang / module-build-tiny Goto Github PK
View Code? Open in Web Editor NEWA tiny replacement for Module::Build
A tiny replacement for Module::Build
I'm using Perl 5.38, built from source using VS2019, on Windows Server 2022. Installing Module::Build::Tiny with:
cpanm Module::Build::[email protected]
Fails with:
# Failed test 'Script is installed'
# at t/simple.t line 160.
# Looks like you failed 1 test of 27.
cannot unlink file for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\arch\auto\Foo\Bar\Bar.dll: Permission denied at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\arch\auto\Foo\Bar: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\arch\auto\Foo: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\arch\auto: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\arch: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot unlink file for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\script\simple: Permission denied at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib\script: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar\blib: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:\Users\villek\.cpanm\work\1714476227.13640\Module-Build-Tiny-0.045\RIMzh2Acqo\Foo-Bar: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
cannot remove directory for C:/Users/villek/.cpanm/work/1714476227.13640/Module-Build-Tiny-0.045/RIMzh2Acqo: Directory not empty at C:/xyzzy/perl_538/lib/File/Temp.pm line 921.
t/simple.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/27 subtests
(less 1 skipped subtest: 25 okay)
Same thing happens if I run Build test
manually. The file arch\auto\Foo\Bar\Bar.dll has been created and it has ordinary access permissions. In my experience, you sometimes get this kind of error if the file is open in a different process, or if File::Temp has a filehandle open to the file. I can't see where File::Temp is used in t/simple.t so must be somewhere else...
Fails in the same way with Module::Build::Tiny 0.045, 0.046, 0.047.
https://metacpan.org/module/Module::Build#pure_install
The target ./Build pure_install
is documented as a method of Module::Build
that will remain pure
in the event Module::Build
eventually adds support for munging perllocal.pod
.
Gentoo have been using this method, despite the fact its current implementation means it is just a proxy for install
, because for us, modification of perllocal.pod
is both impossible ( fatal access violation ) and the generation of such a file in a DESTDIR=
tree is undesirable ( filesystem collision )
I'm not sure if Module::Build
has yet implemented perllocal.pod
modification, or where MBT
stands on the eventual modification of that file.
Either way, the existence of an equivalent method makes MBT more compatible with wrapping code.
> cpanm Module::Build::Tiny
Module::Build::Tiny is up to date. (0.039)
> perl -MModule::Build::Tiny -E 'say q[ok]'
Can't locate ExtUtils/Helpers.pm in @INC (you may need to install the ExtUtils::Helpers module) (@INC contains: /Users/nicolas/.dotfiles/perl-must-have/lib /Users/nicolas/perl5/lib/perl5/ /Users/nicolas/perl5/perlbrew/perls/perl-5.26.1/lib/site_perl/5.26.1/darwin-2level /Users/nicolas/perl5/perlbrew/perls/perl-5.26.1/lib/site_perl/5.26.1 /Users/nicolas/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1/darwin-2level /Users/nicolas/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1) at /Users/nicolas/perl5/lib/perl5/Module/Build/Tiny.pm line 10.
BEGIN failed--compilation aborted at /Users/nicolas/perl5/lib/perl5/Module/Build/Tiny.pm line 10.
Compilation failed in require.
BEGIN failed--compilation aborted.
./Build test
should also run xt/smoke/*.t
tests if AUTOMATED_TESTING is set.
- $tester->runtests(sort +find(qr/\.t$/, 't'))->has_errors and exit 1;
+ $tester->runtests(sort +find(qr/\.t$/, 't'), ( $ENV{AUTOMATED_TESTING} ? find(qr/\.t$/, 't') : () ))->has_errors and exit 1;
when you install bin scripts with MakeMaker or Module::Build, the installed scripts have a shebang like:
#!/Users/miyagawa/.plenv/versions/5.16.3/bin/perl5.16.3
eval 'exec /Users/miyagawa/.plenv/versions/5.16.3/bin/perl5.16.3 -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use Plack::Runner;
but with Module::Build::Tiny, you get the original shebang, which can be #!perl
or #!/usr/bin/perl
, which causes running the script with a wrong perl, and eventually errors loading perl modules.
> perl -V
...
@INC:
/Users/miyagawa/.plenv/versions/5.16.3/lib/perl5/site_perl/5.16.3/darwin-2level
/Users/miyagawa/.plenv/versions/5.16.3/lib/perl5/site_perl/5.16.3
/Users/miyagawa/.plenv/versions/5.16.3/lib/perl5/5.16.3/darwin-2level
/Users/miyagawa/.plenv/versions/5.16.3/lib/perl5/5.16.3
.
> cpanm Starman
> perldoc -l Starman.pm
/Users/miyagawa/.plenv/versions/5.16.3/lib/perl5/site_perl/5.16.3/Starman.pm
> perldoc -l starman
/Users/miyagawa/.plenv/versions/5.16.3/bin/starman
> starman
Can't locate Plack/Runner.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /Users/miyagawa/.plenv/versions/5.16.3/bin/starman line 3.
BEGIN failed--compilation aborted at /Users/miyagawa/.plenv/versions/5.16.3/bin/starman line 3.
Sounds like EU::Helpers thing, but i would just dump it here.
[manu@orient Starman-0.3011]$ ./Build install --destdir /home/manu/tmp/foo
[..]
Installing /home/manu/tmp/foo/usr/local/share/man/man3/.::Starman.3pm
[...]
I'm building a Debian package for AnyEvent::Handle::UDP using dh-make-perl. dh_auto_install calls:
perl Build install destdir=/root/AnyEvent-Handle-UDP-0.043/debian/libanyevent-handle-udp-perl create_packlist=0
Build does not appear to honour destdir
(or any other options), resulting in the module being installed under /usr, and so never making it into the Debian package.
The problem actually comes from using Getopt::Long
for parsing the options, which doesn't recognise anything not starting with --
or -
(or +
in legacy modes) as an option:
$ perl -MGetopt::Long=GetOptionsFromArray -MData::Dumper -E 'GetOptionsFromArray(["destdir=foo"], \%opt, qw(destdir=s)); say for %opt'
vs
$ perl -MGetopt::Long=GetOptionsFromArray -MData::Dumper -E 'GetOptionsFromArray(["--destdir=foo"], \%opt, qw(destdir=s)); say for %opt'
destdir
foo
It seems like this is needed for proper Module::Build
compat?
$ ./Build install --destdir=/builddir/build/BUILDROOT/perl-Module-Build-Tiny-0.017-1.fc20.x86_64
Installing /builddir/build/BUILDROOT/perl-Module-Build-Tiny-0.017-1.fc20.x86_64/usr/share/perl5/vendor_perl/Module/Build/Tiny.pm
Installing /builddir/build/BUILDROOT/perl-Module-Build-Tiny-0.017-1.fc20.x86_64/usr/share/man/man3/Module/Build::Tiny.3pm
man3/Module/Build::Tiny.3pm
should be man3/Module::Build::Tiny.3pm
While Module::Build::Tiny uses qr//,
the meaning of qr// may be different on perl5.16- and perl5.18+. See Perl/perl5#11549
It would be nice Module::Build::Tiny considers this difference.
I think qr/(?^:)/ consistently represents an empty string on any perl versions.
Currently Module::Build::Tiny is having three non-core dependencies (all released by myself). When I wrote Module::Build::Tiny, this organization made sense to me, now it increasingly doesn't anymore. I want to reorganize them, specially before I do proceed with Perl-Toolchain-Gang/Module-Build#25. I'd like to do this in one go, to minimize pain for packagers.
split_like_shell
is the only part of Helpers that I've used for non-installtool purposes.What I want to do is (in order of surely a good idea to maybe):
split_like_shell
and probably detildefy
. It may contain more relevant functionality laterFeedback is most welcome (@ether, @ribasushi, @dagolden,@haarg, @shadowcat-mst).
The 0.041 release no longer generates the Module::Build::Tiny man page.
Hi.
When building the module with the above options it fails to find 'ExtUtils/Config':
$ cpanm --sudo --local-lib-contained /tmp/foo Module::Build::Tiny
cpanm (App::cpanminus) 1.5007 on perl 5.014002 built for x86_64-linux-gnu-thread-multi
Work directory is /home/pelle/.cpanm/work/1412670681.12376
You have make /usr/bin/make
You have LWP 6.03
You have /bin/tar: tar (GNU tar) 1.26
Copyright © 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching Module::Build::Tiny on cpanmetadb ...
Checking if you have ExtUtils::MakeMaker 6.31 ... Yes (6.57_05)
Checking if you have ExtUtils::Install 1.46 ... Yes (1.56)
--> Working on Module::Build::Tiny
Fetching http://search.cpan.org/CPAN/authors/id/L/LE/LEONT/Module-Build-Tiny-0.038.tar.gz
-> OK
Unpacking Module-Build-Tiny-0.038.tar.gz
Entering Module-Build-Tiny-0.038
Checking configure dependencies from META.yml
Checking if you have TAP::Harness::Env 0 ... No
Checking if you have ExtUtils::Install 0 ... Yes (1.56)
Checking if you have File::Find 0 ... Yes (1.19)
Checking if you have File::Path 0 ... Yes (2.08_01)
Checking if you have CPAN::Meta 0 ... Yes (2.110440)
Checking if you have File::Spec::Functions 0 ... Yes (3.33)
Checking if you have DynaLoader 0 ... Yes (1.13)
Checking if you have ExtUtils::CBuilder 0 ... Yes (0.280203)
Checking if you have warnings 0 ... Yes (1.12)
Checking if you have Getopt::Long 2.36 ... Yes (2.38)
Checking if you have ExtUtils::Helpers 0.020 ... No
Checking if you have ExtUtils::ParseXS 0 ... Yes (2.2210)
Checking if you have Pod::Man 0 ... Yes (2.25)
Checking if you have ExtUtils::InstallPaths 0.002 ... No
Checking if you have Exporter 5.57 ... Yes (5.64_03)
Checking if you have strict 0 ... Yes (1.04)
Checking if you have JSON::PP 2 ... Yes (2.27105)
Checking if you have ExtUtils::Config 0.003 ... No
Checking if you have File::Basename 0 ... Yes (2.82)
==> Found dependencies: TAP::Harness::Env, ExtUtils::Helpers, ExtUtils::InstallPaths, ExtUtils::Config
Searching TAP::Harness::Env on cpanmetadb ...
--> Working on TAP::Harness::Env
Fetching http://search.cpan.org/CPAN/authors/id/L/LE/LEONT/Test-Harness-3.33.tar.gz
-> OK
<snip/>
Successfully installed Test-Harness-3.33
Searching ExtUtils::Helpers on cpanmetadb ...
--> Working on ExtUtils::Helpers
Fetching http://search.cpan.org/CPAN/authors/id/L/LE/LEONT/ExtUtils-Helpers-0.022.tar.gz
-> OK
<snip/>
Successfully installed ExtUtils-Config-0.008
Successfully installed ExtUtils-InstallPaths-0.010
<snip/>
Configuring Module-Build-Tiny-0.038
Running Build.PL
Creating new 'Build' script for 'Module-Build-Tiny' version '0.038'
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have XSLoader 0 ... Yes (0.13)
Checking if you have IO::File 0 ... Yes (1.15)
Checking if you have IO::Handle 0 ... Yes (1.31)
Checking if you have File::Spec 0 ... Yes (3.33)
Checking if you have Data::Dumper 0 ... Yes (2.130_02)
Checking if you have IPC::Open3 0 ... Yes (1.09)
Checking if you have Carp 0 ... Yes (1.20)
Checking if you have Test::More 0.88 ... Yes (0.98)
Checking if you have File::Temp 0 ... Yes (0.22)
Checking if you have lib 0 ... Yes (0.63)
Checking if you have IPC::Open2 0 ... Yes (1.03)
Checking if you have blib 0 ... Yes (1.06)
Checking if you have Cwd 0 ... Yes (3.36)
Checking if you have TAP::Harness::Env 0 ... Yes (3.33)
Checking if you have ExtUtils::Install 0 ... Yes (1.56)
Checking if you have File::Find 0 ... Yes (1.19)
Checking if you have File::Path 0 ... Yes (2.08_01)
Checking if you have CPAN::Meta 0 ... Yes (2.110440)
Checking if you have File::Spec::Functions 0 ... Yes (3.33)
Checking if you have DynaLoader 0 ... Yes (1.13)
Checking if you have ExtUtils::CBuilder 0 ... Yes (0.280203)
Checking if you have warnings 0 ... Yes (1.12)
Checking if you have Getopt::Long 2.36 ... Yes (2.38)
Checking if you have ExtUtils::Helpers 0.020 ... Yes (0.022)
Checking if you have ExtUtils::ParseXS 0 ... Yes (2.2210)
Checking if you have Pod::Man 0 ... Yes (2.25)
Checking if you have ExtUtils::InstallPaths 0.002 ... Yes (0.010)
Checking if you have Exporter 5.57 ... Yes (5.64_03)
Checking if you have strict 0 ... Yes (1.04)
Checking if you have JSON::PP 2 ... Yes (2.27105)
Checking if you have ExtUtils::Config 0.003 ... Yes (0.008)
Checking if you have File::Basename 0 ... Yes (2.82)
Building and testing Module-Build-Tiny-0.038
cp lib/Module/Build/Tiny.pm blib/lib/Module/Build/Tiny.pm
t/00-compile.t .......... ok
t/release-pod-syntax.t .. skipped: these tests are for release candidate testing
t/simple.t .............. ok
All tests successful.
Files=3, Tests=28, 1 wallclock secs ( 0.01 usr 0.02 sys + 0.40 cusr 0.05 csys = 0.48 CPU)
Result: PASS
Can't locate ExtUtils/Config.pm in @INC (@INC contains: lib /home/pelle/.cpanm/work/1412670681.12376 /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at lib/Module/Build/Tiny.pm line 9.
BEGIN failed--compilation aborted at lib/Module/Build/Tiny.pm line 9.
Compilation failed in require at ./Build line 3.
BEGIN failed--compilation aborted at ./Build line 3.
-> FAIL Installing Module::Build::Tiny failed. See /home/pelle/.cpanm/build.log for details.
4 distributions installed
$
Without --sudo
the build works fine.
The github issues queue is non-empty, and so is https://rt.cpan.org/Dist/Display.html?Name=Module-Build-Tiny -- which do you prefer?
I probably should be reporting this against TH, but trying here first.
I'm using the new Test::Harness:
$>perl -MTest::Harness -E'say $Test::Harness::VERSION'
3.37_01
Minilla has a very basic Build.PL
# =========================================================================
# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
# DO NOT EDIT DIRECTLY.
# =========================================================================
use 5.008_001;
use strict;
use Module::Build::Tiny 0.035;
Build_PL();
But when I do Build test, I get errors complaining about a lack of . in @inc. Is this because Module::Build::Tiny is calling Test::Harness in an inconsistent way from the other builders?
This is just a sampling. There is more output.
t/00_compile.t ............................... ok
t/01_load_all.t .............................. ok
t/03_step.t .................................. skipped: Test requires module 'Version::Next' but it's not found
t/05_metadata.t .............................. Can't locate t/Util.pm in @INC (you may need to install the t::Util module) (@INC contains: /root/tmp/Minilla/blib/arch /root/tmp/Minilla/blib/lib /perl/5.25.9/lib/site_perl/5.25.9/x86_64-linux /perl/5.25.9/lib/site_perl/5.25.9 /perl/5.25.9/lib/5.25.9/x86_64-linux /perl/5.25.9/lib/5.25.9) at t/05_metadata.t line 5.
BEGIN failed--compilation aborted at t/05_metadata.t line 5.
t/05_metadata.t .............................. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t/bumpversion.t .............................. Can't locate t/Util.pm in @INC (you may need to install the t::Util module) (@INC contains: /root/tmp/Minilla/blib/arch /root/tmp/Minilla/blib/lib /perl/5.25.9/lib/site_perl/5.25.9/x86_64-linux /perl/5.25.9/lib/site_perl/5.25.9 /perl/5.25.9/lib/5.25.9/x86_64-linux /perl/5.25.9/lib/5.25.9) at t/bumpversion.t line 5.
BEGIN failed--compilation aborted at t/bumpversion.t line 5.
t/bumpversion.t .............................. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.