Bug 1351136 - %python_provide doesn't like multiple usage in one package
Summary: %python_provide doesn't like multiple usage in one package
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: python-rpm-macros
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-29 10:28 UTC by Igor Gnatenko
Modified: 2018-05-29 11:52 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:52:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Igor Gnatenko 2016-06-29 10:28:22 UTC
https://github.com/ignatenkobrain/fedora-packages/blob/master/python-uritemplate/python-uritemplate.spec

This is my spec file. In short:
%global modname uritemplate
%global altname uritemplate.py

%package -n python2-%{modname}
%python_provide python2-%{modname}
%python_provide python2-%{altname}

%package -n python3-%{modname}
%python_provide python3-%{modname}
%python_provide python3-%{altname}


But after building I see following:
[brain@x1carbon python-github3py]$ sudo dnf repoquery --provides python2-uritemplate
Last metadata expiration check: 0:08:37 ago on Wed Jun 29 12:13:22 2016.
python-uritemplate = 0.3.0-1.fc25
python-uritemplate.py = 0.3.0-1.fc25
python2-uritemplate = 0.3.0-1.fc25
python2.7dist(uritemplate.py) = 0.3.0
[brain@x1carbon python-github3py]$ sudo dnf repoquery --obsoletes python2-uritemplate
Last metadata expiration check: 0:12:37 ago on Wed Jun 29 12:13:22 2016.
python-uritemplate < 0.3.0-1.fc25
python-uritemplate.py < 0.3.0-1.fc25

[brain@x1carbon python-github3py]$ sudo dnf repoquery --provides python3-uritemplate
Last metadata expiration check: 0:08:31 ago on Wed Jun 29 12:13:22 2016.
python3-uritemplate = 0.3.0-1.fc25
python3.5dist(uritemplate.py) = 0.3.0
[brain@x1carbon python-github3py]$ sudo dnf repoquery --obsoletes python3-uritemplate
Last metadata expiration check: 0:12:48 ago on Wed Jun 29 12:13:22 2016.


No Provides: python2-uritemplate.py in python2 subpkg
No Provides: python3-uritemplate.py in python3 subpkg
No Obsoletes for python3-uritemplate.py in python3 subpkg

I guess it's because of "." in %{altname}.

Comment 1 Petr Viktorin (pviktori) 2016-06-29 11:35:19 UTC
Why do you need to provide "python2-uritemplate.py" and "python3-uritemplate.py"? %python_provide is intended for module names; "uritemplate.py" is not a module (i.e. something you can import).

Comment 2 Igor Gnatenko 2016-06-29 11:50:35 UTC
(In reply to Petr Viktorin from comment #1)
> Why do you need to provide "python2-uritemplate.py" and
> "python3-uritemplate.py"? %python_provide is intended for module names;
> "uritemplate.py" is not a module (i.e. something you can import).

it's upstream project name and same is for PyPI. pip install uritemplate.py works, so I wanted to have python3-uritemplate.py provides for users/developers which will not find that python3-uritemplate provides that subpackage.

Is this understandable?

Comment 3 Igor Gnatenko 2016-06-29 12:10:38 UTC
(In reply to Petr Viktorin from comment #1)
> Why do you need to provide "python2-uritemplate.py" and
> "python3-uritemplate.py"? %python_provide is intended for module names;
> "uritemplate.py" is not a module (i.e. something you can import).

also sometimes there is packages like: python-requests-toolbelt.

when you do import you should use requests_toolbelt, so that package should provide with dash and with underscore.

It's also broken.

Comment 4 Miro Hrončok 2016-06-29 12:53:38 UTC
Actually, what you import, has nothing to do with this.

This is simply made so that python2-blah also provides python-blah.

python2-uritemplate should provide python-uritemplate, not python-uritemplate.py.

For provides with names on PyPI, see https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

Comment 5 Jason Tibbitts 2016-06-29 16:19:23 UTC
Not only that, but the macro is just a convenience.  It works for basic module names and thus is useful for the vast majority of packages.  It doesn't need to handle every single case, because you can always just list the provides you want directly.

That said, if you have a suggested patch that's useful for more than one specific case seen in one package, I'd be more than happy to have a look.  Or if you can simply provide data on what provides you would want to see generated from a number of different cases, I can see if they'd be handled.  But it's just not worth it to fix one or two packages.

Comment 6 Igor Gnatenko 2016-06-29 17:09:06 UTC
(In reply to Jason Tibbitts from comment #5)
> Not only that, but the macro is just a convenience.  It works for basic
> module names and thus is useful for the vast majority of packages.  It
> doesn't need to handle every single case, because you can always just list
> the provides you want directly.
> 
> That said, if you have a suggested patch that's useful for more than one
> specific case seen in one package, I'd be more than happy to have a look. 
> Or if you can simply provide data on what provides you would want to see
> generated from a number of different cases, I can see if they'd be handled. 
> But it's just not worth it to fix one or two packages.

I think I have 3-5 such packages.

* python-pillow (should handle cases for pythonX-imaging, pythonX-PIL, pythonX-pillow. all of those are well-known names)
* python-scikit-learn (should handle pythonX-sklearn, pythonX-scikit-learn. all of those are well-known names)
* python-requests-toolbelt (upstream well-known name is requests_toolbelt so I want it to handle pythonX-requests_toolbelt and pythonX-requests-toolbelt)

didn't remember others, but I'm pretty sure I have at least one package which has 3 different well-known names.

actually when I was thinking about naming I thought that %python_provide should automatically add Provides/Obsoletes for python2/python3 automatically based on argument, not by name of package. So for me this is still some bug which I would like to get fixed.

Based on examples above I don't want to put manually Provides/Obsoletes for each package because it means that %python_provide is useless.

Jason, I'm ready to help with that, just let me know how! ;)

Comment 7 Jason Tibbitts 2016-06-29 17:55:45 UTC
Well, first learn a bit of Lua.  Then look at /usr/lib/rpm/macros.python.

It should be at least sort of obvious from there.  Of course, I don't know what output you would want to see from what input, so I just can't say what you would do next.

I also need to remove the annoying backspaces from that function; they're actually unnecessary except for blank lines.

Comment 8 Jason Tibbitts 2016-06-29 18:27:26 UTC
Oh, and I should add: It's completely OK if %python_provides is useless for some particular case.  I can't say any louder that it is just a convenience.  Listing the Provides and Obsoletes manually is... exactly what you should do in a case that the macro doesn't handle.  And that's perfectly fine.

Covering very minor cases has a cost in maintainability which simply must be considered.  So if it's easy, then great.  But if it requires vastly complicating the existing macro, which is already somewhat magical, then... probably not, as there are only a few of us who understand RPM macro stuff down at this level.

Though a separate macro would almost certainly be OK regardless.  And I'm willing to look into it either way.

Comment 9 Igor Gnatenko 2016-06-30 06:17:55 UTC
(In reply to Jason Tibbitts from comment #8)
> Oh, and I should add: It's completely OK if %python_provides is useless for
> some particular case.  I can't say any louder that it is just a convenience.
> Listing the Provides and Obsoletes manually is... exactly what you should do
> in a case that the macro doesn't handle.  And that's perfectly fine.
but it should be absolutely same as produced by %python_provide, what's the point?
> 
> Covering very minor cases has a cost in maintainability which simply must be
> considered.  So if it's easy, then great.  But if it requires vastly
> complicating the existing macro, which is already somewhat magical, then...
> probably not, as there are only a few of us who understand RPM macro stuff
> down at this level.
> 
> Though a separate macro would almost certainly be OK regardless.  And I'm
> willing to look into it either way.
I will check code of %python_provide and will try to write patch.

Comment 10 Jan Kurik 2016-07-26 04:51:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 11 Igor Gnatenko 2016-07-27 11:49:09 UTC
Ok, I will fix it and attach patch here.

Comment 12 Fedora End Of Life 2017-02-28 09:59:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 13 Miro Hrončok 2018-03-23 12:30:04 UTC
Igor, is this still relevant? If so, would you ba bale to look into it?

Comment 14 Fedora End Of Life 2018-05-03 08:39:11 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

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 26 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 15 Fedora End Of Life 2018-05-29 11:52:30 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
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.