#947 Deprecate Old Style Dependency Generators
Opened 4 years ago by vondruch. Modified 2 years ago
vondruch/packaging-committee deprecated-old-style-generators  into  master

@@ -17,6 +17,9 @@ 

  * *MUST:* Packages must not provide RPM dependency information when that information is not global in nature, or are otherwise handled (e.g. through a virtual provides system). e.g. a plugin package containing a binary shared library must not "provide" that library unless it is accessible through the system library paths.

  * *MUST:* When filtering automatically generated RPM dependency information, the filtering system implemented by Fedora must be used, except where there is a compelling reason to deviate from it.

  

+ WARNING: *Depracated Old Style Dependency Generators*:

+ Please note that the "old style dependency generators", also known as "the external dependency generators", are deprecated by RPM. Therefore any occurence of the old macros `+%filter_provides_in+`, `+%filter_requires_in+`, `+%filter_from_provides+`, `+%filter_from_requires+` together with `+%filter_setup+` MUST be replaced by their modern alternatives `+%__requires_exclude+`, `+%__requires_exclude_from+`, `+%__provides_exclude+`, `+%__provides_exclude_from+`.

+ 

  == Usage

  

  === Location of macro invocation
@@ -47,12 +50,6 @@ 

  %global __provides_exclude_from ^(.%{libdir}/%{name}/*\\.so|%{_datadir}/myapp/.*)$

  ....

  

- Note that this macro replaces the `+%filter_provides_in+` macro from the old filtering guidelines but it does not do the same thing. In particular:

- 

- * The old macro could be invoked multiple times. This one will only use the regex defined last.

- * The old macro advised against anchoring the beginning of the regex (Using `+^+`). This macro recommends anchoring as it doesn't suffer from the compatibility problems of the old one.

- * With the old macro it was common to specify a directory name to match everything in a directory recursively. With the new macro you may need to specify `+.*+` because you should be anchoring your regular expressions.

- 

  === Filtering provides and requires after scanning

  

  In addition to preventing rpm from scanning files and directories for automatic dependency generation you can also tell rpm to discard a discovered dependency before it records the dependency in the rpm metadata. Use `+__requires_exclude+` and `+__provides_exclude+` for this. These macros should be defined as regular expressions. If an entry that rpm's automatic dependency generator created matches the regular expression then it will be filtered out of the requires or provides. For example:
@@ -66,8 +63,6 @@ 

  %global __requires_exclude ^/usr/bin/python$

  ....

  

- These macros serves a similar purpose to the old `+%filter_from_provides+` macro but it has a different implementation. In particular, that macro took sed expressions whereas this one needs a regular expression.

- 

  === Simplified macros for common cases

  

  In some cases, the filtering of extraneous `+Provides:+` is fairly generic to all packages which provide similar things. There are simple macros that setup filters correctly for those cases so that you can do the filtering with one line. If you need to filter a bit more than the simple macro provides, you still have the option to use the macros listed above.

The "old style dependency generators", also known as "the external dependency generators", are deprecated by RPM [1]. Therefore any occurrence of the old macros %filter_provides_in, %filter_requires_in, %filter_from_provides, %filter_from_requires together with %filter_setup MUST be replaced by their modern alternatives %__requires_exclude, %__requires_exclude_from, %__provides_exclude, %__provides_exclude_from.

rebased onto b2ee0c1

4 years ago

Please note that there is ~100 packages which are still using the %filter_setup:

$ grep -R -l filter_setup | sort 
audacious-plugins.spec
bluefish.spec
calamaris.spec
code-editor.spec
compizconfig-python.spec
cvs2cl.spec
debhelper.spec
dhcp.spec
dyninst.spec
eggdrop.spec
eiciel.spec
fcitx-qt5.spec
gfal2-python.spec
glusterfs.spec
gprbuild.spec
gr-osmosdr.spec
highlight.spec
hplip.spec
hypre.spec
Io-language.spec
ldns.spec
libcouchbase.spec
libdasm.spec
libfreenect.spec
libglvnd.spec
libkdegames4.spec
libkolabxml.spec
libpfm.spec
libvirt-python.spec
libxsmm.spec
mhonarc.spec
mod_authnz_pam.spec
mod_intercept_form_submit.spec
mod_lookup_identity.spec
mod_perl.spec
mod_wsgi.spec
nant.spec
nordugrid-arc.spec
omniORB.spec
opendbx.spec
openvas-scanner.spec
perl-Ace.spec
perl-AppConfig.spec
perl-Catalyst-Controller-FormBuilder.spec
perl-CGI-Prototype.spec
perl-DateTime-Precise.spec
perl-File-FnMatch.spec
perl-HTML-TreeBuilder-XPath.spec
perl-IO-InSitu.spec
perl-MooseX-Types-DateTimeX.spec
perl-Regexp-Grammars.spec
perl-Rose-DateTime.spec
perl-Rose-DB-Object.spec
perl-Rose-Object.spec
perl-Socket-Netlink-Route.spec
perl-Socket-Netlink.spec
perl-Template-Toolkit.spec
perl-Unicode-LineBreak.spec
perl-Wx.spec
php-pecl-couchbase2.spec
php-phpiredis.spec
php.spec
php-zmq.spec
portmidi.spec
purple-facebook.spec
pyicu.spec
pymilia.spec
PyPAM.spec
pysendfile.spec
pythia8.spec
python-apsw.spec
python-cups.spec
python-iptables.spec
python-logbook.spec
python-poppler-qt4.spec
python-sane.spec
python-signalfd.spec
python-smbc.spec
python-subvertpy.spec
python3-poppler-qt5.spec
qgis.spec
qpid-proton.spec
q.spec
rb_libtorrent.spec
scala.spec
scorep.spec
scribus.spec
scummvm.spec
shutter.spec
smokeping.spec
suil.spec
sympa.spec
uuid.spec
uwsgi.spec
vdr-femon.spec
vdr-osdteletext.spec
vdr-remote.spec
vdr-skinsoppalusikka.spec
veusz.spec
vym.spec
whatsup.spec
xapian-bindings.spec

Also, I think that at some point, we should consider replacing the above mentioned macros [1] by some empty stubs and phase them out at some point.

@pmatilai WDYT?

Just for some background, yesterday, I have spent one hour hunting for missing provides. As it turned out, this is because of the %{?filter_setup} [1], which as a side effect turns off the regular generators, we are using more and more these days. Moreover, I don't think that anybody knows why the macro is used there. Neither I think it serves its purpose, because AFAIK, the .so files are processed just in `%{_libdir}. So these macros very likely causes more harm these days then good and therefore we should deprecate and remove them ASAP.

Metadata Update from @churchyard:
- Pull-request tagged with: meeting

4 years ago

From this weeks meeting (https://meetbot-raw.fedoraproject.org/fedora-meeting-1/2020-05-14/fpc.2020-05-14-16.00.txt):

ACTION: mhroncok to look at how python can get fixed for automatic lib provides

https://github.com/rpm-software-management/rpm/issues/1227

Metadata Update from @churchyard:
- Pull-request untagged with: meeting

3 years ago

So it's been... quite some time since we looked at this one. I still a bunch ofpackages using %filter_setup but there are a number of false positives where the macro use is behind a conditional. A quick run over them shows the following 65:

code-editor.spec
debhelper.spec
dhcp.spec
dmlite.spec
dyninst.spec
eiciel.spec
fcitx-qt5.spec
gprbuild.spec
gr-osmosdr.spec
highlight.spec
hplip.spec
hypre.spec
Io-language.spec
ldns.spec
libcouchbase.spec
libdasm.spec
libkolabxml.spec
libpfm.spec
libpst.spec
libvirt-python.spec
libxsmm.spec
mod_authnz_pam.spec
mod_intercept_form_submit.spec
mod_lookup_identity.spec
mod_wsgi.spec
nant.spec
omniORB.spec
opendbx.spec
perl-AppConfig.spec
perl-Catalyst-Controller-FormBuilder.spec
perl-CGI-Prototype.spec
perl-DateTime-Precise.spec
perl-File-FnMatch.spec
perl-HTML-TreeBuilder-XPath.spec
perl-IO-InSitu.spec
perl-MooseX-Types-DateTimeX.spec
perl-Regexp-Grammars.spec
perl-Rose-DateTime.spec
perl-Rose-Object.spec
perl-Socket-Netlink-Route.spec
perl-Socket-Netlink.spec
perl-Template-Toolkit.spec
perl-Unicode-LineBreak.spec
perl-Wx.spec
php-phpiredis.spec
portmidi.spec
pyicu.spec
pymilia.spec
PyPAM.spec
python3-poppler-qt5.spec
python-apsw.spec
python-cups.spec
python-logbook.spec
python-sane.spec
python-signalfd.spec
python-smbc.spec
python-subvertpy.spec
q.spec
scribus.spec
scummvm.spec
smokeping.spec
veusz.spec
vym.spec
whatsup.spec
xapian-bindings.spec

I see some old perl things which probably just never got updated to use %perl_default_filter, and several python things filtering stuff under %python3_sitearch which I guess is still necessary since the rpm issue mentioned above didn't really go anywhere.

I guess it's time to do a more thorough walk through the list of packages, figure out what needs to change and then start working towards getting packages fixed before finally setting the macros to error out.

The idea of this PR was to deprecate the filters in guidelines first, so there is more stress on their removal (or that new package won't use them by accident). Trying to remove them first and follow with guidelines update is quite different feat and of course, the PR should be also different in that case.