Patching BackPAN::Index

Tags:

Patching BackPAN::Index

I want to use Git::CPAN::Patch to conveniently submit patches to CPAN distributions, but the prerequisite BackPAN::Index doesn't install:

Building and testing BackPAN-Index-0.42 Building BackPAN-Index t/pod.t ............................ skipped: Author test t/pod_coverage.t ................... skipped: Author test # Fetching the BackPAN index and creating the database. This may take a while. BackPAN::Index::populatedatabase(): DBI Exception: DBD::SQLite::st execute failed: UNIQUE constraint failed: files.path at /home/corion/.cpanm/work/1631949714.1284114/BackPAN-Index-0.42/blib/lib/BackPAN/Index.pm line 116 t/as_hash.t ........................ Dubious, test returned 2 (wstat 512, 0x200) No subtests run BackPAN::Index::populatedatabase(): DBI Exception: DBD::SQLite::st execute failed: UNIQUE constraint failed: files.path at /home/corion/.cpanm/work/1631949714.1284114/BackPAN-Index-0.42/blib/lib/BackPAN/Index.pm line 116# Looks like your test exited with 2 just after 1. ...

#   Failed test at t/distributions.t line 14.
#     '96'
#         >=
#     '20000'

#   Failed test at t/distributions.t line 16.
# Looks like you failed 2 tests of 3.
t/distributions.t ..................
Dubious, test returned 2 (wstat 512, 0x200)
Test Summary Report
-------------------
t/as_hash.t                      (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
t/Parse-BACKPAN-Packages/simple.t (Wstat: 512 Tests: 1 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan.  You planned 84 tests but ran 1.
t/authors.t                      (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
t/cgi.t                          (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan.  You planned 1 tests but ran 0.
t/file.t                         (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
t/distributions.t                (Wstat: 512 Tests: 3 Failed: 2)
Failed tests:  1-2
Non-zero exit status: 2
Files=14, Tests=32, 21 wallclock secs ( 0.03 usr  0.01 sys + 25.51 cusr  6.42 csys = 31.97 CPU)
Result: FAIL
Failed 6/14 test programs. 2/32 subtests failed.

This is because the distribution expects its tests to run in sequence instead of running in parallel. As the distribution uses Module::Build, there is no easy way to find out how/where it runs the tests and to test the problem in isolation, but a guess of running prove -bl -j 1 fixes the problem while prove -bl -j 12 reproduces the problem.

The repository now lives at https://github.com/book/BackPAN-Index.

A small patch (not using Git::CPAN::Patch, fittingly) alleviates the problem of the parallel tests:

---
# This test suite needs the t/00* files to be run first, then it can run in parallel
seq:
    - seq: t/00*.t
    - par:
        - t/*.t
        - xt/*.t

I've opened the PR on Github.

Git::CPAN::Patch then installs without further hiccups.