aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-09-24 13:25:36 +0200
committerGuido Günther <agx@sigxcpu.org>2010-09-25 15:47:57 +0200
commit1f3b0f8a640d948849181fe07f4a5fe4431e95b9 (patch)
tree780abd32a26d199ad7383d321b63f62f9c31fa90
parent050d3b21bf30bbd6f60d4819600c7d1550e4e5fd (diff)
Fixups for Lenny
Cope with older apt_pkg and don't substitute disto_id, distro_codename due to the lack of the lsb_release python module
-rw-r--r--apt/20services4
-rw-r--r--setup.py17
-rwxr-xr-xwhatmaps26
3 files changed, 16 insertions, 31 deletions
diff --git a/apt/20services b/apt/20services
index f9f4147..9cc6cf6 100644
--- a/apt/20services
+++ b/apt/20services
@@ -3,6 +3,6 @@ Whatmaps::Enable-Restart "0";
// What updates are considered security updates
Whatmaps::Security-Update-Origins {
- "${distro_id} stable";
- "${distro_id} ${distro_codename}-security";
+ "Debian stable";
+ "Debian stable-security";
};
diff --git a/setup.py b/setup.py
index f79ef8e..cef1d55 100644
--- a/setup.py
+++ b/setup.py
@@ -3,18 +3,11 @@
from distutils.core import setup
-data_files = []
-
-try:
- import lsb_release
- if lsb_release.get_distro_information()['ID'] in [ 'Debian' ]:
- data_files = [('../etc/apt/apt.conf.d/',
- ['apt/50whatmaps_apt']),
- ('../etc/apt/apt.conf.d/',
- ['apt/20services']),
- ]
-except ImportError:
- pass
+data_files = [('../etc/apt/apt.conf.d/',
+ ['apt/50whatmaps_apt']),
+ ('../etc/apt/apt.conf.d/',
+ ['apt/20services']),
+ ]
setup(name = "whatmaps",
author = 'Guido Günther',
diff --git a/whatmaps b/whatmaps
index 379fc61..56bdf3d 100755
--- a/whatmaps
+++ b/whatmaps
@@ -243,18 +243,10 @@ class DebianDistro(Distro):
@classmethod
def _security_update_origins(klass):
- "Determine security update origins from apt configuration"
- codename = lsb_release.get_distro_information()['CODENAME']
- def _subst(line):
- mapping = {'distro_codename' : codename,
- 'distro_id' : klass.id, }
- return string.Template(line).substitute(mapping)
-
origins = []
- for s in apt_pkg.config.value_list('Whatmaps::Security-Update-Origins'):
+ for s in apt_pkg.Config.ValueList('Whatmaps::Security-Update-Origins'):
(distro_id, distro_codename) = s.split()
- origins.append((_subst(distro_id),
- _subst(distro_codename)))
+ origins.append((distro_id, distro_codename))
logging.debug("Security Update Origins: %s", origins)
return origins
@@ -264,20 +256,20 @@ class DebianDistro(Distro):
"""Filter on security updates"""
apt_pkg.init()
- acquire = apt_pkg.Acquire()
- cache = apt_pkg.Cache()
+ acquire = apt_pkg.GetAcquire()
+ cache = apt_pkg.GetCache()
security_update_origins = klass._security_update_origins()
security_updates = {}
for pkg in pkgs.values():
cache_pkg = cache[pkg.name]
- for cache_version in cache_pkg.version_list:
- if pkg.version == cache_version.ver_str:
- for pfile, _ in cache_version.file_list:
+ for cache_version in cache_pkg.VersionList:
+ if pkg.version == cache_version.VerStr:
+ for pfile, _ in cache_version.FileList:
for origin in security_update_origins:
- if pfile.origin == origin[0] and \
- pfile.archive == origin[1]:
+ if pfile.Origin == origin[0] and \
+ pfile.Archive == origin[1]:
security_updates[pkg] = pkg
break
return security_updates