From 6fc084d34105f336fdf090e2dd45e402e25cfc57 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Jun 2006 10:11:25 +0200 Subject: * python/depcache.cc: - added "DepCache.IsGarbage" flag --- python/depcache.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'python/depcache.cc') diff --git a/python/depcache.cc b/python/depcache.cc index e8140e2b..60bbc1a4 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -370,6 +370,20 @@ static PyObject *PkgDepCacheIsUpgradable(PyObject *Self,PyObject *Args) return HandleErrors(Py_BuildValue("b",state.Upgradable())); } +static PyObject *PkgDepCacheIsGarbage(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp(PackageObj); + pkgDepCache::StateCache &state = (*depcache)[Pkg]; + + return HandleErrors(Py_BuildValue("b",state.Garbage)); +} + static PyObject *PkgDepCacheIsNowBroken(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp(Self); @@ -507,6 +521,7 @@ static PyMethodDef PkgDepCacheMethods[] = {"IsUpgradable",PkgDepCacheIsUpgradable,METH_VARARGS,"Is pkg upgradable"}, {"IsNowBroken",PkgDepCacheIsNowBroken,METH_VARARGS,"Is pkg is now broken"}, {"IsInstBroken",PkgDepCacheIsInstBroken,METH_VARARGS,"Is pkg broken on the current install"}, + {"IsGarbage",PkgDepCacheIsGarbage,METH_VARARGS,"Is pkg garbage (mark-n-sweep)"}, {"MarkedInstall",PkgDepCacheMarkedInstall,METH_VARARGS,"Is pkg marked for install"}, {"MarkedUpgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"}, {"MarkedDelete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"}, -- cgit v1.2.3 From 0d6bdd9d329f6527f6a5f2337828e03c2e2af508 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 6 Oct 2006 17:22:40 +0200 Subject: * python/depcache.cc: - suport for pkgActionGrup added --- debian/changelog | 2 +- python/depcache.cc | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) (limited to 'python/depcache.cc') diff --git a/debian/changelog b/debian/changelog index d9b428bd..b1099dea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,7 +10,7 @@ python-apt (0.6.19) unstable; urgency=low - fix commit doc string to also cite the open related callbacks - allow change of rootdir for APT database loading - -- + -- Michael Vogt Tue, 27 Jun 2006 16:51:56 +0200 python-apt (0.6.18) unstable; urgency=low diff --git a/python/depcache.cc b/python/depcache.cc index 60bbc1a4..159a7103 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -745,3 +745,73 @@ PyTypeObject PkgProblemResolverType = }; /*}}}*/ + +// pkgActionGroup Class /*{{{*/ +// --------------------------------------------------------------------- + + +static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args) +{ + pkgDepCache::ActionGroup *ag = GetCpp(Self); + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + ag->release(); + Py_INCREF(Py_None); + return HandleErrors(Py_None); +} + +static PyMethodDef PkgActionGroupMethods[] = +{ + {"release", PkgActionGroupRelease, METH_VARARGS, "release()"}, + {} +}; + + +static PyObject *ActionGroupAttr(PyObject *Self,char *Name) +{ + pkgDepCache::ActionGroup *ag = GetCpp(Self); + + return Py_FindMethod(PkgActionGroupMethods,Self,Name); +} + + +PyTypeObject PkgActionGroupType = +{ + PyObject_HEAD_INIT(&PyType_Type) + 0, // ob_size + "pkgActionGroup", // tp_name + sizeof(CppOwnedPyObject), // tp_basicsize + 0, // tp_itemsize + // Methods + CppOwnedDealloc, // tp_dealloc + 0, // tp_print + ActionGroupAttr, // tp_getattr + 0, // tp_setattr + 0, // tp_compare + 0, // tp_repr + 0, // tp_as_number + 0, // tp_as_sequence + 0, // tp_as_mapping + 0, // tp_hash +}; + +PyObject *GetPkgActionGroup(PyObject *Self,PyObject *Args) +{ + PyObject *Owner; + if (PyArg_ParseTuple(Args,"O!",&PkgDepCacheType,&Owner) == 0) + return 0; + + pkgDepCache *depcache = GetCpp(Owner); + pkgDepCache::ActionGroup *group = new pkgDepCache::ActionGroup(*depcache); + CppOwnedPyObject *PkgActionGroupPyObj; + PkgActionGroupPyObj = CppOwnedPyObject_NEW(Owner, + &PkgActionGroupType, + group); + HandleErrors(PkgActionGroupPyObj); + + return PkgActionGroupPyObj; + +} + + + /*}}}*/ -- cgit v1.2.3 From 4a741085e3895d83aa3b0a522123a923b0a64aa4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Jan 2007 17:20:29 +0100 Subject: * support "fromUser()" flag in apt.Package.markInstall() to make setting the automatic install information available --- apt/package.py | 5 +++-- python/depcache.cc | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'python/depcache.cc') diff --git a/apt/package.py b/apt/package.py index 0d1145ea..f67ad6ce 100644 --- a/apt/package.py +++ b/apt/package.py @@ -290,12 +290,13 @@ class Package(object): Fix.InstallProtect() Fix.Resolve() self._pcache.cachePostChange() - def markInstall(self, autoFix=True, autoInst=True): + def markInstall(self, autoFix=True, autoInst=True, fromUser=True): """ mark a package for install. Run the resolver if autoFix is set, automatically install required dependencies if autoInst is set + record it as automatically installed when fromuser is set to false """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg, autoInst) + self._depcache.MarkInstall(self._pkg, autoInst, fromUser) # try to fix broken stuff if autoFix and self._depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(self._depcache) diff --git a/python/depcache.cc b/python/depcache.cc index 159a7103..71e6a2e6 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -346,11 +346,13 @@ static PyObject *PkgDepCacheMarkInstall(PyObject *Self,PyObject *Args) PyObject *PackageObj; char autoInst=1; - if (PyArg_ParseTuple(Args,"O!|b",&PackageType,&PackageObj, &autoInst) == 0) + char fromUser=1; + if (PyArg_ParseTuple(Args,"O!|bb",&PackageType,&PackageObj, + &autoInst, &fromUser) == 0) return 0; pkgCache::PkgIterator &Pkg = GetCpp(PackageObj); - depcache->MarkInstall(Pkg, autoInst); + depcache->MarkInstall(Pkg, autoInst, 0, fromUser); Py_INCREF(Py_None); return HandleErrors(Py_None); -- cgit v1.2.3 From 9a97aa02892342fa4fe7e2f8e3bfe314f194ef0e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 16:44:10 +0100 Subject: * python/depache.cc: - properly support isAutoInstalled flag --- debian/changelog | 4 +++- python/depcache.cc | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'python/depcache.cc') diff --git a/debian/changelog b/debian/changelog index 974662bc..7e897122 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ python-apt (0.6.20ubuntu13) feisty; urgency=low * fix in the duplicated source checking (thanks to Sebastian Heinlein) + * python/depache.cc: + - properly support isAutoInstalled flag - -- + -- Michael Vogt Wed, 14 Mar 2007 16:38:22 +0100 python-apt (0.6.20ubuntu12) feisty; urgency=low diff --git a/python/depcache.cc b/python/depcache.cc index 71e6a2e6..94ff708c 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -386,6 +386,20 @@ static PyObject *PkgDepCacheIsGarbage(PyObject *Self,PyObject *Args) return HandleErrors(Py_BuildValue("b",state.Garbage)); } +static PyObject *PkgDepCacheIsAutoInstalled(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp(PackageObj); + pkgDepCache::StateCache &state = (*depcache)[Pkg]; + + return HandleErrors(Py_BuildValue("b",state.Flags & pkgCache::Flag::Auto)); +} + static PyObject *PkgDepCacheIsNowBroken(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp(Self); @@ -524,6 +538,7 @@ static PyMethodDef PkgDepCacheMethods[] = {"IsNowBroken",PkgDepCacheIsNowBroken,METH_VARARGS,"Is pkg is now broken"}, {"IsInstBroken",PkgDepCacheIsInstBroken,METH_VARARGS,"Is pkg broken on the current install"}, {"IsGarbage",PkgDepCacheIsGarbage,METH_VARARGS,"Is pkg garbage (mark-n-sweep)"}, + {"IsAutoInstalled",PkgDepCacheIsAutoInstalled,METH_VARARGS,"Is pkg marked as auto installed"}, {"MarkedInstall",PkgDepCacheMarkedInstall,METH_VARARGS,"Is pkg marked for install"}, {"MarkedUpgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"}, {"MarkedDelete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"}, -- cgit v1.2.3