Bug 2016019 - The python3-apt package needs “dpkg” and “dpkg-source” executables
Summary: The python3-apt package needs “dpkg” and “dpkg-source” executables
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-apt
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Neal Gompa
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-10-20 15:50 UTC by Ben Beasley
Modified: 2022-01-31 01:14 UTC (History)
3 users (show)

Fixed In Version: python-apt-2.3.0-1.fc34 python-apt-2.3.0-1.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-31 01:11:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ben Beasley 2021-10-20 15:50:32 UTC
Description of problem:

The python3-apt package does not work without /usr/bin/dpkg (provided by “dpkg”) and, to a lesser degree, /usr/bin/dpkg-source (provided by “dpkg-dev”).

Version-Release number of selected component (if applicable): 2.2.0-1.fc34


How reproducible:

Here I demonstrate the problem with diffoscope, but I find that there is no bug in diffoscope.

Steps to Reproduce:
1. $ sudo dnf install diffoscope
2. $ diffoscope --help

Actual results:

> Traceback (most recent call last):
>   File "/usr/lib/python3.9/site-packages/diffoscope/main.py", line 737, in main
>     parsed_args = parser.parse_args(args)
>   File "/usr/lib64/python3.9/argparse.py", line 1820, in parse_args
>     args, argv = self.parse_known_args(args, namespace)
>   File "/usr/lib64/python3.9/argparse.py", line 1853, in parse_known_args
>     namespace, args = self._parse_known_args(args, namespace)
>   File "/usr/lib64/python3.9/argparse.py", line 2062, in _parse_known_args
>     start_index = consume_optional(start_index)
>   File "/usr/lib64/python3.9/argparse.py", line 2002, in consume_optional
>     take_action(action, args, option_string)
>   File "/usr/lib64/python3.9/argparse.py", line 1930, in take_action
>     action(self, namespace, argument_values, option_string)
>   File "/usr/lib64/python3.9/argparse.py", line 1094, in __call__
>     parser.print_help()
>   File "/usr/lib64/python3.9/argparse.py", line 2550, in print_help
>     self._print_message(self.format_help(), file)
>   File "/usr/lib64/python3.9/argparse.py", line 2534, in format_help
>     return formatter.format_help()
>   File "/usr/lib/python3.9/site-packages/diffoscope/main.py", line 487, in format_help
>     ComparatorManager().format_descriptions(),
>   File "/usr/lib/python3.9/site-packages/diffoscope/comparators/__init__.py", line 123, in __init__
>     self.reload()
>   File "/usr/lib/python3.9/site-packages/diffoscope/comparators/__init__.py", line 134, in reload
>     mod = importlib.import_module(
>   File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)
>   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
>   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
>   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
>   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
>   File "/usr/lib/python3.9/site-packages/diffoscope/comparators/debian.py", line 24, in <module>
>     from debian.deb822 import Dsc, Deb822
>   File "/usr/lib/python3.9/site-packages/debian/deb822.py", line 283, in <module>
>     import debian.debian_support
>   File "/usr/lib/python3.9/site-packages/debian/debian_support.py", line 46, in <module>
>     apt_pkg.init()
> apt_pkg.Error: W:Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory), E:Unable to determine a suitable packaging system type                                                                                                                      

Expected results:

> usage: diffoscope [--debug] [--pdb] [--status-fd FD] [--progress]
>                   [--no-default-limits] [--text OUTPUT_FILE]
>                   [--text-color WHEN] [--output-empty] [--html OUTPUT_FILE]
>                   [--html-dir OUTPUT_DIR] [--css URL] [--jquery URL]
> […]
> bugs/issues:
>                         <https://salsa.debian.org/reproducible-builds/diffoscope/issues>

Additional info:


Simply creating the apt configuration directory,

> $ mkdir -p /etc/apt/apt.conf.d

makes little difference. The traceback is the same; the warning disappears but the error remains.

Installing “dpkg” fixes the problem. Removing python3-apt (which is a weak dependency of python3-debian) *also* fixes the problem.

-----

The diffoscope package depends on python3-debian, which has a weak dependency on python3-apt. The python-debian package appears to have a fallback for when python-apt is not installed (ImportError on apt_pkg), but not for when apt_pkg.init() fails this way.

-----

In the python-apt source tree:

> $ grep -ErnI "['\"]dpkg" apt
apt/cache.py:140:                               os.path.join(rootdir, "usr", "bin", "dpkg"))
> apt/cache.py:763:        'dpkg --configure -a' as root.
> apt/debfile.py:725:            return os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "-i", self.filename)
> apt/package.py:943:            subprocess.check_call(["dpkg-source", "-x", dsc, outdir])
> apt/progress/base.py:239:                os._exit(os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "--status-fd",

My conclusion is that runtime dependencies on these command-line tools should be added to python3-apt, i.e.,

> Requires:       /usr/bin/dpkg
> Requires:       /usr/bin/dpkg-source

Comment 1 Ben Beasley 2021-10-20 15:52:55 UTC
CC’ing the diffoscope maintainers as a heads-up, although I don’t believe any changes in that package are needed.

Comment 2 Ben Beasley 2021-10-20 15:55:15 UTC
(Sorry, wrong Zbigniew!)

Comment 3 Zbigniew Jędrzejewski-Szmek 2021-10-21 07:15:29 UTC
Yeah, seems like something to be improved in python3-apt.

Comment 4 Fedora Update System 2022-01-27 13:52:57 UTC
FEDORA-2022-5a15b7ab52 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2022-5a15b7ab52

Comment 5 Fedora Update System 2022-01-27 13:53:04 UTC
FEDORA-2022-3f6e44d506 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-3f6e44d506

Comment 6 Fedora Update System 2022-01-27 22:34:00 UTC
FEDORA-2022-5a15b7ab52 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-5a15b7ab52`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-5a15b7ab52

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2022-01-27 22:51:53 UTC
FEDORA-2022-3f6e44d506 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-3f6e44d506`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-3f6e44d506

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2022-01-31 01:11:50 UTC
FEDORA-2022-5a15b7ab52 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2022-01-31 01:14:46 UTC
FEDORA-2022-3f6e44d506 has been pushed to the Fedora 35 stable repository.
If problem still persists, 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.