Bug 982212 - Macro %filter_setup prevents %version to be expanded in .attr file
Macro %filter_setup prevents %version to be expanded in .attr file
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: redhat-rpm-config (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Florian Festi
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-08 08:08 EDT by Miro Hrončok
Modified: 2015-02-17 10:58 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-02-17 10:58:06 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test.attr - Copy to /usr/lib/rpm/fileattrs/ (92 bytes, text/plain)
2013-07-08 08:08 EDT, Miro Hrončok
no flags Details
test.tar - Copy to SOURCES (contains empty dir named test) (10.00 KB, application/x-tar)
2013-07-08 08:08 EDT, Miro Hrončok
no flags Details
test-nofilter.spec - Copy to SPECS (491 bytes, text/x-rpm-spec)
2013-07-08 08:09 EDT, Miro Hrončok
no flags Details
test-filter.spec - Copy to SPECS (504 bytes, text/x-rpm-spec)
2013-07-08 08:10 EDT, Miro Hrončok
no flags Details
test-nofilter SRPM (2.14 KB, application/x-rpm)
2013-07-08 08:11 EDT, Miro Hrončok
no flags Details
test-filter SRPM (2.13 KB, application/x-rpm)
2013-07-08 08:12 EDT, Miro Hrončok
no flags Details

  None (edit)
Description Miro Hrončok 2013-07-08 08:08:20 EDT
Created attachment 770456 [details]
test.attr - Copy to /usr/lib/rpm/fileattrs/

Description of problem:

When macro %filter_setup is used in spec, suddenly, %{version} passed as an argument to script defined in /usr/lib/rpm/fileattrs/foo.attr stops exapnding.


Version-Release number of selected component (if applicable): 9.1.0-45.fc19


How reproducible: Always


Steps to Reproduce:

* All referenced files will be attached

1. Copy test.attr to /usr/lib/rpm/fileattrs/
2. Either copy test.tar to your rpmbuild/SOURCES and test-nofilter.spec and test-filter.spec to your SPECS, or unpack corresponding SRPMs
3. Run rpmbuild -ba on both files
4. Run rpm -q --provides -p on both generated binary RPMs (not debuginfo packages)

Actual results:
$ rpm -q --provides -p test-nofilter-1.0-1.fc19.x86_64.rpm 
test = 1.0
test-nofilter = 1.0-1.fc19
test-nofilter(x86-64) = 1.0-1.fc19
$ rpm -q --provides -p test-filter-1.0-1.fc19.x86_64.rpm 
test-filter = 1.0-1.fc19
test-filter(x86-64) = 1.0-1.fc19
test = %{version}


Expected results:
$ rpm -q --provides -p test-nofilter-1.0-1.fc19.x86_64.rpm 
test = 1.0
test-nofilter = 1.0-1.fc19
test-nofilter(x86-64) = 1.0-1.fc19
$ rpm -q --provides -p test-filter-1.0-1.fc19.x86_64.rpm 
test = 1.0
test-filter = 1.0-1.fc19
test-filter(x86-64) = 1.0-1.fc19

Additional info:

In test.attr is used echo for simplification. This bug is not limited to echo.

Other macros than %{version} might be affected too, but macros such as %{_datadir} or %{python_sitelib} work fine when used in path variable.
Comment 1 Miro Hrončok 2013-07-08 08:08:57 EDT
Created attachment 770457 [details]
test.tar - Copy to SOURCES (contains empty dir named test)
Comment 2 Miro Hrončok 2013-07-08 08:09:35 EDT
Created attachment 770459 [details]
test-nofilter.spec - Copy to SPECS
Comment 3 Miro Hrončok 2013-07-08 08:10:16 EDT
Created attachment 770460 [details]
test-filter.spec - Copy to SPECS
Comment 4 Miro Hrončok 2013-07-08 08:11:46 EDT
Created attachment 770461 [details]
test-nofilter SRPM
Comment 5 Miro Hrončok 2013-07-08 08:12:15 EDT
Created attachment 770462 [details]
test-filter SRPM
Comment 6 Panu Matilainen 2013-07-08 08:18:58 EDT
Yes, one of the unwanted side-effects of %filter_setup is that it switches rpmbuild to the "external dependency generator" mode where spec macros are not (and can not be made) available.

The answer is simply: dont use the fedora-specific %filter_setup. Rpm >= 4.9.x has built-in dependency filtering, use that instead:
http://rpm.org/wiki/PackagerDocs/DependencyGenerator
Comment 7 Miro Hrončok 2013-07-08 12:17:05 EDT
Shouldn't we obsolete %filter_setup (make it do nothing) and map %filter_provides_in to %__provides_exclude_from and %filter_from_provides to %__provides_exclude (and the same thing to requires)?
Comment 8 Panu Matilainen 2013-07-09 09:25:30 EDT
Optimally yes, but the two filtering methods differ too much for that.
Comment 9 Miro Hrončok 2013-07-09 13:29:04 EDT
Is there a workaround, how to pass version to .prov script, when old %filter_setup is used?
Comment 10 Fedora Admin XMLRPC Client 2014-11-14 02:24:47 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 11 Fedora End Of Life 2015-01-09 13:45:53 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 12 Fedora End Of Life 2015-02-17 10:58:06 EST
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.