Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 765427 - dev-util/diffoscope ebuild missing python ncurses USE dependency
Summary: dev-util/diffoscope ebuild missing python ncurses USE dependency
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sergei Trofimovich (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2021-01-14 12:10 UTC by Berne Campbell
Modified: 2021-01-16 02:00 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.log,5.67 KB, text/plain)
2021-01-14 12:10 UTC, Berne Campbell
Details
Proposed Patch (diffoscope-164.ebuild.patch,286 bytes, patch)
2021-01-15 00:34 UTC, Berne Campbell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Berne Campbell 2021-01-14 12:10:47 UTC
Created attachment 682873 [details]
emerge --info

diffoscope needs python with ncurses USE flag.

I emerge diffoscope-164, when I  try to run it, python crashes due to ModuleNotFoundError for `_curses`.
Looking at python USE flags enabled, I had -ncurses. After I `+ncurses` and re-emerged python:3.8, diffoscope started to work.
The diffoscope ebuild should be fixed to signal python needs ncurses as a dependency. I'm confused by python eclasses and not sure the proper way to this. I think it needs `PYTHON_REQ_USE="ncurses".

```
kubler-bob-musl ~ # eix diffoscope
[I] dev-util/diffoscope
     Available versions:  ~163 (~)164 {R acl binutils bzip2 colord cpio +diff docx dtc e2fsprogs file find gettext gif gpg gzip haskell hdf5 hex imagemagick iso java libcaca llvm mono opendocument pascal pdf postscript rpm sqlite squashfs ssh tar tcpdump xz zip zstd PYTHON_TARGETS="python3_7 python3_8"}
     Installed versions:  164(09:55:32 01/13/21)(acl bzip2 diff -R -binutils -colord -cpio -docx -dtc -e2fsprogs -file -find -gettext -gif -gpg -gzip -haskell -hdf5 -hex -imagemagick -iso -java -libcaca -llvm -mono -opendocument -pascal -pdf -postscript -rpm -sqlite -squashfs -ssh -tar -tcpdump -xz -zip -zstd PYTHON_TARGETS="python3_8 -python3_7")
     Homepage:            https://diffoscope.org/ https://pypi.org/project/diffoscope/
     Description:         Will try to get to the bottom of what makes files or directories different
```

```
kubler-bob-musl ~ # diffoscope /var/db/repos/berne/net-libs/libssh2/ /config/berne/net-libs/libssh2/
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.8/diffoscope", line 33, in <module>                                                                                                                                                                                                                                                        sys.exit(load_entry_point('diffoscope==164', 'console_scripts', 'diffoscope')())
  File "/usr/lib/python-exec/python3.8/diffoscope", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.8/site-packages/diffoscope/main.py", line 44, in <module>                                                                                                                                                                                                                                              from .logging import line_eraser, setup_logging
  File "/usr/lib/python3.8/site-packages/diffoscope/logging.py", line 20, in <module>
    import curses
  File "/usr/lib/python3.8/curses/__init__.py", line 13, in <module>
    from _curses import *
ModuleNotFoundError: No module named '_curses' 
```

```
kubler-bob-musl ~ # equery u '<python-3.9'
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-lang/python-3.8.6-r1:
 U I
 - - bluetooth : Build Bluetooth protocol support in socket module
 - - build     : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping [make stage1]
 - - examples  : Install examples, usually source code
 - - gdbm      : Add support for sys-libs/gdbm (GNU database libraries)
 + + hardened  : Activate default security enhancements for toolchain (gcc, glibc, binutils)
 - - ipv6      : Add support for IP version 6
 + + libressl  : Use dev-libs/libressl instead of dev-libs/openssl when applicable (see also the ssl useflag)
 - - ncurses   : Add ncurses support (console display library)
 + + readline  : Enable support for libreadline, a GNU line-editing library that almost everyone wants
 - - sqlite    : Add support for sqlite - embedded sql database
 + + ssl       : Add support for SSL/TLS connections (Secure Socket Layer / Transport Layer Security)
 - - test      : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
 - - tk        : Add support for Tk GUI toolkit
 - - wininst   : Install Windows executables required to create an executable installer for MS Windows.
 + + xml       : Add support for XML files
```
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2021-01-14 13:15:21 UTC
PYTHON_REQ_USE= solution sounds right. Do you want to write a patch yourself?

I would use `git am` to apply it.
Comment 2 Berne Campbell 2021-01-15 00:34:28 UTC
What confused me was I thought the ebuild would need to inherit the right python eclass, but it doesn't seem to matter that it doesn't inherit any.

I updated the ebuild with the `PYTHON_REQ_USE=ncurses` and it works.

I had rebuild python:3.8 to have -ncurses, and then tried to emerge diffoscope, and it detects the need to add +ncurses to python:3.8.

```
kubler-bob-musl /var/db/repos/berne/dev-util/diffoscope # emerge -vat diffoscope --usepkg=n

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild  N    ~] dev-util/diffoscope-164::berne  USE="acl bzip2 diff -R -binutils -colord -cpio -docx -dtc -e2fsprogs -file -find -gettext -gif -gpg -gzip -haskell -hdf5 -hex -imagemagick -iso -java -libcaca -llvm -mono -opendocument -pascal -pdf -postscript -rpm -sqlite -squashfs -ssh -tar -tcpdump -xz -zip -zstd" PYTHON_TARGETS="python3_8 -python3_7" 0 KiB
[ebuild   R    ]  dev-lang/python-3.8.6-r1:3.8::gentoo  USE="hardened ncurses* readline ssl xml -bluetooth -build -examples -gdbm -ipv6 -libressl -sqlite -test -tk -wininst" 0 KiB

Total: 2 packages (1 new, 1 reinstall), Size of downloads: 0 KiB

The following USE changes are necessary to proceed:
 (see "package.use" in the portage(5) man page for more details)
# required by dev-util/diffoscope-164::berne[python_targets_python3_8]
# required by diffoscope (argument)
>=dev-lang/python-3.8.6-r1:3.8 ncurses

Would you like to add these changes to your config files? [Yes/No]
```
Comment 3 Berne Campbell 2021-01-15 00:34:55 UTC
Created attachment 682963 [details, diff]
Proposed Patch
Comment 4 Berne Campbell 2021-01-15 00:36:53 UTC
I forgot to check [x] patch on the attachment.
Comment 5 Larry the Git Cow gentoo-dev 2021-01-15 08:20:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b69bd014b5b12c7d55d9578d4d09df3b1b46b4c8

commit b69bd014b5b12c7d55d9578d4d09df3b1b46b4c8
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-01-15 07:46:46 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-01-15 08:19:58 +0000

    dev-util/diffoscope: add python[ncurses] depend
    
    Fix-by: Berne Campbell
    Closes: https://bugs.gentoo.org/765427
    Package-Manager: Portage-3.0.13, Repoman-3.0.2
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-util/diffoscope/{diffoscope-164.ebuild => diffoscope-164-r1.ebuild} | 2 ++
 1 file changed, 2 insertions(+)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2021-01-15 08:20:31 UTC
Thank you!
Comment 7 Berne Campbell 2021-01-16 02:00:42 UTC
Thank you!