User:Kentnl/Perl Autovirtuals

From Gentoo Wiki
Jump to: navigation, search
  1. Eliminate virtual/perl-*
  2. All perl-core/* is an "autovirtual"
  3. All perl-core/* uses a special value SUPPORTING_PERLS that indicates which perls ship with the relevant perl-core
  4. All perl-core/* employs a conditional dep of
    || ( supporting_perl_b supporting_perl_b ( NORMALDEPS ))
  5. All perl-core/* does a runtime perl -e'print $]'
  6. Based on that value, if that value is in the list of "SUPPORTING PERLS", then the ebuild changes beahaviour
  7. And behaviour changes to a No-OP of installing no files.
  8. You could plausibly have a USE flag to force one of the two install paths.

Advantages:

  • Can be expected to work usefully even if the SUPPORTING_PERLS is not properly updated, without causing too much fallout ( It will still be a problem for some not-on-cpan-yet things, but that's not going away )
  • Unlike the current virtual scenario where changing from using "perl-core/*" to using "Perl itself" results in a cruft ebuild lying around, this removes the un-needed files automatically.
  • This completely avoids the =virtual/perl-Foo-5 + =perl-core/Foo-6 problem which normally results in portage expecting Foo.pm == 5 while perl sees Foo.pm == 6

Disadvantages:

  • Slightly increased rebuild requirement for users, but this is a present problem with virtuals anyway, just they'll be rebuilding the package, not the virtual.

Implementation:

   SUPPORTING_PERLS="5.020000 5.020001" # $] values
   inherit perl-core-module
   ...
   DEPEND=" ||( $PLSUPPORTED ( NORMALDEPS ))"
   RDEPEND="||( $PLSUPPORTED ( NORMALDEPS ))"


  • ( NORMALDEPS ) would be excluded if the module in question was not available via CPAN.
  • Falling back to "CPAN" and checking $] would be disabled either explicitly (???) or by SRC_URI being empty.
  • $PLSUPPORTED would be produced by perl-core-module using SUPPORTING_PERLS