4.8. How to handle RPM packages with Perls scripts


Since RHEL 8, the Perl programming language is not included in the default buildroot. Therefore, the RPM packages that include Perl scripts must explicitly indicate the dependency on Perl using the BuildRequires: directive in RPM SPEC file.

4.8.2. Using a specific Perl module

If a specific Perl module is required at build time, use the following procedure:

Procédure

  • Apply the following syntax in your RPM SPEC file:

    BuildRequires: perl(MODULE)
    Note

    Apply this syntax to Perl core modules as well, because they can move in and out of the perl package over time.

4.8.3. Limiting a package to a specific Perl version

To limit your package to a specific Perl version, follow this procedure:

Procédure

  • Use the perl(:VERSION) dependency with the desired version constraint in your RPM SPEC file:

    For example, to limit a package to Perl version 5.30 and higher, use:

    BuildRequires: perl(:VERSION) >= 5.30
Avertissement

Do not use a comparison against the version of the perl package because it includes an epoch number.

4.8.4. Ensuring that a package uses the correct Perl interpreter

Red Hat provides multiple Perl interpreters, which are not fully compatible. Therefore, any package that delivers a Perl module must use at run time the same Perl interpreter that was used at build time.

To ensure this, follow the procedure below:

Procédure

  • Include versioned MODULE_COMPAT Requires in RPM SPEC file for any package that delivers a Perl module:

    Requires:  perl(:MODULE_COMPAT_%(eval `perl -V:version`; echo $version))
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.