Bug 219794 - devel/py-backports.* conflict with each other: file conflict caused by backports/__init__.py (all provide the file)
Summary: devel/py-backports.* conflict with each other: file conflict caused by backpo...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-python (Nobody)
URL: https://reviews.freebsd.org/D11095
Keywords: needs-patch, needs-qa
: 220749 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-05 04:08 UTC by Ting-Wei Lan
Modified: 2018-01-01 15:05 UTC (History)
8 users (show)

See Also:
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ting-Wei Lan 2017-06-05 04:08:22 UTC
These 4 ports install the file /usr/local/lib/python2.7/site-packages/backports/__init__.py, causing conflict when users try to install more than one of them:

devel/py-backports.functools_lru_cache
devel/py-backports.shutil_get_terminal_size
security/py-backports.ssl_match_hostname
archivers/py-backports.lzma


This means that I cannot install ipython and totem on the same system because the former depends on shutil_get_terminal_size and the latter depends on functools_lru_cache.

===>   Registering installation for py27-backports.functools_lru_cache-1.4 as automatic
Installing py27-backports.functools_lru_cache-1.4...
pkg-static: py27-backports.functools_lru_cache-1.4 conflicts with py27-backports.shutil_get_terminal_size-1.0.0 (installs files into the same place).  Problematic file: /usr/local/lib/python2.7/site-packages/backports/__init__.py
*** Error code 70

Stop.
make: stopped in /usr/ports/devel/py-backports.functools_lru_cache
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2017-06-05 08:09:28 UTC
See also question/answer on freebsd-ports (cc post author)
Comment 2 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-07 22:42:33 UTC
In all four of these, __init__.py does the same thing:
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Maybe we can create a separate port just for this file and remove it from the other four?
Comment 3 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-07 23:15:10 UTC
Installing these from PyPi causes __init__.py to be clobbered with each of these 4 modules but with compatible content.
Comment 4 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-07 23:23:04 UTC
We could make a separate port for just backports/__init__.py and do this in each of these 4:

post-install:
	@${REINPLACE_CMD} '|backports/__init__.py*|d' ${TMPPLIST}
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2017-06-08 00:00:57 UTC
(In reply to Nikolai Lifanov from comment #4)

That is what was proposed (in my response) in the mailing list link added in comment 1
Comment 6 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-08 00:02:54 UTC
OK, yep, this makes sense. Sorry, I didn't see the mailman link.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2017-06-08 00:19:19 UTC
(In reply to Nikolai Lifanov from comment #6)

No apology necessary, I was just pointing it out explicitly in case it wasn't obvious

I'm not sure to what extent that structure might work, but it's worth someone prototyping at least to identify any potential issues.
Comment 8 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-08 16:33:16 UTC
If the content of these 4 is compatible, I don't see why not.
Let's see what the other maintainers might say.
Comment 9 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-09 12:28:38 UTC
I put up a proposal on Phabricator:
https://reviews.freebsd.org/D11095

Can you review this and let me know whether this makes sense and I'll attach this and patches for the 4 ports to this PR.
Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2017-07-16 09:40:51 UTC
Canonicalise summary to reflect that all/any "backports" ports will conflict in the same way. Record original list of 4 reported here:

devel/py-backports.functools_lru_cache
devel/py-backports.shutil_get_terminal_size
security/py-backports.ssl_match_hostname
archivers/py-backports.lzma

Mailing list post: https://lists.freebsd.org/pipermail/freebsd-ports/2017-May/108742.html
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2017-07-16 09:42:05 UTC
Add two more from bug 220749:

devel/py-backports.weakref
devel/py-backports.shutil
Comment 12 Kubilay Kocak freebsd_committer freebsd_triage 2017-07-16 09:42:10 UTC
*** Bug 220749 has been marked as a duplicate of this bug. ***
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2017-07-16 09:44:40 UTC
Blocks tensorflow port (bug 219609), see bug 220749 comment 0
Comment 14 Po-Chuan Hsieh freebsd_committer freebsd_triage 2017-07-16 10:25:08 UTC
Current list of py-backports.* ports:
archivers/py-backports.lzma
devel/py-backports.csv
devel/py-backports.functools_lru_cache
devel/py-backports.shutil_get_terminal_size
devel/py-backports.weakref
security/py-backports.ssl_match_hostname
Comment 15 Yuri Victorovich freebsd_committer freebsd_triage 2017-07-16 17:43:32 UTC
One way to solve this is to create a single parent package that will only provide __init__.py

Upstream: https://bitbucket.org/brandon/backports/issues/6/many-backports-packages-conflict-with-each https://github.com/chrippa/backports.shutil_get_terminal_size/issues/15
Comment 16 Nikolai Lifanov freebsd_committer freebsd_triage 2017-07-16 22:41:34 UTC
Yuri, there is a proposed review in the link above that does just that.
I would like some feedback on it or maybe a different approach.
Comment 17 Yuri Victorovich freebsd_committer freebsd_triage 2017-07-24 22:16:49 UTC
Idea to solve this through the pkg feature:
https://lists.freebsd.org/pipermail/freebsd-pkg/2017-July/002222.html
Comment 18 Nikolai Lifanov freebsd_committer freebsd_triage 2017-07-25 12:59:37 UTC
The problem with these specifically is that backports/__init__.py is different in every case: indentation, spacing, comments, etc. However, functionally it's the same thing.

I discussed that approach with people briefly and it seems like something not trivial/not desirable to have, but maybe a new discussion can produce different results.

The way pip handles it (and other distros) is just allow the clobbering to happen and last installed package wins.
Comment 19 Nikolai Lifanov freebsd_committer freebsd_triage 2018-01-01 15:05:48 UTC
A solution to this has been committed.