Comment 7 for bug 1773316

Revision history for this message
Julian Andres Klode (juliank) wrote :

Fix works fine:

root@bionic:~# python3 -c "import apt; c=apt.Cache(); p=c['aptitude']; c.open(); p.mark_install()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/apt/package.py", line 1469, in mark_install
    self._pcache._depcache.mark_install(self._pkg, auto_inst, from_user)
ValueError: Object of different cache passed as argument to apt_pkg.DepCache method
root@bionic:~# dpkg -i python3-apt_1.6.1_amd64.deb
(Reading database ... 29845 files and directories currently installed.)
Preparing to unpack python3-apt_1.6.1_amd64.deb ...
Unpacking python3-apt (1.6.1) over (1.6.0) ...
Setting up python3-apt (1.6.1) ...
root@bionic:~# python3 -c "import apt; c=apt.Cache(); p=c['aptitude']; c.open(); p.mark_install()"

another check:

root@bionic:~# python3 -c "import apt; c=apt.Cache(); p=c['aptitude']; c.open(); p.mark_delete(); print(c.get_changes()); c.commit()"
[<Package: name:'aptitude' architecture='amd64' id:257>]
(Reading database ... 29852 files and directories currently installed.)
Removing aptitude (0.8.10-6ubuntu1) ...