# Embedded modules usage in inc/ in perl packages

The idea is to map the embedded modules used a build time 
in inc/ (beside custom build system etc), so we can fix the packages.


Rationale: embedded modules are frowned upon, and in some (admittedly corner) 
cases, it can cause issues we want to avoid.

Either we fix them directly, of file a bug with a usertag (TBD) if it's non-trivial.

See https://lists.debian.org/debian-perl/2018/12/msg00010.html for discussion,
as well as Teams/Perl/Team-Sprint-Debcamp-2019 Gobby Document.

# Helpful commands

To find packages using embedded modules, excluding some known cases:


in `<perl-team>/packages`: 

`ls -dR */inc/* | egrep -v '/(Module/|latest/|My/?Builder)'`

add 

`| sed -r 's,([^/]+)/.*,\1,g' | sort -u` 
to get the package list and not all the files

The resulting list has been manually checked by nodens to discover existing modules
(see Mapping below)

***Note that this is not entirely error-proof. There might be false negative,
but we want a rough map at first***

# Details of some repeated offences


## inc::latest

inc::latest uses the locally installed version if it's more recent than the 
version in inc/.

Fix: add proper deps, and possibly a comment as a heads up to casual contributors

## Spiffy / Test::Base

Packages using Ingy "Post-Modern build system" often have Test::Base
and its dependencies, plus sometimes include some Perl core modules files
like unicore/Name.pm


example: libfeed-find-perl
already depends on libtest-base-perl
removing inc/ stuff actually still works (not the Module::Install)


**Fix: add proper deps and remove modules in dh_clean**


# Mapping of the current situation
## Summary
Out of 501 packages having inc/, we have
- 388 using Module::Build, Module::Install
- 74 using some kind of custom build system or extending existing one [2]
- 36 using existing modules (for build or tests), in Debian or not -> should be fixed
- 21 using a local copy of Test::Base (+Spiffy) from our beloved Ingy, untouched since 2012, doing some "magic" with Module::Install (we might be able to do some stuff about it, needs to be looked into)
- 4 using inc::latest - should be fixed

## using inc::latest (some are fixed already with versioned Build-Depends)
libalien-wxwidgets-perl
libfile-sharedir-perl
liblist-moreutils-xs-perl
liblist-moreutils-perl

## using existing module (in debian or not): should be fixed
pkg                                       | comment
libauthen-krb5-simple-perl                | Devel::CheckLib - add to B-D
libb-hooks-endofscope-perl                | ExtUtils::HasCompiler - not in Debian
libbio-eutilities-perl                    | inc::TestHelper - keep
libclass-c3-perl                          | ExtUtils::HasCompiler - not in Debian
libconfig-inifiles-perl                   | Devel::CheckLib - add to B-D
libcrypt-ssleay-perl                      | IO::Interactive::Tiny - add to B-D
libdata-structure-util-perl               | IO::CaptureOutput, Devel::CheckLib - add to B-D
libdbd-sqlite3-perl                       | Test::NoWarnings in tests - add to B-D
libdevel-globaldestruction-perl           | ExtUtils::HasCompiler - not in Debian
libffi-platypus-perl                      | Alien::Base::Wrapper, custom - not in Debian
libfile-libmagic-perl                     | Capture::Tiny, Config::Autoconf - add to B-D
libipc-sharelite-perl                     | IO::CaptureOutput, Devel::CheckLib - add to B-D
libjson-maybexs-perl                      | ExtUtils::HasCompiler - not in Debian
liblist-someutils-perl                    | ExtUtils::HasCompiler - not in Debian
libmath-int128-perl                       | Capture::Tiny, Config::Autoconf - add to B-D
libmath-int64-perl                        | Capture::Tiny, Config::Autoconf - add to B-D
libmath-prime-util-gmp-perl               | Devel::CheckLib - add to B-D
libmath-prime-util-perl                   | Devel::CheckLib - add to B-D
libmath-tamuanova-perl                    | Devel::CheckLib - add to B-D
libmaxmind-db-reader-xs-perl              | Capture::Tiny, Config::Autoconf - add to B-D
libmongodb-perl                           | ExtUtils::HasCompiler - not in Debian
libmoose-perl                             | ExtUtils::HasCompiler, custom, MakeMaker... - maybe keep as-is
libnamespace-clean-perl                   | ExtUtils::HasCompiler - not in Debian
libopengl-xscreensaver-perl               | Devel::CheckLib - add to B-D
libref-util-perl                          | ExtUtils::HasCompiler, ExtUtils::MakeMaker::Dist::Zilla::Develop - not in Debian
libref-util-xs-perl                       | ExtUtils::HasCompiler, ExtUtils::MakeMaker::Dist::Zilla::Develop - not in Debian
libsereal-decoder-perl                    | Devel::Checklib (+custom) - add to B-D
libsereal-encoder-perl                    | Devel::Checklib (+custom) - add to B-D
libstrictures-perl                        | ExtUtils::HasCompiler - not in Debian
libtype-tie-perl                          | Test::Fatal + Try::Tiny, Test::Requires - add to b-d
libtype-tiny-perl                         | Test::Fatal + Try::Tiny, Test::Requires - add to b-d
libwww-mechanize-shell-perl               | IO::Catch ?? Might be OK, nothing on cpan
libxml-libxml-perl                        | Devel::CheckLib - add to B-D
libxml-parser-perl                        | Devel::CheckLib - add to B-D
pdl                                       | Alien::Proj4, Carp::Heavy - not in Debian, add to B-D

## Using Test::Base (Spiffy etc) - TBE
libarray-diff-perl
libclass-trigger-perl
libconfig-pit-perl
libconvert-pem-perl
libdigest-bubblebabble-perl
libencode-base58-perl
libexporter-autoclean-perl
libfeed-find-perl
libhtml-autopagerize-perl
libmakefile-dom-perl
libmodule-compile-perl
libobject-container-perl
libplack-middleware-header-perl
libtemplate-plugin-posix-perl
libtest-name-fromline-perl
libtest-time-perl
libwebservice-youtube-perl
libwww-google-calculator-perl
libwww-mechanize-autopager-perl
libwww-nicovideo-download-perl
libyaml-libyaml-perl

## Using Module::Install, Module::Build etc
Kinda Smelly but we don't have an easy fix yet (will try to look into it).
In the past we just looked the other way and pinched our noses.

to obtain the (quite long) list, run:
`ls -d */inc/Module/Install | sed -r 's,^([^/]+).*,\1,g'`

## Using custom build / test or extensions of module - nothing to do
libbson-xs-perl
libcache-perl
libcairo-perl
libcgi-simple-perl
libchart-clicker-perl
libclang-perl
libconstant-defer-perl
libcpan-mini-inject-perl
libcrypt-gcrypt-perl
libcryptx-perl
libdatetime-format-strptime-perl
libdatetime-perl
libdatetime-timezone-perl
libdbd-firebird-perl
libdbix-class-helpers-perl
libdist-zilla-localetextdomain-perl
liberror-perl
libfile-find-object-perl
libfile-find-object-rule-perl
libfile-monitor-perl
libgeo-coordinates-itm-perl
libgeo-gpx-perl
libgit-raw-perl
libgit-wrapper-perl
libgraph-easy-perl
libhtml-display-perl
libhtml-formatexternal-perl
libhtml-mason-perl
libhtml-tree-perl
libhtml-widgets-navmenu-perl
libimager-perl
libio-socket-inet6-perl
libkiokudb-backend-dbi-perl
liblocal-lib-perl
libmarpa-r2-perl
libmath-gsl-perl
libmodule-build-perl
libmojo-rabbitmq-client-perl
libnet-cidr-set-perl
libnet-imap-simple-perl
libobject-id-perl
libpackage-stash-perl
libparams-validate-perl
libparse-keyword-perl
libpbkdf2-tiny-perl
libpegex-perl
libperl5i-perl
libpod-minimumversion-perl
libsereal-perl
libstatistics-descriptive-perl
libstring-camelcase-perl
libstring-random-perl
libtemplate-stash-autoescaping-perl
libterm-shell-perl
libterm-size-perl-perl
libtest-mocktime-datecalc-perl
libtext-bibtex-perl
libtext-format-perl
libunicode-japanese-perl
libwx-glcanvas-perl
libwx-scintilla-perl
libx11-protocol-other-perl
libxml-descent-perl
libxml-semanticdiff-perl
libzmq-ffi-perl
sqitch
xacobeo

## full list of undetermined modules with comment
Note: Those are already in one of the lists above.

*no comment means build/test system extension and the like. Keep as-is*
| pkg   | comment
libauthen-krb5-simple-perl                | Devel::CheckLib - add to B-D
libb-hooks-endofscope-perl                | ExtUtils::HasCompiler - not in Debian
libbio-eutilities-perl                    | inc::TestHelper - keep
libbson-xs-perl                           |
libcache-perl                             |
libcairo-perl                             |
libcgi-simple-perl                        |
libchart-clicker-perl                     |
libclang-perl                             |
libclass-c3-perl                          | ExtUtils::HasCompiler - not in Debian
libconfig-inifiles-perl                   | Devel::CheckLib - add to B-D
libconstant-defer-perl                    |
libcpan-mini-inject-perl                  |
libcrypt-gcrypt-perl                      |
libcrypt-ssleay-perl                      | IO::Interactive::Tiny - add to B-D
libcryptx-perl                            |
libdata-structure-util-perl               | IO::CaptureOutput, Devel::CheckLib - add to B-D
libdatetime-format-strptime-perl          |
libdatetime-perl                          |
libdatetime-timezone-perl                 |
libdbd-firebird-perl                      |
libdbd-sqlite3-perl                       | Test::NoWarnings in tests - add to B-D
libdbix-class-helpers-perl                |
libdevel-globaldestruction-perl           | ExtUtils::HasCompiler - not in Debian
libdist-zilla-localetextdomain-perl       |
liberror-perl                             |
libffi-platypus-perl                      | Alien::Base::Wrapper, custom - not in Debian
libfile-find-object-perl                  |
libfile-find-object-rule-perl             |
libfile-libmagic-perl                     | Capture::Tiny, Config::Autoconf - add to B-D
libfile-monitor-perl                      |
libgeo-coordinates-itm-perl               |
libgeo-gpx-perl                           |
libgit-raw-perl                           |
libgit-wrapper-perl                       |
libgraph-easy-perl                        |
libhtml-display-perl                      |
libhtml-formatexternal-perl               |
libhtml-mason-perl                        |
libhtml-tree-perl                         |
libhtml-widgets-navmenu-perl              |
libimager-perl                            |
libio-socket-inet6-perl                   |
libipc-sharelite-perl                     | IO::CaptureOutput, Devel::CheckLib - add to B-D
libjson-maybexs-perl                      | ExtUtils::HasCompiler - not in Debian
libkiokudb-backend-dbi-perl               |
liblist-someutils-perl                    | ExtUtils::HasCompiler - not in Debian
liblocal-lib-perl                         |
libmarpa-r2-perl                          |
libmath-gsl-perl                          |
libmath-int128-perl                       | Capture::Tiny, Config::Autoconf - add to B-D
libmath-int64-perl                        | Capture::Tiny, Config::Autoconf - add to B-D
libmath-prime-util-gmp-perl               | Devel::CheckLib - add to B-D
libmath-prime-util-perl                   | Devel::CheckLib - add to B-D
libmath-tamuanova-perl                    | Devel::CheckLib - add to B-D
libmaxmind-db-reader-xs-perl              | Capture::Tiny, Config::Autoconf - add to B-D
libmodule-build-perl                      |
libmojo-rabbitmq-client-perl              |
libmongodb-perl                           | ExtUtils::HasCompiler - not in Debian
libmoose-perl                             | ExtUtils::HasCompiler, custom, MakeMaker... - maybe keep as-is
libnamespace-clean-perl                   | ExtUtils::HasCompiler - not in Debian
libnet-cidr-set-perl                      |
libnet-imap-simple-perl                   |
libobject-id-perl                         |
libopengl-xscreensaver-perl               | Devel::CheckLib - add to B-D
libpackage-stash-perl                     |
libparams-validate-perl                   |
libparse-keyword-perl                     |
libpbkdf2-tiny-perl                       |
libpegex-perl                             |
libperl5i-perl                            |
libpod-minimumversion-perl                |
libref-util-perl                          | ExtUtils::HasCompiler, ExtUtils::MakeMaker::Dist::Zilla::Develop - not in Debian
libref-util-xs-perl                       | ExtUtils::HasCompiler, ExtUtils::MakeMaker::Dist::Zilla::Develop - not in Debian
libsereal-decoder-perl                    | Devel::Checklib (+custom) - add to B-D
libsereal-encoder-perl                    | Devel::Checklib (+custom) - add to B-D
libsereal-perl                            |
libstatistics-descriptive-perl            |
libstrictures-perl                        | ExtUtils::HasCompiler - not in Debian
libstring-camelcase-perl                  |
libstring-random-perl                     |
libtemplate-stash-autoescaping-perl       |
libterm-shell-perl                        |
libterm-size-perl-perl                    |
libtest-mocktime-datecalc-perl            |
libtext-bibtex-perl                       |
libtext-format-perl                       |
libtype-tie-perl                          | Test::Fatal + Try::Tiny, Test::Requires - add to b-d
libtype-tiny-perl                         | Test::Fatal + Try::Tiny, Test::Requires - add to b-d
libunicode-japanese-perl                  |
libwww-mechanize-shell-perl               | IO::Catch ?? Might be OK, nothing on cpan
libwx-glcanvas-perl                       |
libwx-scintilla-perl                      |
libx11-protocol-other-perl                |
libxml-descent-perl                       |
libxml-libxml-perl                        | Devel::CheckLib - add to B-D
libxml-parser-perl                        | Devel::CheckLib - add to B-D
libxml-semanticdiff-perl                  |
libzmq-ffi-perl                           |
pdl                                       | Alien::Proj4, Carp::Heavy - not in Debian, add to B-D
sqitch                                    |
xacobeo                                   |