From 251a9c10f4c848df5d1daaef63a16e4ce6d5dc0b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Mar 2006 18:58:21 +0000 Subject: * added purge option --- apt/package.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 4fceb904..66bfd72b 100644 --- a/apt/package.py +++ b/apt/package.py @@ -274,10 +274,13 @@ class Package(object): self._pcache.cachePreChange() self._depcache.MarkKeep(self._pkg) self._pcache.cachePostChange() - def markDelete(self, autoFix=True): - """ mark a package for delete. Run the resolver if autoFix is set """ + def markDelete(self, autoFix=True, purge=False): + """ mark a package for delete. Run the resolver if autoFix is set. + Mark the package as purge (remove with configuration) if 'purge' + is set. + """ self._pcache.cachePreChange() - self._depcache.MarkDelete(self._pkg) + self._depcache.MarkDelete(self._pkg, purge) # try to fix broken stuffsta if autoFix and self._depcache.BrokenCount > 0: Fix = apt_pkg.GetPkgProblemResolver(self._depcache) -- cgit v1.2.3 From b47ce124b9672ea58f87dd2380c409566ffcfefd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 May 2006 18:14:35 +0200 Subject: * prepared new upload with cherry picked patch from mainline --- apt/package.py | 11 +++++++---- debian/changelog | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 66bfd72b..9f329069 100644 --- a/apt/package.py +++ b/apt/package.py @@ -49,7 +49,7 @@ class Package(object): # check if we found a version if ver == None: - #print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) + print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) return False if ver.FileList == None: @@ -149,13 +149,15 @@ class Package(object): def summary(self): """ Return the short description (one line summary) """ - self._lookupRecord() + if not self._lookupRecord(): + return "" return self._records.ShortDesc summary = property(summary) def description(self, format=True): """ Return the formated long description """ - self._lookupRecord() + if not self._lookupRecord(): + return "" desc = "" for line in string.split(self._records.LongDesc, "\n"): tmp = string.strip(line) @@ -168,7 +170,8 @@ class Package(object): def rawDescription(self): """ return the long description (raw)""" - self._lookupRecord() + if not self._lookupRecord(): + return "" return self._records.LongDesc rawDescription = property(rawDescription) diff --git a/debian/changelog b/debian/changelog index 6859407c..9822dc42 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python-apt (0.6.16.2ubuntu7) dapper; urgency=low + + * apt/package.py: + - check if _lookupRecord() succeeded when checking + maintainer or description (fixes invalid descriptions under + rare circumstances in gnome-app-install) + + -- Michael Vogt Wed, 17 May 2006 18:12:58 +0200 + python-apt (0.6.16.2ubuntu6) dapper; urgency=low * debian/control: -- cgit v1.2.3 From d2a77ae729cfc02263330743f75617c881f1c808 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 May 2006 18:15:00 +0200 Subject: * merged with mainline --- apt/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 9f329069..d0119b6f 100644 --- a/apt/package.py +++ b/apt/package.py @@ -49,7 +49,7 @@ class Package(object): # check if we found a version if ver == None: - print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) + #print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) return False if ver.FileList == None: -- cgit v1.2.3 From a7af5ff42bdc6cd8d8652f7304926a7b58686c70 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 May 2006 19:29:39 +0200 Subject: * cherry picked from main --- apt/package.py | 4 ++-- debian/changelog | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index d0119b6f..dfb74789 100644 --- a/apt/package.py +++ b/apt/package.py @@ -105,12 +105,12 @@ class Package(object): return ver.Downloadable def candidateDownloadable(self): " returns if the canidate is downloadable " - self._downloadable(useCandidate=True) + return self._downloadable(useCandidate=True) candidateDownloadable = property(candidateDownloadable) def installedDownloadable(self): " returns if the installed version is downloadable " - self._downloadable(useCandidate=False) + return self._downloadable(useCandidate=False) installedDownloadable = property(installedDownloadable) def sourcePackageName(self): diff --git a/debian/changelog b/debian/changelog index 9822dc42..bc6f5177 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +python-apt (0.6.16.2ubuntu8) dapper; urgency=low + + * apt/package.py: + - fix return value in {candidate,installed}Downloadable + + -- Michael Vogt Wed, 17 May 2006 19:28:44 +0200 + python-apt (0.6.16.2ubuntu7) dapper; urgency=low * apt/package.py: -- cgit v1.2.3 From 7330eaf4b883bab1eb8d4b71784c2e60d56db82d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Aug 2006 17:18:22 +0200 Subject: * apt/package.py: - make description return the correct descripton --- apt/package.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 0d1145ea..e5de93f0 100644 --- a/apt/package.py +++ b/apt/package.py @@ -158,8 +158,12 @@ class Package(object): """ Return the formated long description """ if not self._lookupRecord(): return "" + # get the translated description + ver = self._depcache.GetCandidateVer(self._pkg) + desc_iter = ver.TranslatedDescription + self._records.Lookup(desc_iter.FileList.pop(0)) desc = "" - for line in string.split(self._records.LongDesc, "\n"): + for line in string.split(unicode(self._records.LongDesc,"utf-8"),"\n"): tmp = string.strip(line) if tmp == ".": desc += "\n" -- cgit v1.2.3 From fd31f9b76508663d24c9a5684784cff18c235170 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Aug 2006 17:25:57 +0200 Subject: * apt/package.py: - make shortDesc do the right thing too --- apt/package.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index e5de93f0..4e892082 100644 --- a/apt/package.py +++ b/apt/package.py @@ -151,6 +151,9 @@ class Package(object): """ Return the short description (one line summary) """ if not self._lookupRecord(): return "" + ver = self._depcache.GetCandidateVer(self._pkg) + desc_iter = ver.TranslatedDescription + self._records.Lookup(desc_iter.FileList.pop(0)) return self._records.ShortDesc summary = property(summary) -- cgit v1.2.3 From 47a1e41c1786a637c2bef222d0f304c6c19a2b8d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 3 Nov 2006 22:04:04 +0100 Subject: * apt/progress.py: - protect against unparsable strings from dpkg --- apt/progress.py | 7 ++++++- debian/changelog | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'apt') diff --git a/apt/progress.py b/apt/progress.py index 8ac0e1dc..5169adf7 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -175,7 +175,12 @@ class InstallProgress(DumbInstallProgress): if self.read.endswith("\n"): s = self.read #print s - (status, pkg, percent, status_str) = string.split(s, ":") + try: + (status, pkg, percent, status_str) = string.split(s, ":",3) + except ValueError, e: + # silently ignore lines that can't be parsed + self.read = "" + return #print "percent: %s %s" % (pkg, float(percent)/100.0) if status == "pmerror": self.error(pkg,status_str) diff --git a/debian/changelog b/debian/changelog index 08e83ae5..c864bf48 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-apt (0.6.19ubuntu9.1) edgy-updates; urgency=low + + * protect against not-parsable strings send from dpkg (lp: 68553) + + -- Michael Vogt Fri, 27 Oct 2006 10:41:44 +0200 + python-apt (0.6.19ubuntu9) edgy; urgency=low * Reupload to restore dependency on python-central. -- 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 'apt') 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 1c878fca17aaa7d8300224e1aed0f13066fe3e84 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Feb 2007 17:11:51 +0100 Subject: * apt/package.py: - handle invalid unicode more gracefully (LP#86215) * rebuild against latest apt --- apt/package.py | 7 ++++++- debian/changelog | 5 ++++- debian/control | 2 +- python/string.cc | 6 ++++-- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index af5dd327..39e2993c 100644 --- a/apt/package.py +++ b/apt/package.py @@ -166,7 +166,12 @@ class Package(object): desc_iter = ver.TranslatedDescription self._records.Lookup(desc_iter.FileList.pop(0)) desc = "" - for line in string.split(unicode(self._records.LongDesc,"utf-8"),"\n"): + try: + s = unicode(self._records.LongDesc,"utf-8") + except UnicodeDecodeError,e: + s = _("Invalid unicode in description for '%s' (%s). " + "Please report.") % (name,e) + for line in string.split(s,"\n"): tmp = string.strip(line) if tmp == ".": desc += "\n" diff --git a/debian/changelog b/debian/changelog index cb818eea..9e0fe1be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,11 @@ python-apt (0.6.20ubuntu6) feisty; urgency=low * aptsources/distro.py: - fix crash in add_source (LP#85806) + * apt/package.py: + - handle invalid unicode more gracefully (LP#86215) + * rebuild against latest apt - -- + -- Michael Vogt Mon, 19 Feb 2007 16:34:52 +0100 python-apt (0.6.20ubuntu5) feisty; urgency=low diff --git a/debian/control b/debian/control index bf1ca1de..b243adb1 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.7.2 XS-Python-Version: all -Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.46.4ubuntu7), apt-utils, python-all-dev, python-distutils-extra, cdbs, python-central (>= 0.5) +Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.46.4ubuntu8), apt-utils, python-all-dev, python-distutils-extra, cdbs, python-central (>= 0.5) Package: python-apt Architecture: any diff --git a/python/string.cc b/python/string.cc index 16adc8cd..d0926da5 100644 --- a/python/string.cc +++ b/python/string.cc @@ -53,9 +53,11 @@ PyObject *StrSizeToStr(PyObject *Self,PyObject *Args) if (PyArg_ParseTuple(Args,"O",&Obj) == 0) return 0; if (PyInt_Check(Obj)) - return CppPyString(SizeToStr(PyInt_AS_LONG(Obj))); + return CppPyString(SizeToStr(PyInt_AsLong(Obj))); + if (PyLong_Check(Obj)) + return CppPyString(SizeToStr(PyLong_AsLong(Obj))); if (PyFloat_Check(Obj)) - return CppPyString(SizeToStr(PyFloat_AS_DOUBLE(Obj))); + return CppPyString(SizeToStr(PyFloat_AsDouble(Obj))); PyErr_SetString(PyExc_TypeError,"Only understand integers and floats"); return 0; -- cgit v1.2.3 From ec30e020ffdcb6cf5f11fd1e761083bd9711c41c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 9 Mar 2007 15:40:39 +0100 Subject: * apt/cdrom.py: - fix bug in cdrom __init__ code * debian/rules: - added "DH_PYCENTRAL=nomove" --- apt/cdrom.py | 4 ++-- debian/changelog | 10 ++++++++++ debian/rules | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'apt') diff --git a/apt/cdrom.py b/apt/cdrom.py index d499b30a..8d73339c 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -1,6 +1,6 @@ import apt_pkg -from apt.progress import CdromProgress +from progress import CdromProgress class Cdrom(object): def __init__(self, progress=None, mountpoint=None, nomount=True): @@ -12,7 +12,7 @@ class Cdrom(object): """ self._cdrom = apt_pkg.GetCdrom() if progress is None: - self._progress = apt.progress.CdromProgress() + self._progress = CdromProgress() else: self._progress = progress # see if we have a alternative mountpoint diff --git a/debian/changelog b/debian/changelog index 5e648c93..c67bc8ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +python-apt (0.6.20ubuntu12) feisty; urgency=low + + * apt/cdrom.py: + - fix bug in cdrom __init__ code + * debian/rules: + - added "DH_PYCENTRAL=nomove" + + + -- Michael Vogt Wed, 7 Mar 2007 10:41:00 +0100 + python-apt (0.6.20ubuntu11) feisty; urgency=low * apt/packages.py: diff --git a/debian/rules b/debian/rules index 63c9bc3b..33d04a21 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,8 @@ DEB_AUTO_CLEANUP_RCS := yes DEB_PYTHON_SYSTEM=pycentral +export DH_PYCENTRAL=nomove + DEB_PYTHON_PACKAGES_EXCLUDE=python-apt-dbg # Add here any variable or target overrides you need -- cgit v1.2.3 From 608943524b167fe6191750b739b0d230b549638c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Mar 2007 15:34:50 +0100 Subject: * fix gettext import (LP#92764) --- apt/package.py | 2 ++ debian/changelog | 1 + 2 files changed, 3 insertions(+) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index fec438c0..1f373ad3 100644 --- a/apt/package.py +++ b/apt/package.py @@ -24,6 +24,8 @@ import sys import random import string +from gettext import gettext as _ + class BaseDependency(object): " a single dependency " def __init__(self, name, rel, ver, pre): diff --git a/debian/changelog b/debian/changelog index 05efcd08..4950be51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ python-apt (0.6.20ubuntu14) feisty; urgency=low * aptsources/distro.py: - fix typo (LP#84009) + * fix gettext import (LP#92764) -- -- cgit v1.2.3 From 6bc3d1c5dd643fd3fd29ec2319cbdef6fe721d25 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Mar 2007 16:01:02 +0100 Subject: * use the correct gettext domain --- apt/package.py | 4 +++- aptsources/distinfo.py | 4 +++- aptsources/distro.py | 4 +++- aptsources/sourceslist.py | 5 ++++- debian/changelog | 6 ++++++ 5 files changed, 19 insertions(+), 4 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index 1f373ad3..f7a1a8ac 100644 --- a/apt/package.py +++ b/apt/package.py @@ -24,7 +24,9 @@ import sys import random import string -from gettext import gettext as _ +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) class BaseDependency(object): " a single dependency " diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index 261243b4..674c1bf5 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -29,7 +29,9 @@ from os import getenv import ConfigParser import string -from gettext import gettext as _ +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) import re diff --git a/aptsources/distro.py b/aptsources/distro.py index 16fb0dc7..fe9b4d75 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -26,7 +26,9 @@ import gettext import re import os import sys -from gettext import gettext as _ +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) class Distribution: diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 208e6c7d..754e2003 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -32,9 +32,12 @@ import shutil import time import os.path import sys -from gettext import gettext as _ +#from gettext import gettext as _ #import pdb +import gettext +def _(s): return gettext.dgettext("python-apt", s) + #from UpdateManager.Common.DistInfo import DistInfo from distinfo import DistInfo diff --git a/debian/changelog b/debian/changelog index 760812e1..280fc0cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-apt (0.6.20ubuntu15) feisty; urgency=low + + * use the correct gettext domain + + -- Michael Vogt Thu, 22 Mar 2007 15:55:54 +0100 + python-apt (0.6.20ubuntu14) feisty; urgency=low * aptsources/distro.py: -- cgit v1.2.3 From 432e7c203151f1829f2dccb7a9f89290478580b9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Apr 2007 14:17:20 +0200 Subject: * fix error in invalid unicode handler (LP#99753) --- apt/package.py | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index f7a1a8ac..b82f1aa0 100644 --- a/apt/package.py +++ b/apt/package.py @@ -223,7 +223,7 @@ class Package(object): s = unicode(self._records.LongDesc,"utf-8") except UnicodeDecodeError,e: s = _("Invalid unicode in description for '%s' (%s). " - "Please report.") % (name,e) + "Please report.") % (self.name,e) for line in string.split(s,"\n"): tmp = string.strip(line) if tmp == ".": diff --git a/debian/changelog b/debian/changelog index 2d40777f..2a76e7f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ python-apt (0.6.20ubuntu15) unstable; urgency=low [ Sebastian Heinlein ] * Update the mirror lists from Launchpad * Only include http and ftp servers - LP#99060 + [Michael Vogt] + * fix error in invalid unicode handler (LP#99753) -- Sebastian Heinlein Mon, 02 Apr 2007 00:02:53 +0200 -- cgit v1.2.3