--- Begin Message ---
Package: apt-proxy
Tags: patch
User: [email protected]
Usertags: python-apt-0-8-api
As part of the python-apt API transition mass bug filing[1],
I would like to ask you to update your package for the new
API using the attached patch.
The first python-apt upload after the Squeeze release will
drop the old API and will get a 'Breaks' for all packages
which have not been adjusted yet. All not-fixed bugs will
become release critical then.
[1] http://lists.debian.org/debian-devel/2010/02/msg00424.html
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
From 8b98adba86be3c072220aae80a05fc829221d9c4 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <[email protected]>
Date: Mon, 1 Mar 2010 14:37:27 +0100
Subject: [PATCH] Upgrade to the new python-apt API.
---
apt_proxy/apt_proxy.py | 4 ++--
apt_proxy/packages.py | 36 ++++++++++++++++++------------------
debian/control | 2 +-
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/apt_proxy/apt_proxy.py b/apt_proxy/apt_proxy.py
index d86c919..3576202 100644
--- a/apt_proxy/apt_proxy.py
+++ b/apt_proxy/apt_proxy.py
@@ -389,7 +389,7 @@ class Factory(protocol.ServerFactory):
import apt_pkg
def reverse_compare(a, b):
""" Compare package versions in reverse order """
- return apt_pkg.VersionCompare(b[0], a[0])
+ return apt_pkg.version_compare(b[0], a[0])
if len(packages) <= self.config.max_versions:
return
@@ -424,7 +424,7 @@ class Factory(protocol.ServerFactory):
while len(cached_packages):
#print 'current:',len(current_packages),'cached:',len(cached_packages), 'count:', version_count
if len(current_packages):
- compare_result = apt_pkg.VersionCompare(current_packages[0][0], cached_packages[0][0])
+ compare_result = apt_pkg.version_compare(current_packages[0][0], cached_packages[0][0])
#print 'compare_result %s , %s = %s ' % (
# current_packages[0][0], cached_packages[0][0], compare_result)
else:
diff --git a/apt_proxy/packages.py b/apt_proxy/packages.py
index 809d124..4098bf0 100644
--- a/apt_proxy/packages.py
+++ b/apt_proxy/packages.py
@@ -22,7 +22,7 @@ import apt_proxy, copy, UserDict
from misc import log
aptpkg_dir='.apt-proxy'
-apt_pkg.InitSystem()
+apt_pkg.init_system()
class AptDpkgInfo(UserDict.UserDict):
"""
@@ -198,7 +198,7 @@ class AptPackages:
Regenerates the fake configuration and load the packages server.
"""
if self.loaded: return True
- apt_pkg.InitSystem()
+ apt_pkg.init_system()
#print "Load:", self.status_dir
shutil.rmtree(self.status_dir+'/apt/lists/')
os.makedirs(self.status_dir+'/apt/lists/partial')
@@ -212,7 +212,7 @@ class AptPackages:
fake_uri='http://apt-proxy/'+file
source_line='deb '+dirname(fake_uri)+'/ /'
listpath=(self.status_dir+'/apt/lists/'
- +apt_pkg.URItoFileName(fake_uri))
+ +apt_pkg.uri_to_filename(fake_uri))
sources.write(source_line+'\n')
log.debug("Sources line: " + source_line, 'apt_pkg')
sources_count = sources_count + 1
@@ -230,24 +230,24 @@ class AptPackages:
return False
log.msg("Loading Packages database for "+self.status_dir,'apt_pkg')
- #apt_pkg.Config = apt_pkg.newConfiguration(); #-- this causes unit tests to fail!
+ #apt_pkg.config = apt_pkg.Configuration(); #-- this causes unit tests to fail!
for key, value in self.apt_config.items():
- apt_pkg.Config[key] = value
+ apt_pkg.config[key] = value
# print "apt_pkg config:"
-# for I in apt_pkg.Config.keys():
-# print "%s \"%s\";"%(I,apt_pkg.Config[I]);
+# for I in apt_pkg.config.keys():
+# print "%s \"%s\";"%(I,apt_pkg.config[I]);
if log.isEnabled('apt'):
- self.cache = apt_pkg.GetCache()
+ self.cache = apt_pkg.Cache()
else:
# apt_pkg prints progress messages to stdout, disable
self.__save_stdout()
try:
- self.cache = apt_pkg.GetCache()
+ self.cache = apt_pkg.Cache()
finally:
self.__restore_stdout()
- self.records = apt_pkg.GetPkgRecords(self.cache)
+ self.records = apt_pkg.PackageRecords(self.cache)
#for p in self.cache.Packages:
# print p
#log.debug("%s packages found" % (len(self.cache)),'apt_pkg')
@@ -268,11 +268,11 @@ class AptPackages:
"Find the path for version 'version' of package 'name'"
if not self.load(): return None
try:
- for pack_vers in self.cache[name].VersionList:
- if(pack_vers.VerStr == version):
- file, index = pack_vers.FileList[0]
- self.records.Lookup((file,index))
- path = self.records.FileName
+ for pack_vers in self.cache[name].version_list:
+ if(pack_vers.ver_str == version):
+ file, index = pack_vers.file_list[0]
+ self.records.lookup((file,index))
+ path = self.records.filename
if len(path)>2 and path[0:2] == './':
path = path[2:] # Remove any leading './'
return path
@@ -293,8 +293,8 @@ class AptPackages:
vers = []
if not self.load(): return vers
try:
- for pack_vers in self.cache[package_name].VersionList:
- vers.append(pack_vers.VerStr)
+ for pack_vers in self.cache[package_name].version_list:
+ vers.append(pack_vers.ver_str)
except KeyError:
pass
return vers
@@ -332,7 +332,7 @@ def get_mirror_versions(factory, package):
def closest_match(info, others):
def compare(a, b):
- return apt_pkg.VersionCompare(a[0], b[0])
+ return apt_pkg.version_compare(a[0], b[0])
others.sort(compare)
version = info['Version']
diff --git a/debian/control b/debian/control
index 292624c..9b410dd 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends-Indep: help2man, python-twisted-web (>= 0.6), python (>= 2.3.5), p
Package: apt-proxy
Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, python-twisted-web (>= 0.6), python-apt (>= 0.5.8), bzip2, logrotate, adduser
+Depends: ${misc:Depends}, ${python:Depends}, python-twisted-web (>= 0.6), python-apt (>= 0.7.93), bzip2, logrotate, adduser
Conflicts: apt-proxy-v2 (<= 1.9.5)
Replaces: apt-proxy-v2 (<= 1.9.5)
Suggests: rsync
--
1.7.0
pgp9Dyjs0DxgC.pgp
Description: PGP signature
--- End Message ---