summaryrefslogtreecommitdiff
path: root/UpdateManager
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-06-28 09:34:48 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-06-28 09:34:48 +0200
commit4fb02d6b79ae8d284af0dfa0a70ac9436e491e31 (patch)
treed860acf40fe4978cb10bdedb12ea7231ca1cf4cc /UpdateManager
parentd75e3398c0fbdb336eac4cd8c68464eaf7d457ab (diff)
parentcda38bff6b4daf1a5d630675875c0e0043c82e2f (diff)
downloadpython-apt-4fb02d6b79ae8d284af0dfa0a70ac9436e491e31.tar.gz
* UpdateManager/UpdateManager.py:
- merged changelog not found fixes
Diffstat (limited to 'UpdateManager')
-rw-r--r--UpdateManager/UpdateManager.py76
1 files changed, 39 insertions, 37 deletions
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
index 54d85801..d4cc7a59 100644
--- a/UpdateManager/UpdateManager.py
+++ b/UpdateManager/UpdateManager.py
@@ -95,38 +95,40 @@ class MyCache(apt.Cache):
self.clean()
assert self._depcache.BrokenCount == 0 and self._depcache.DelCount == 0
self._depcache.Upgrade()
-
+
def get_changelog(self, name, lock):
# don't touch the gui in this function, it needs to be thread-safe
pkg = self[name]
- # get the src package name
+ # get the src package name
srcpkg = pkg.sourcePackageName
# assume "main" section
src_section = "main"
# use the section of the candidate as a starting point
- section = pkg._depcache.GetCandidateVer(pkg._pkg).Section
-
- # get the source version, start with the binaries version
- srcver = pkg.candidateVersion
- try:
- # try to get the source version of the pkg, this differs
- # for some (e.g. libnspr4 on ubuntu)
- srcrecords = apt_pkg.GetPkgSrcRecords()
- srcrec = srcrecords.Lookup(srcpkg)
- if srcrec:
- srcver = srcrecords.Version
- #print "srcver: %s" % srcver
- section = srcrecords.Section
- #print "srcsect: %s" % section
- except SystemError, e:
- # catch errors and ignore them,
- # this feature only works if deb-src are in the sources.list
- # otherwise we fall back to the binary version number
- pass
-
-
+ section = pkg._depcache.GetCandidateVer(pkg._pkg).Section
+
+ # get the source version, start with the binaries version
+ binver = pkg.candidateVersion
+ #print "bin: %s" % binver
+ try:
+ # try to get the source version of the pkg, this differs
+ # for some (e.g. libnspr4 on ubuntu)
+ # this feature only works if the correct deb-src are in the
+ # sources.list
+ # otherwise we fall back to the binary version number
+ srcrecords = apt_pkg.GetPkgSrcRecords()
+ srcrec = srcrecords.Lookup(srcpkg)
+ if srcrec:
+ srcver = srcrecords.Version
+ if apt_pkg.VersionCompare(binver, srcver) > 0:
+ srcver = binver
+ #print "srcver: %s" % srcver
+ section = srcrecords.Section
+ #print "srcsect: %s" % section
+ except SystemError, e:
+ srcver = binver
+
l = section.split("/")
if len(l) > 1:
src_section = l[0]
@@ -143,7 +145,7 @@ class MyCache(apt.Cache):
try:
uri = CHANGELOGS_URI % (src_section,prefix,srcpkg,srcpkg, srcver)
- #print "Trying: %s " % uri
+ # print "Trying: %s " % uri
changelog = urllib2.urlopen(uri)
#print changelog.read()
# do only get the lines that are new
@@ -153,23 +155,26 @@ class MyCache(apt.Cache):
i=0
while True:
line = changelog.readline()
- #print line
if line == "":
break
match = re.match(regexp,line)
if match:
- # FIXME: the installed version can have a epoch, but th
- # changelog does not have one, we do a dumb
- # approach here and just strip it away, but I'm
- # sure that this can lead to problems
- installed = pkg.installedVersion
- if installed and ":" in installed:
- installed = installed.split(":",1)[1]
- if installed and apt_pkg.VersionCompare(match.group(1),installed) <= 0:
+ # FIXME: the installed version can have a epoch, but th
+ # changelog does not have one, we do a dumb
+ # approach here and just strip it away, but I'm
+ # sure that this can lead to problems
+ installed = pkg.installedVersion
+ if installed and ":" in installed:
+ installed = installed.split(":",1)[1]
+ if installed and \
+ apt_pkg.VersionCompare(match.group(1),installed)<=0:
break
- # EOF (shouldn't really happen)
+ # EOF (shouldn't really happen)
alllines = alllines + line
+ # Print an error if we failed to extract a changelog
+ if len(alllines) == 0:
+ alllines = _("The list of changes is not available")
# only write if we where not canceld
if lock.locked():
self.all_changes[name] = [alllines, srcpkg]
@@ -187,9 +192,6 @@ class MyCache(apt.Cache):
if lock.locked():
lock.release()
-
-
-
class UpdateList:
def __init__(self, parent_window):
self.pkgs = []