[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#645818: marked as done ([britney2] Port to python-apt 0.8 API)



Your message dated Sun, 18 Dec 2011 21:45:08 +0100
with message-id <4EEE50D4.5010509@thykier.net>
and subject line Re: Bug#645818: [britney2] Port to python-apt 0.8 API
has caused the Debian Bug report #645818,
regarding [britney2] Port to python-apt 0.8 API
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
645818: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=645818
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: britney

Hi.

To be able to run britney2 in wheezy/sid, one has to make it work with
python-apt 0.8. Attached a patch that ports britney2 to use python-apt
0.8 new API. This patch has been tested with python2.7.

P.S.: This needs patch sent in #622152 in order to run with python2.6+.

Kind regards,

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
>From 80b12e85cb7ff240fa0c31ebcd8bdb12bceb4c5b Mon Sep 17 00:00:00 2001
From: Mehdi Dogguy <mehdi@debian.org>
Date: Tue, 18 Oct 2011 22:00:56 +0200
Subject: [PATCH] Port britney2 to pythn-apt 0.8 API

---
 britney.py |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/britney.py b/britney.py
index 804460d..6565d92 100755
--- a/britney.py
+++ b/britney.py
@@ -421,7 +421,7 @@ class Britney:
             get_field = Packages.section.get
             step = Packages.step
         except AttributeError, e:
-            Packages = apt_pkg.ParseTagFile(open(filename))
+            Packages = apt_pkg.TagFile(open(filename))
             get_field = Packages.Section.get
             step = Packages.Step
         while step():
@@ -431,7 +431,7 @@ class Britney:
             # (in unstable) if some architectures have out-of-date
             # binaries.  We only ever consider the source with the
             # largest version for migration.
-            if pkg in sources and apt_pkg.VersionCompare(sources[pkg][0], ver) > 0:
+            if pkg in sources and apt_pkg.version_compare(sources[pkg][0], ver) > 0:
                 continue
             sources[pkg] = [ver,
                             get_field('Section'),
@@ -455,7 +455,7 @@ class Britney:
         and saved in the `rdepends' keys, and the `Provides' field is
         used to populate the virtual packages list.
 
-        The dependencies are parsed with the apt.pkg.ParseDepends method,
+        The dependencies are parsed with the apt.pkg.parse_depends method,
         and they are stored both as the format of its return value and
         text.
 
@@ -477,7 +477,7 @@ class Britney:
             get_field = Packages.section.get
             step = Packages.step
         except AttributeError, e:
-            Packages = apt_pkg.ParseTagFile(open(filename))
+            Packages = apt_pkg.TagFile(open(filename))
             get_field = Packages.Section.get
             step = Packages.Step
         while step():
@@ -488,7 +488,7 @@ class Britney:
             # (in unstable) if some architectures have out-of-date
             # binaries.  We only ever consider the package with the
             # largest version for migration.
-            if pkg in packages and apt_pkg.VersionCompare(packages[pkg][0], version) > 0:
+            if pkg in packages and apt_pkg.version_compare(packages[pkg][0], version) > 0:
                 continue
 
             final_conflicts_list = []
@@ -546,7 +546,7 @@ class Britney:
         # return a tuple with the list of real and virtual packages
         return (packages, provides)
 
-    def register_reverses(self, pkg, packages, provides, check_doubles=True, parse_depends=apt_pkg.ParseDepends):
+    def register_reverses(self, pkg, packages, provides, check_doubles=True, parse_depends=apt_pkg.parse_depends):
         """Register reverse dependencies and conflicts for the specified package
 
         This method registers the reverse dependencies and conflicts for
@@ -642,7 +642,7 @@ class Britney:
         for arch in self.options.architectures:
             if pkg not in self.binaries[dist][arch][0]: continue
             pkgv = self.binaries[dist][arch][0][pkg][VERSION]
-            if maxver == None or apt_pkg.VersionCompare(pkgv, maxver) > 0:
+            if maxver == None or apt_pkg.version_compare(pkgv, maxver) > 0:
                 maxver = pkgv
         return maxver
 
@@ -744,12 +744,12 @@ class Britney:
 
             # if the package exists in testing and it is more recent, do nothing
             tsrcv = self.sources['testing'].get(l[0], None)
-            if tsrcv and apt_pkg.VersionCompare(tsrcv[VERSION], l[1]) >= 0:
+            if tsrcv and apt_pkg.version_compare(tsrcv[VERSION], l[1]) >= 0:
                 continue
 
             # if the package doesn't exist in unstable or it is older, do nothing
             usrcv = self.sources['unstable'].get(l[0], None)
-            if not usrcv or apt_pkg.VersionCompare(usrcv[VERSION], l[1]) < 0:
+            if not usrcv or apt_pkg.version_compare(usrcv[VERSION], l[1]) < 0:
                 continue
 
             # update the urgency for the package
@@ -810,7 +810,7 @@ class Britney:
             for a, b in hints[x]:
                 if z.has_key(a) and z[a] != b:
                     if x in ['unblock', 'unblock-udeb']:
-                        if apt_pkg.VersionCompare(z[a][0], b[0]) < 0:
+                        if apt_pkg.version_compare(z[a][0], b[0]) < 0:
                             # This hint is for a newer version, so discard the old one
                             self.__log("Overriding %s[%s] = %s with %s" % (x, a, z[a], b), type="W")
                         else:
@@ -962,7 +962,7 @@ class Britney:
         """Find the packages which satisfy a dependency block
 
         This method returns the list of packages which satisfy a dependency
-        block (as returned by apt_pkg.ParseDepends) for the given architecture
+        block (as returned by apt_pkg.parse_depends) for the given architecture
         and distribution.
 
         It returns a tuple with two items: the first is a boolean which is
@@ -981,7 +981,7 @@ class Britney:
             if name not in excluded and name in binaries[0]:
                 package = binaries[0][name]
                 # check the versioned dependency (if present)
-                if op == '' and version == '' or apt_pkg.CheckDep(package[VERSION], op, version):
+                if op == '' and version == '' or apt_pkg.check_dep(package[VERSION], op, version):
                     packages.append(name)
 
             # look for the package in the virtual packages list and loop on them
@@ -993,7 +993,7 @@ class Britney:
                 # TODO: this is forbidden by the debian policy, which says that versioned
                 #       dependencies on virtual packages are never satisfied. The old britney
                 #       does it and we have to go with it, but at least a warning should be raised.
-                if op == '' and version == '' or not strict and apt_pkg.CheckDep(package[VERSION], op, version):
+                if op == '' and version == '' or not strict and apt_pkg.check_dep(package[VERSION], op, version):
                     packages.append(prov)
 
         return (len(packages) > 0, packages)
@@ -1013,7 +1013,7 @@ class Britney:
         binary_u = self.binaries[suite][arch][0][pkg]
 
         # local copies for better performances
-        parse_depends = apt_pkg.ParseDepends
+        parse_depends = apt_pkg.parse_depends
         get_dependency_solvers = self.get_dependency_solvers
         strict = True # not self.options.compatible
 
@@ -1164,7 +1164,7 @@ class Britney:
 
             # at this point, the binary package is present in testing, so we can compare
             # the versions of the packages ...
-            vcompare = apt_pkg.VersionCompare(binary_t[VERSION], binary_u[VERSION])
+            vcompare = apt_pkg.version_compare(binary_t[VERSION], binary_u[VERSION])
 
             # ... if updating would mean downgrading, then stop here: there is something wrong
             if vcompare > 0:
@@ -1223,7 +1223,7 @@ class Britney:
         if src in self.sources['testing']:
             source_t = self.sources['testing'][src]
             # if testing and unstable have the same version, then this is a candidate for binary-NMUs only
-            if apt_pkg.VersionCompare(source_t[VERSION], source_u[VERSION]) == 0:
+            if apt_pkg.version_compare(source_t[VERSION], source_u[VERSION]) == 0:
                 return False
         else:
             source_t = None
@@ -1239,7 +1239,7 @@ class Britney:
         update_candidate = True
         
         # if the version in unstable is older, then stop here with a warning in the excuse and return False
-        if source_t and apt_pkg.VersionCompare(source_u[VERSION], source_t[VERSION]) < 0:
+        if source_t and apt_pkg.version_compare(source_u[VERSION], source_t[VERSION]) < 0:
             excuse.addhtml("ALERT: %s is newer in testing (%s %s)" % (src, source_t[VERSION], source_u[VERSION]))
             self.excuses.append(excuse)
             return False
@@ -1791,7 +1791,7 @@ class Britney:
         binary_u = self.binaries[suite][arch][0][pkg]
 
         # local copies for better performances
-        parse_depends = apt_pkg.ParseDepends
+        parse_depends = apt_pkg.parse_depends
         get_dependency_solvers = self.get_dependency_solvers
 
         # analyze the dependency fields (if present)
@@ -1829,8 +1829,8 @@ class Britney:
 
         # local copies for better performances
         binaries = self.binaries['testing'][arch]
-        parse_depends = apt_pkg.ParseDepends
-        check_depends = apt_pkg.CheckDep
+        parse_depends = apt_pkg.parse_depends
+        check_depends = apt_pkg.check_dep
 
         # unregister conflicts, local method to remove conflicts
         # registered from a given package.
@@ -2773,14 +2773,14 @@ class Britney:
             elif pkg.endswith("_tpu") or pkg.endswith("_pu"):
                 pkg, suite = pkg.rsplit("_")
                 if pkg not in self.sources[suite]: continue
-                if apt_pkg.VersionCompare(self.sources[suite][pkg][VERSION], v) != 0:
+                if apt_pkg.version_compare(self.sources[suite][pkg][VERSION], v) != 0:
                     self.output_write(" Version mismatch, %s %s != %s\n" % (pkg, v, self.sources[suite][pkg][VERSION]))
                     ok = False
             # does the package exist in unstable?
             elif pkg not in self.sources['unstable']:
                 self.output_write(" Source %s has no version in unstable\n" % pkg)
                 ok = False
-            elif apt_pkg.VersionCompare(self.sources['unstable'][pkg][VERSION], v) != 0:
+            elif apt_pkg.version_compare(self.sources['unstable'][pkg][VERSION], v) != 0:
                 self.output_write(" Version mismatch, %s %s != %s\n" % (pkg, v, self.sources['unstable'][pkg][VERSION]))
                 ok = False
         if not ok:
-- 
1.7.6.3


--- End Message ---
--- Begin Message ---
On 2011-10-18 22:05, Mehdi Dogguy wrote:
> Package: release.debian.org
> Severity: normal
> User: release.debian.org@packages.debian.org
> Usertags: britney
> 
> Hi.
> 
> To be able to run britney2 in wheezy/sid, one has to make it work with
> python-apt 0.8. Attached a patch that ports britney2 to use python-apt
> 0.8 new API. This patch has been tested with python2.7.
> 
> P.S.: This needs patch sent in #622152 in order to run with python2.6+.
> 
> Kind regards,
> 
> -- System Information:
> Debian Release: wheezy/sid
>   APT prefers testing
>   APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
> Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash

Hi,

Fixed in cabb9deec051f4d98247cc79ca4bc4ed8c7df083.

~Niels



--- End Message ---

Reply to: