[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#862951: python-apt: apt.Package.mark_reinstall() missing; apt.Package.marked_reinstall doesn't work



On Fri, May 19, 2017 at 10:46:45AM +0200, Michael Schaller wrote:
> Package: python-apt
> Version: 1.4.0~beta3
> Severity: normal
> 
> Dear Maintainer,
> 
> apt.Package.mark_install() is missing but apt.Package.marked_install is present.

No, that's not true. Both exist. I guess you mean reinstall here? Adding reinstall
support there is out of scope for now, though, due to freeze.

> 
> When I mark a package for reinstallation via 'cache._depcache.set_reinstall(pkg._pkg, True)' then neither 'cache._depcache.marked_reinstall(pkg._pkg)' nor 'pkg.marked_reinstall' return True.
> Furthermore on commit the package(s) marked for reinstall will be reinstalled but beforehand 'cache.get_changes()' doesn't include the package(s) marked for reinstallation.

Please try this patch, it changes the code to use APT's function:

diff --git a/python/depcache.cc b/python/depcache.cc
index d73e4d93..cf6e959e 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -562,9 +562,7 @@ static PyObject *PkgDepCacheMarkedReinstall(PyObject *Self,PyObject *Args)
    pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
    pkgDepCache::StateCache &state = (*depcache)[Pkg];

-   bool res = state.Install() && (state.iFlags & pkgDepCache::ReInstall);
-
-   return HandleErrors(PyBool_FromLong(res));
+   return HandleErrors(PyBool_FromLong(state.ReInstall()));
 }



-- 
Debian Developer - deb.li/jak | jak-linux.org - free software dev
                  |  Ubuntu Core Developer |
When replying, only quote what is necessary, and write each reply
directly below the part(s) it pertains to ('inline').  Thank you.


Reply to: