From Fedora Project Wiki

No edit summary
(Restructure slightly now that so much EPEL5 cruft has gone away.)
(44 intermediate revisions by 14 users not shown)
Line 1: Line 1:
= EPEL Specific Packaging Guidelines =
This page contains guidelines which are no longer relevant to Fedora, but still apply to EPEL packages. These guidelines are designed to avoid conflict with the larger Fedora Packaging Guidelines, but should any conflicts occur, these guidelines should take precedence (on EPEL packages).
This page contains guidelines which are no longer relevant to Fedora, but still apply to EPEL packages (EL-4 and/or EL-5). These guidelines are designed to avoid conflict with the larger Fedora Packaging Guidelines, but should any conflicts occur, these guidelines should take precedence (on EPEL packages).


As a reminder, these guidelines only apply to EPEL packages, not to Fedora packages.
As a reminder, these guidelines only apply to EPEL packages, not to Fedora packages.


{{Anchor|LimitedArchPackages}}
== The %license tag ==
 
RHEL6 does not include a definition of the <code>%license</code> macro, so the <code>epel-rpm-macros</code> package (which is present for every build) will map it to <code>%doc</code>.  This renders it unnecessary to define <code>%license</code> by hand.  However, due to bugs in the SCL macros, this definition will '''not''' exist if the SCL macros package is present on the system.  This should not affect packages when they are built in the build system, but users who do have have the SCL macros installed may see issues when building such packages locally.
 
== Limited Arch Packages ==
== Limited Arch Packages ==


When RHEL ships a package for only a subset of available arches, it's possibly for EPEL to ship that SAME package in order to satisfy dependencies in the other arches in EPEL. In order to do this:  
When RHEL ships a package for only a subset of available arches, it's possibly for EPEL to ship that '''same''' package in order to satisfy dependencies in the other arches in EPEL. In order to do this:  


# Make sure the package is not shipped on all arches. EPEL5: (ppc/i386/x86_64) EPEL6: (ppc64/i686/x86_64).
# Make sure the package is not shipped for all architectures. The valid architectures are:  
#* EPEL6: i686, ppc64, x86_64
#* EPEL7: aarch64, ppc64, ppc64le, x86_64.
# Make sure the package meets the Fedora licensing and distribution rules. Nothing non-free or under an unacceptable license.  
# Make sure the package meets the Fedora licensing and distribution rules. Nothing non-free or under an unacceptable license.  
# Notify the epel-devel list of your intention to add this package.  
# Notify the epel-devel list of your intention to add this package.  
# Change the release of the package to have a leading 0. EXAMPLE: RHEL has foobar-1.0-1, you change it to foobar-1.0-0.1 for EPEL.
# Change the release of the package to have a leading 0. EXAMPLE: RHEL has foobar-1.0-1, you change it to foobar-1.0-0.1 for EPEL.
# Add a Changelog entry that the package was added to EPEL and has a 0 leading version to keep it older than RHEL.  
# Add a Changelog entry that the package was added to EPEL and has a 0 leading version to keep it older than RHEL.  
# Submit a SCM request asking for the el4/5/6 branch you need.  
# Submit a [https://admin.fedoraproject.org/pkgdb package db] request asking for the el5, el6 or epel7 branch you need.  
# Import and build your package, submit as update.  
# Import and build your package, submit as update.  
# Watch the RHEL version of the package. When it updates, you should update the EPEL version too. You should never update other than that.  
# Watch the RHEL version of the package. When it updates, you should update the EPEL version too. You should never update other than that.  
Line 20: Line 24:
NOTE: Do '''not''' add ExclusiveArch tags, this will break building on the other architectures!
NOTE: Do '''not''' add ExclusiveArch tags, this will break building on the other architectures!


{{Anchor|scrollkeeper}}
== EPEL 6 ==
 
== Scrollkeeper ==
For EL-4 and EL-5, Gnome and KDE use the scrollkeeper cataloging system to keep track of documentation installed on the system.  Scrollkeeper allows the help system to sort and search documentation metadata stored in .omf files.  When you add documentation in these systems you need to make scrollkeeper aware that the documentation has been changed.


Note that we BuildRequires scrollkeeper as most Makefile's are setup to install the necessary scrollkeeper files only if scrollkeeper is present at install time.
=== SysV initscripts ===
<pre>
BuildRequires:  scrollkeeper
Requires(post): scrollkeeper
Requires(postun): scrollkeeper
...
%post
scrollkeeper-update -q -o %{_datadir}/omf/%{name} || :


%postun
[[EPEL:SysVInitScripts|SysV initscripts]] are used only in EPEL5 and 6. EPEL7 packages MUST provide systemd units as described in [[Packaging:Systemd]].
scrollkeeper-update -q || :
</pre>
These two scriptlets tell scrollkeeper to update its indexes to account for the new scrollkeeper files.


{{Anchor|GConf}}
=== Provides and Requires Filtering ===
== GConf Scriptlets ==
In Fedora, we now use macros for our GConf2 scriptlets, but for EL-4 and EL-5, this is not an option. For those targets, please use the old manual scriptlets, as documented below:


<pre>
{{admon/caution|EPEL ONLY|These filtering mechanisms are considered deprecated in Fedora packages and must not be used there.}}
Requires(pre): GConf2
Requires(post): GConf2
Requires(preun): GConf2
...
%pre
if [ "$1" -gt 1 ] ; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
%{_sysconfdir}/gconf/schemas/[NAME] .schemas >/dev/null || :
fi
</pre>
In this section we uninstall the old schemas when we upgrade.  The way we do this is first to get information about where gconf stores its values via the gconftool-2 --get-default-source line.  Then we uninstall the schema from that source.  If the package could be upgrading a package which had another name for the schema at one time, then we uncomment the lines to uninstall those as well.


The next section is for installing the new schema:
==== Generic Filtering on EPEL6 ====
<pre>
%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule \
%{_sysconfdir}/gconf/schemas/[NAME] .schemas > /dev/null || :
</pre>
Here we do the same things as in the %pre section for upgrading except the gconftool-2 switch used is --makefile-install-rule to install the new schemas instead of the uninstall-rule to remove the old schemas.


The last section deals with deleting the schemas on package removal:
On EPEL6, the version of rpm is too old to support the Fedora methods of filtering Provides and RequiresPlease the older guidelines instead: [[EPEL:Packaging_Autoprovides_and_Requires_Filtering]]
<pre>
%preun
if [ "$1" -eq 0 ] ; then
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
%{_sysconfdir}/gconf/schemas/[NAME] .schemas > /dev/null || :
fi
</pre>
This snippet is nearly the same as the one for upgrading.  Why can't we just combine this portion with the  %pre portion?  The answer is that we want to delete any old versions of the schema during an upgrade.  But this has to happen before we install the new version (in the %post script) otherwise we end up removing the schema that the upgrading package installsHowever, if it really is a removal that will leave no other instances of this package on the system, we have to clean up the schema before deleting it.


'''Note:''' RHEL4 suffers from GConf [https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=173869 Bug #173869] .  If you are building for EPEL-4, you need to add <code> killall -HUP gconfd-2 > /dev/null || : </code> after the gconftool-2 calls in all the scriptlets.
==== In %prep (preferred) ====
 
== PHP ABI Check Handling ==
For Fedora '''EPEL 5''':
<pre>
%global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
 
BuildRequires: php-devel
Requires:      php-api = %{php_apiver}
</pre>
There is no way of checking the ABI with packages for Fedora EPEL 5.
 
For a spec file which is compatible with both Fedora and EPEL 5:
<pre>
%global php_apiver  %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
 
%if 0%{?php_zend_api}
Requires:    php(zend-abi) = %{php_zend_api}
Requires:    php(api) = %{php_core_api}
%else
Requires:    php-api = %{php_apiver}
%endif
</pre>
 
No API/ABI dependencies are available for Fedora '''EPEL 4''' packages.
 
== PHP PECL Module Scriptlets ==
On EPEL (EL-4/EL-5), the Fedora scriptlets for properly registering and unregistering the module have to be wrapped with conditionals checking for the existence of %{pecl_install} and %{pecl_uninstall}:
<pre>
%if 0%{?pecl_install:1}
%post
%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
%endif
 
 
%if 0%{?pecl_uninstall:1}
%postun
if [ $1 -eq 0 ]  ; then
%{pecl_uninstall} %{pecl_name} >/dev/null || :
fi
%endif
</pre>
 
== PHP PEAR Macros ==
On EPEL (EL-4/EL-5/EL-6), the "%{pear_macrodir}" macro is not defined. The simplest fix is to add this line to your spec file:
<pre>
%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
</pre>
 
Alternately, simply use %{pear_phpdir} instead.
 
== Perl Provides and Requires Filtering ==
 
Unfortunately, the modern macros for Provides and Requires Filtering ([[Packaging:AutoProvidesAndRequiresFiltering]]) do not work for EPEL 5 or older. There are two mechanisms for filtering Perl Provides and Requires in EPEL, either In %prep or via External scripts.
 
{{admon/caution|EPEL ONLY|These filtering mechanisms are considered deprecated in Fedora packages and must not be used there.}}
 
=== In %prep (preferred) ===


Filtering can be done entirely in the SPEC file, in the %prep section:
Filtering can be done entirely in the SPEC file, in the %prep section:
Line 162: Line 66:
</pre>
</pre>


=== External filtering ===
==== External filtering ====


Or the script can be placed in an external file and referenced from the specfile.  This is worse than the above because the full path of the to-be-overridden script needs to be hardcoded into the file, ignoring the system rpmbuild config.  It is, however, the method used by a significant number of existing packages.
Or the script can be placed in an external file and referenced from the specfile.  This is worse than the above because the full path of the to-be-overridden script needs to be hardcoded into the file, ignoring the system rpmbuild config.  It is, however, the method used by a significant number of existing packages.
Line 185: Line 89:
sed -e '/perl(unwanted_require)/d'
sed -e '/perl(unwanted_require)/d'
</pre>
</pre>
=== PHP PEAR Macros ===
In EPEL6, the "%{pear_macrodir}" macro is not defined. The simplest fix is to add this line to your spec file:
<pre>
%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
</pre>
Alternately, simply use %{pear_phpdir} instead.
=== Python ===
Multiple macros are being used in recent python packages that are not available in EPEL6.
{| class="mw-collapsible wikitable" style="width:100%"
! Macro name
! Line to fix it
! Possible alternative
|-
| %{__python2}
| %{!?__python2: %global __python2 /usr/bin/python2}
| %{__python}
|-
| %{python2_sitelib}
| %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
| %{python_sitelib}
|-
| %{python2_sitearch}
| %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
| %{python_sitearch}
|-
| %py2_build
| %{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}}
| CFLAGS="%{optflags}" %{__python} setup.py %{?py_setup_args} build --executable="%{__python2} -s"
|-
| %py2_install
| %{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}}
| CFLAGS="%{optflags}" %{__python} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}
|}
[[Category:EPEL]]
[[Category:Policy]]

Revision as of 19:25, 10 April 2017

This page contains guidelines which are no longer relevant to Fedora, but still apply to EPEL packages. These guidelines are designed to avoid conflict with the larger Fedora Packaging Guidelines, but should any conflicts occur, these guidelines should take precedence (on EPEL packages).

As a reminder, these guidelines only apply to EPEL packages, not to Fedora packages.

The %license tag

RHEL6 does not include a definition of the %license macro, so the epel-rpm-macros package (which is present for every build) will map it to %doc. This renders it unnecessary to define %license by hand. However, due to bugs in the SCL macros, this definition will not exist if the SCL macros package is present on the system. This should not affect packages when they are built in the build system, but users who do have have the SCL macros installed may see issues when building such packages locally.

Limited Arch Packages

When RHEL ships a package for only a subset of available arches, it's possibly for EPEL to ship that same package in order to satisfy dependencies in the other arches in EPEL. In order to do this:

  1. Make sure the package is not shipped for all architectures. The valid architectures are:
    • EPEL6: i686, ppc64, x86_64
    • EPEL7: aarch64, ppc64, ppc64le, x86_64.
  2. Make sure the package meets the Fedora licensing and distribution rules. Nothing non-free or under an unacceptable license.
  3. Notify the epel-devel list of your intention to add this package.
  4. Change the release of the package to have a leading 0. EXAMPLE: RHEL has foobar-1.0-1, you change it to foobar-1.0-0.1 for EPEL.
  5. Add a Changelog entry that the package was added to EPEL and has a 0 leading version to keep it older than RHEL.
  6. Submit a package db request asking for the el5, el6 or epel7 branch you need.
  7. Import and build your package, submit as update.
  8. Watch the RHEL version of the package. When it updates, you should update the EPEL version too. You should never update other than that.

NOTE: Do not add ExclusiveArch tags, this will break building on the other architectures!

EPEL 6

SysV initscripts

SysV initscripts are used only in EPEL5 and 6. EPEL7 packages MUST provide systemd units as described in Packaging:Systemd.

Provides and Requires Filtering

Stop (medium size).png
EPEL ONLY
These filtering mechanisms are considered deprecated in Fedora packages and must not be used there.

Generic Filtering on EPEL6

On EPEL6, the version of rpm is too old to support the Fedora methods of filtering Provides and Requires. Please the older guidelines instead: EPEL:Packaging_Autoprovides_and_Requires_Filtering

In %prep (preferred)

Filtering can be done entirely in the SPEC file, in the %prep section:

%prep
%setup -q -n Foo-%{version}

cat << \EOF > %{name}-prov
#!/bin/sh
%{__perl_provides} $* |\
sed -e '/perl(unwanted_provide)/d'
EOF

%global __perl_provides %{_builddir}/%{name}-%{version}/%{name}-prov
chmod +x %{__perl_provides}


cat << \EOF > %{name}-req
#!/bin/sh
%{__perl_requires} $* |\
sed -e '/perl(unwanted_require)/d'
EOF

%global __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req
chmod +x %{__perl_requires}

External filtering

Or the script can be placed in an external file and referenced from the specfile. This is worse than the above because the full path of the to-be-overridden script needs to be hardcoded into the file, ignoring the system rpmbuild config. It is, however, the method used by a significant number of existing packages.

Source98: filter-provides.sh
Source99: filter-requires.sh

%global __perl_provides %{SOURCE98}
%global __perl_requires %{SOURCE99}

where filter-provides.sh contains:

#!/bin/sh
/usr/lib/rpm/perl.prov $* |
sed -e '/perl(unwanted_provide)/d'

and filter-requires.sh contains:

#!/bin/sh
/usr/lib/rpm/perl.req $* |
sed -e '/perl(unwanted_require)/d'

PHP PEAR Macros

In EPEL6, the "%{pear_macrodir}" macro is not defined. The simplest fix is to add this line to your spec file:

%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}

Alternately, simply use %{pear_phpdir} instead.

Python

Multiple macros are being used in recent python packages that are not available in EPEL6.

Macro name Line to fix it Possible alternative
%{__python2} %{!?__python2: %global __python2 /usr/bin/python2} %{__python}
%{python2_sitelib} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{python_sitelib}
%{python2_sitearch} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %{python_sitearch}
%py2_build %{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}} CFLAGS="%{optflags}" %{__python} setup.py %{?py_setup_args} build --executable="%{__python2} -s"
%py2_install %{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}} CFLAGS="%{optflags}" %{__python} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}