From Fedora Project Wiki
(35 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Perl: Replace versioned MODULE_COMPAT_ requires by macro =
= Perl: Replace versioned MODULE_COMPAT_ requires by RPM dependency generator =


== Summary ==
== Summary ==


A perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) run-time dependency will be replaced with a new %perl_require_compat macro in all Perl spec files.
A ''perl(:MODULE_COMPAT_%(eval "<nowiki>`%{__perl} -V:version`</nowiki>"; echo $version))'' run-time dependency will be removed from all Perl spec files. The replacement will be generated by dependency generator which will be placed in ''perl-generators''.


The macro will expand differently based on architecture specificity of the binary packages. That will significantly shrink an amount of Perl packages required to be rebuilt with each perl upgrade.
The result of generator will be based on content of the binary packages. That will significantly shrink an amount of Perl packages required to be rebuilt with each Perl upgrade.


== Owner ==
== Owner ==
Line 15: Line 15:


== Current status ==
== Current status ==
[[Category:ChangePageIncomplete]]
[[Category:ChangeAcceptedF38]]
 
[[Category:SystemWideChange]]
[[Category:SystemWideChange]]


Line 27: Line 26:
ON_QA -> change is fully code complete
ON_QA -> change is fully code complete
-->
-->
* FESCo issue: <will be assigned by the Wrangler>
* [https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/QIICSZFRILYI77JBBJ4YU3I54VE6V4YK/ devel thread]
* Tracker bug: <will be assigned by the Wrangler>
* FESCo issue: [https://pagure.io/fesco/issue/2898 #2898]
* Release notes tracker: <will be assigned by the Wrangler>
* Tracker bug: [https://bugzilla.redhat.com/show_bug.cgi?id=2158233 #2158233]
* Release notes tracker: [https://pagure.io/fedora-docs/release-notes/issue/943 #943]


=== Completed items ===
=== Completed items ===
* Add the file `/usr/lib/rpm/fileattrs/perlcompat.attr` to ''perl-generators'' in F38
* Add the file `/usr/lib/rpm/fileattrs/perlcompat.attr` to ''perl-generators'' in F37
* Add the file `/usr/lib/rpm/fileattrs/perlcompat.attr` to ''perl-generators'' in F36
* Update [https://pagure.io/packaging-committee/issue/1243 Fedora Packaging Guidelines for Perl]
* Remove ''perl(:MODULE_COMPAT_XXX)'' from run-time in all F38 spec files (3259)
* Create the package [https://bugzilla.redhat.com/show_bug.cgi?id=2159396 ''perl-generators-epel''] which provides the functionality for EPEL 7/8/9


=== Items in progress ===
=== Items in progress ===
* Add `%perl_require_compat` macro to ''perl-srpm-macros'' in F38
* Add ''perl-generators-epel'' to ''epel-rpm-macros'' ([https://src.fedoraproject.org/rpms/epel-rpm-macros/pull-request/61 EPEL7], [https://src.fedoraproject.org/rpms/epel-rpm-macros/pull-request/60 EPEL8], [https://src.fedoraproject.org/rpms/epel-rpm-macros/pull-request/59 EPEL9])
* Add `%perl_require_compat` macro to ''perl-srpm-macros'' in F37
* Update ''fedora-review'' to not check ''perl(MODULE_COMPAT_XXX)'' in spec files ([https://bugzilla.redhat.com/show_bug.cgi?id=2161280 BZ#2161280])
* Add `%perl_require_compat` macro to ''perl-srpm-macros'' in F36
* Add `%perl_require_compat` macro to ''perl-srpm-macros'' in F35
* Add `%perl_require_compat` macro to ''perl-srpm-macros'' in Centos 9
* Update [[Packaging:Perl | Fedora Packaging Guidelines for Perl]]
* Replace ''perl(:MODULE_COMPAT_XXX)'' by `%perl_require_compat` run-time in all F38 spec files (3259)


== Detailed Description ==
== Detailed Description ==
Line 46: Line 47:
The list of packages that need to be rebuilt with the new major version of Perl is determined according to the dependency on ''perl(:MODULE_COMPAT_XXX)'' now.  
The list of packages that need to be rebuilt with the new major version of Perl is determined according to the dependency on ''perl(:MODULE_COMPAT_XXX)'' now.  


In Fedora, all Perl modules run-requires the versioned ''perl(:MODULE_COMPAT_XXX)'' provided by ''perl-libs'' now.
In Fedora, all Perl modules run-require the versioned ''perl(:MODULE_COMPAT_XXX)'' provided by ''perl-libs'' now.
 
However, only packages with compiled code need to have a dependency on the particular version of Perl it was built against, or on a newer version of Perl that provides backward compatibility with it. For those packages, we need to ensure that the packages will use the right version of ''libperl.so'' for the Perl used during the rebuild.
 
The other packages don't need to be rebuilt against each new major version of Perl, they only have to require non-versioned ''perl-libs'' which includes all directories used by all Perl modules.
 
The new generator will generate runtime requirements based on files which are in the package.
 
The content of ''/usr/lib/rpm/fileattrs/perlcompat.attr'' will be:
%__perlcompat_requires() %{lua:
    if macros[1]:match('.+%.so$') and macros.perl_version then
      print('perl(:MODULE_COMPAT_' .. macros.perl_version .. ')')
    else
      print('perl-libs')
    end
}
%__perlcompat_path ^(%{perl_vendorarch}|%{perl_vendorlib}|%{perl_privlib}|%{perl_archlib})/.+


However, only multi-arch packages need to have a dependency on the particular version of Perl it was built against, or on a newer version of Perl that provides backward compatibility with it. For those packages, we need to ensure that the packages will use the right version of ''libperl.so'' for the Perl used during the rebuild.
The file will be placed in ''perl-generators'' which requires ''perl-macros''. Since RPM 4.15, ''perl-macros'' provides definition of ''perl_vendor*'', ''perl_privlib'' and ''perl_archlib'' and it requires  ''perl-interpreter''. The Fedora guidelines already require Perl modules to BuildRequire ''perl-generators''.


The noarch packages don't need to be rebuild against each new major version of Perl, they only have to require non-versioned ''perl-libs'' which includes all directories used by all Perl modules.
The generator will evaluate to the correct value. There is a known, yet harmless, imperfection: The generator will evaluate to ''perl-libs'' for each package which contains any (non *.so) file in the given paths. It means the packages with compiled code will usually require both ''perl(:MODULE_COMPAT_<perl_version>)'' and ''perl-libs''.
The macro `%perl_require_compat` will evaluate the run-require based on `%{_target_cpu}`. The macro will be defined in the rpm ''perl-srpm-macros'' and the definition is:


`%perl_require_compat %[ "%{_target_cpu}" == "noarch" ? "perl-libs" : "%{!?perl_version:perl-libs}%{?perl_version:perl(:MODULE_COMPAT_%{perl_version})}" ]`
This generator will work for all supported Fedoras.


The macro `%perl_requires_compat` will evaluate to the correct value. There is a known, yet harmless, imperfection: The macro will evaluate to ''perl(:MODULE_COMPAT_XXX)'' even in noarch subpackages of a multi-arch main package. In this case, I still recommend to use `Requires: %perl_require_compat`. The purpose of the change is a matter of simplifying the rebuild, where it depends if the source package produces at least one multi-arch binary package. Not on whether it makes a noarch subpackage next to it.
I'll add [https://jplesnik.fedorapeople.org/perl-generators-epel/ ''perl-generators-epel''] which provides the similar behavior for EPEL 7/8/9.


== Benefit to Fedora ==
== Benefit to Fedora ==


It will simplify the rebuild and reduce the number of packages which have to be rebuild. It should currently be enough to rebuild only multi-arch packages and those that are part of the Perl itself (dual-life packages). Here we need to ensure that the packages will use the right ''libperl.so'' for the Perl used.
It will simplify the rebuild and reduce the number of packages which have to be rebuild from 3259 to approximately 600. It should currently be enough to rebuild only multi-arch packages and those that are part of the Perl itself (dual-life packages). Here we need to ensure that the packages will use the right ''libperl.so'' for the Perl used. The generator approach will also be shorter and clearer for packagers.


== Scope ==
== Scope ==
* Proposal owners:
* Proposal owners:
** Submit Fedora Packaging Guidelines for Perl update to Fedora Packaging Committee.
** Submit Fedora Packaging Guidelines for Perl update to Fedora Packaging Committee.
** Update and rebuild perl-srpm-macros source package.
** Update and rebuild ''perl-generators'' source package.
** Add ''%perl_require_compat'' to ''perl-srpm-macros'' package in older Fedoras.
** Add ''/usr/lib/rpm/fileattrs/perlcompat.attr'' to ''perl-generators'' package in older Fedoras.
** Replace Requires for ''perl(:MODULE_COMPAT_XXX)'' with ''%perl_require_compat'' in all spec files.
** Remove Requires ''perl(:MODULE_COMPAT_XXX)'' in all spec files.


* Other developers: Get familiar with new Fedora Packaging Guidelines for Perl.
* Other developers: Get familiar with new Fedora Packaging Guidelines for Perl.
Line 78: Line 93:
* Trademark approval: N/A (not needed for this Change)
* Trademark approval: N/A (not needed for this Change)


* Alignment with Objectives:  
* Alignment with Objectives:


== Upgrade/compatibility impact ==
== Upgrade/compatibility impact ==
Line 85: Line 100:
== How To Test ==
== How To Test ==


All multi-arch packages which use the macro should run-require ''perl(:MODULE_COMPAT_%{perl_version})'' and the ''noarch'' packages should run-requires ''perl-libs'' except the case listed in '''Detailed Description'''.
All packages with compiled code should run-require ''perl(:MODULE_COMPAT_%{perl_version})'' and probably also ''perl-libs'' - it is explaned in '''Detailed Description'''. The other packages should run-require ''perl-libs'' only.


== User Experience ==
== User Experience ==

Revision as of 16:11, 23 January 2023

Perl: Replace versioned MODULE_COMPAT_ requires by RPM dependency generator

Summary

A perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) run-time dependency will be removed from all Perl spec files. The replacement will be generated by dependency generator which will be placed in perl-generators.

The result of generator will be based on content of the binary packages. That will significantly shrink an amount of Perl packages required to be rebuilt with each Perl upgrade.

Owner

Current status

Completed items

  • Add the file /usr/lib/rpm/fileattrs/perlcompat.attr to perl-generators in F38
  • Add the file /usr/lib/rpm/fileattrs/perlcompat.attr to perl-generators in F37
  • Add the file /usr/lib/rpm/fileattrs/perlcompat.attr to perl-generators in F36
  • Update Fedora Packaging Guidelines for Perl
  • Remove perl(:MODULE_COMPAT_XXX) from run-time in all F38 spec files (3259)
  • Create the package perl-generators-epel which provides the functionality for EPEL 7/8/9

Items in progress

  • Add perl-generators-epel to epel-rpm-macros (EPEL7, EPEL8, EPEL9)
  • Update fedora-review to not check perl(MODULE_COMPAT_XXX) in spec files (BZ#2161280)

Detailed Description

The list of packages that need to be rebuilt with the new major version of Perl is determined according to the dependency on perl(:MODULE_COMPAT_XXX) now.

In Fedora, all Perl modules run-require the versioned perl(:MODULE_COMPAT_XXX) provided by perl-libs now.

However, only packages with compiled code need to have a dependency on the particular version of Perl it was built against, or on a newer version of Perl that provides backward compatibility with it. For those packages, we need to ensure that the packages will use the right version of libperl.so for the Perl used during the rebuild.

The other packages don't need to be rebuilt against each new major version of Perl, they only have to require non-versioned perl-libs which includes all directories used by all Perl modules.

The new generator will generate runtime requirements based on files which are in the package.

The content of /usr/lib/rpm/fileattrs/perlcompat.attr will be:

%__perlcompat_requires() %{lua:
   if macros[1]:match('.+%.so$') and macros.perl_version then
      print('perl(:MODULE_COMPAT_' .. macros.perl_version .. ')')
   else
      print('perl-libs')
   end
}
%__perlcompat_path ^(%{perl_vendorarch}|%{perl_vendorlib}|%{perl_privlib}|%{perl_archlib})/.+

The file will be placed in perl-generators which requires perl-macros. Since RPM 4.15, perl-macros provides definition of perl_vendor*, perl_privlib and perl_archlib and it requires perl-interpreter. The Fedora guidelines already require Perl modules to BuildRequire perl-generators.

The generator will evaluate to the correct value. There is a known, yet harmless, imperfection: The generator will evaluate to perl-libs for each package which contains any (non *.so) file in the given paths. It means the packages with compiled code will usually require both perl(:MODULE_COMPAT_<perl_version>) and perl-libs.

This generator will work for all supported Fedoras.

I'll add perl-generators-epel which provides the similar behavior for EPEL 7/8/9.

Benefit to Fedora

It will simplify the rebuild and reduce the number of packages which have to be rebuild from 3259 to approximately 600. It should currently be enough to rebuild only multi-arch packages and those that are part of the Perl itself (dual-life packages). Here we need to ensure that the packages will use the right libperl.so for the Perl used. The generator approach will also be shorter and clearer for packagers.

Scope

  • Proposal owners:
    • Submit Fedora Packaging Guidelines for Perl update to Fedora Packaging Committee.
    • Update and rebuild perl-generators source package.
    • Add /usr/lib/rpm/fileattrs/perlcompat.attr to perl-generators package in older Fedoras.
    • Remove Requires perl(:MODULE_COMPAT_XXX) in all spec files.
  • Other developers: Get familiar with new Fedora Packaging Guidelines for Perl.
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives:

Upgrade/compatibility impact

N/A

How To Test

All packages with compiled code should run-require perl(:MODULE_COMPAT_%{perl_version}) and probably also perl-libs - it is explaned in Detailed Description. The other packages should run-require perl-libs only.

User Experience

There should not be any remarkable change in user experience.

Dependencies

This change will affect 3259 source packages and all binary noarch packages. The rebuild of affected packages will be done by mass rebuild of Fedora 38. There is no dependency on other Fedora changes.

Contingency Plan

  • Contingency mechanism: The change will be reverted.
  • Contingency deadline: Before Mass Rebuild.
  • Blocks release? No.

Documentation

Release Notes