Bug 1333169 - tracer ships both python2 and python3 libraries in the same package
Summary: tracer ships both python2 and python3 libraries in the same package
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: tracer
Version: 25
Hardware: All
OS: Mac OS
unspecified
high
Target Milestone: ---
Assignee: Jakub Kadlčík
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3 PYTHON3-PYTHON2
TreeView+ depends on / blocked
 
Reported: 2016-05-04 20:22 UTC by Orion Poplawski
Modified: 2016-08-22 19:20 UTC (History)
5 users (show)

Fixed In Version: tracer-0.6.11-1.fc24 tracer-0.6.11-1.fc23
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-22 16:53:07 UTC


Attachments (Terms of Use)
Use %{python_sitelib} (1.95 KB, patch)
2016-07-15 05:10 UTC, Jakub Kadlčík
no flags Details | Diff
Split package into separate python2 and python3 subpackages (3.87 KB, patch)
2016-07-21 21:33 UTC, Jakub Kadlčík
no flags Details | Diff
Suggested changes (3.04 KB, patch)
2016-07-28 12:17 UTC, Jakub Kadlčík
no flags Details | Diff

Description Orion Poplawski 2016-05-04 20:22:31 UTC
Description of problem:

tracer ships both python2 and python3 libraries in the same package, which is completely wrong.  Please review https://fedoraproject.org/wiki/Packaging:Python

Version-Release number of selected component (if applicable):
0.6.9-1.fc25

Comment 1 Tomas Orsava 2016-07-13 12:37:03 UTC
The tracer RPM requires both Python 2 and Python 3.

Except in very special circumstances, there is no need for one package
to drag in both Python stacks. Usually, this is a packaging error: for
example, a stray "/usr/bin/python" shebang in a Python 3 package can
introduce a Python 2 dependency.

Please split your package, or remove the stray dependencies.
There is a section on shebangs in the Python RPM Porting Guide [0]
which covers this issue.

It's ok to do this in Rawhide only, however, it would be greatly
appreciated if you could push it to Fedora 24 as well.


If anything is unclear, or if you need any kind of assistance, you can
ask on IRC (#fedora-python on Freenode), or reply here. We'll be happy
to help investigating or fixing this issue!


[0] http://python-rpm-porting.readthedocs.io/en/latest/application-modules.html#are-shebangs-dragging-you-down-to-python-2

Comment 2 Jakub Kadlčík 2016-07-15 05:10:01 UTC
Created attachment 1180035 [details]
Use %{python_sitelib}

Will this changes in tracer.spec be good enough?

Comment 3 Tomas Orsava 2016-07-18 10:01:16 UTC
Hi Jakub!

I believe that is not sufficient. The main problem is that your package should be split into 2 subpackages: one for Python 2 and one for Python 3.

There is a guide on how to do this, step by step, I highly recommend it:

http://python-rpm-porting.readthedocs.io

Comment 4 Jakub Kadlčík 2016-07-21 21:33:41 UTC
Created attachment 1182669 [details]
Split package into separate python2 and python3 subpackages

Thank you Tomas for that tip.

I've tried to rewrite the .spec file according to documentation that you posted, but there are few things that differs.

First, naming. The guide describes how to port python-foo into python2-foo and python3-foo packages. But in this case we even want to have foo package.

Second, that guide assumes that package is installed by `%{__python} setup.py install` while tracer is not.

I gave it my best and tried to improvise. Does this patch looks better for you?

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

Comment 6 Tomas Orsava 2016-07-27 11:24:35 UTC
Hi Jakub!

There are some problems with the spec file:

- Use this line underneath the definition of the Python 2 subpackage: `Provides: %{name} = %{version}-%{release}`
That will make the package available also under the name 'tracer'.
And get rid of this line in your spec: `Requires:	python3-%{name} = %{version}-%{release}`

- For the two descriptions of the subpackages, copy the entire description there.

- You can use a different installation method, that's fine. However, I suggest not to just copy the executable to the /usr/bin/tracer position. I suggest you use a symlink to /usr/bin/tracer-2 instead. If there are both Python versions of the executable available, guidelines say that the binary without the number should launch the python 2 version.

Comment 7 Jakub Kadlčík 2016-07-28 12:13:55 UTC
> Use this line [...] And get rid of this line ...

Yeah, much better. Thank you
However now there is a problem, because when I install tracer package, it will not drag python?-tracer as a dependency, so it will not install any files.

> For the two descriptions of the subpackages, copy the entire description there

Well, ok. But it is kind of inconvenient

> I suggest you use a symlink to /usr/bin/tracer-2 instead

Sure, no problem

> guidelines say that the binary without the number should launch the python 2 version.

I saw binary file in python3 subpackage here http://python-rpm-porting.readthedocs.io/en/latest/application-modules.html#ported-rpm-spec-file , so I thought that should be there. But no problem I changed it.

Comment 8 Jakub Kadlčík 2016-07-28 12:17:09 UTC
Created attachment 1185063 [details]
Suggested changes

Comment 9 Tomas Orsava 2016-07-28 12:33:27 UTC
(In reply to Jakub Kadlčík from comment #7)
> > Use this line [...] And get rid of this line ...
> 
> Yeah, much better. Thank you
> However now there is a problem, because when I install tracer package, it
> will not drag python?-tracer as a dependency, so it will not install any
> files.

That is slightly incorrect. The 'Provides' tag works kind of like a symlink, or an icon. If you do 'dnf install tracer', it will actually install the 'python2-tracer' package. So no problems should arise.

> 
> > For the two descriptions of the subpackages, copy the entire description there
> 
> Well, ok. But it is kind of inconvenient
> 
> > I suggest you use a symlink to /usr/bin/tracer-2 instead
> 
> Sure, no problem
> 
> > guidelines say that the binary without the number should launch the python 2 version.
> 
> I saw binary file in python3 subpackage here
> http://python-rpm-porting.readthedocs.io/en/latest/application-modules.
> html#ported-rpm-spec-file , so I thought that should be there. But no
> problem I changed it.

That is a slightly different case: If you want to package only 1 version of the executable, it should be the Python 3 version. But because you want to package both Python 2 and Python 3 versions of the executable, the unversioned executable should be in the Python 2 subpackage. See this section: 

http://python-rpm-porting.readthedocs.io/en/latest/tools.html#ported-rpm-spec-file

Comment 10 Tomas Orsava 2016-07-28 12:37:52 UTC
I think the patch looks good, though I suggest you test it first, for example in mock).

Comment 11 Jakub Kadlčík 2016-07-29 08:11:17 UTC
> If you do 'dnf install tracer', it will actually install the 'python2-tracer' package. So no problems should arise.

Well my experience is different.

I just built tracer in Copr [1], enabled the repository on my machine and did `dnf install tracer`. It installed only tracer package without python2-tracer, so

[vagrant@localhost ~]$ rpm -ql tracer
(contains no files)

[vagrant@localhost ~]$ rpm -ql python2-tracer
package python2-tracer is not installed

[vagrant@localhost ~]$ rpm -ql python3-tracer
package python3-tracer is not installed

[vagrant@localhost ~]$ ls /usr/bin/tracer*
ls: cannot access /usr/bin/tracer*: No such file or directory



[1] https://copr.fedorainfracloud.org/coprs/frostyx/tracer/build/428836/

Comment 12 Petr Viktorin 2016-07-29 08:46:47 UTC
The problem is that there is an empty "%files" section:

...
-%files -f %{name}.lang
-%doc LICENSE README.md
+%files
+%files -n python2-%{name} -f %{name}.lang
+%license LICENSE
+%doc README.md
...

You want only "%files -n python2-%{name}" and "%files -n python3-%{name}", not "%files". That way the empty "tracer" binary package won't be built.

Comment 13 Fedora Update System 2016-08-01 10:58:05 UTC
tracer-0.6.10-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-5ddfc70876

Comment 14 Fedora Update System 2016-08-01 10:58:18 UTC
tracer-0.6.10-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-86aee67549

Comment 15 Fedora Update System 2016-08-01 20:53:38 UTC
tracer-0.6.10-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-5ddfc70876

Comment 16 Fedora Update System 2016-08-01 20:56:54 UTC
tracer-0.6.10-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-86aee67549

Comment 17 Jakub Kadlčík 2016-08-04 21:21:10 UTC
Well, I don't know.

sudo dnf --enablerepo=updates-testing --refresh --best install tracer

still gets 0.6.9-1.fc23 from @updates. However when I try

sudo dnf --enablerepo=updates-testing --refresh --best install python2-tracer

I get 0.6.10-1.fc23 from @updates-testing

Am I missing something? Is it supposed to work this way or the spec file is still wrong?


Thank you guys for helping.

Comment 18 Tomas Orsava 2016-08-05 10:39:22 UTC
Hi Jakub!

When I try this command, it looks correct:

$ dnf --enablerepo=updates-testing --refresh repoquery --provides python2-tracer
...
python-tracer = 0.6.10-1.fc23
python2-tracer = 0.6.10-1.fc23
tracer = 0.6.10-1.fc23

Therefore I think this may be just an issue of the testing repos.

You can add also a `Obsoletes:      %{name} <= %{version}-%{release}` tag underneath the `Provides` tag to be absolutely sure.

Alternatively, try pushing to stable. If the problem persists, the only harm will be that people using `tracer` won't get the update just yet, and you can add the Obsoletes tag.

P.S. I believe you forgot to push your update to the newly created `f25` branch.

Comment 19 Fedora Update System 2016-08-06 10:01:04 UTC
tracer-0.6.11-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-2d83b8297f

Comment 20 Fedora Update System 2016-08-06 10:01:16 UTC
tracer-0.6.11-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-286047f96a

Comment 21 Fedora Update System 2016-08-09 01:23:01 UTC
tracer-0.6.11-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-2d83b8297f

Comment 22 Fedora Update System 2016-08-09 01:26:57 UTC
tracer-0.6.11-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-286047f96a

Comment 23 Fedora Update System 2016-08-22 16:53:02 UTC
tracer-0.6.11-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 24 Fedora Update System 2016-08-22 19:20:30 UTC
tracer-0.6.11-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.


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