Your message dated Wed, 21 Apr 2010 12:32:39 +0000
with message-id <[email protected]>
and subject line Bug#572088: fixed in unattended-upgrades 0.42debian2
has caused the Debian Bug report #572088,
regarding [PATCH] python-apt 0.8 API transition: Please update 
unattended-upgrades to new 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 [email protected]
immediately.)


-- 
572088: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=572088
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: unattended-upgrades
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

PS: Is this maintained in bzr? If it is, please add Vcs-Bzr
    to debian/control.

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
From a17d163a4f7284a935489cea91fd0d9c91f46d9a Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <[email protected]>
Date: Mon, 1 Mar 2010 15:17:04 +0100
Subject: [PATCH] Upgrade to the new python-apt API.

---
 unattended-upgrade |  116 ++++++++++++++++++++++++++--------------------------
 1 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/unattended-upgrade b/unattended-upgrade
index 0337e83..d1bccf2 100755
--- a/unattended-upgrade
+++ b/unattended-upgrade
@@ -46,10 +46,10 @@ class MyCache(apt.Cache):
     def __init__(self):
         apt.Cache.__init__(self)
     def clear(self):
-        self._depcache.Init()
-        assert (self._depcache.InstCount == 0 and 
-                self._depcache.BrokenCount == 0 and
-		self._depcache.DelCount == 0)
+        self._depcache.init()
+        assert (self._depcache.inst_count == 0 and
+                self._depcache.broken_count == 0 and
+		self._depcache.del_count == 0)
         
 
 def is_allowed_origin(pkg, allowed_origins):
@@ -62,12 +62,12 @@ def is_allowed_origin(pkg, allowed_origins):
     return False
 
 def check_changes_for_sanity(cache, allowed_origins, blacklist):
-    if cache._depcache.BrokenCount != 0:
+    if cache._depcache.broken_count != 0:
         return False
     for pkg in cache:
-        if pkg.markedDelete:
+        if pkg.marked_delete:
             return False
-        if pkg.markedInstall or pkg.markedUpgrade:
+        if pkg.marked_install or pkg.marked_upgrade:
             if not is_allowed_origin(pkg, allowed_origins):
                 return False
             if pkg.name in blacklist:
@@ -77,8 +77,8 @@ def check_changes_for_sanity(cache, allowed_origins, blacklist):
 def pkgname_from_deb(debfile):
     # FIXME: add error checking here
     try:
-        control = apt_inst.debExtractControl(open(debfile))
-        sections = apt_pkg.ParseSection(control)
+        control = apt_inst.DebFile(debfile).control.extractdata("control")
+        sections = apt_pkg.TagSection(control)
         return sections["Package"]
     except SystemError, e:
         logging.error("failed to read deb file '%s' (%s)" % (debfile, e))
@@ -88,13 +88,13 @@ def pkgname_from_deb(debfile):
 def conffile_prompt(destFile):
     logging.debug("check_conffile_prompt('%s')" % destFile)
     pkgname = pkgname_from_deb(destFile)
-    status_file = apt_pkg.Config.Find("Dir::State::status")
-    parse = apt_pkg.ParseTagFile(open(status_file,"r"))
-    while parse.Step() == 1:
-        if parse.Section.get("Package") == pkgname:
+    status_file = apt_pkg.config.find("Dir::State::status")
+    tagfile = apt_pkg.TagFile(open(status_file,"r"))
+    for section in tagfile:
+        if section.get("Package") == pkgname:
             logging.debug("found pkg: %s" % pkgname)
-            if parse.Section.has_key("Conffiles"):
-                conffiles = parse.Section.get("Conffiles")
+            if "Conffiles" in section:
+                conffiles = section.get("Conffiles")
                 # Conffiles:
                 # /etc/bash_completion.d/m-a c7780fab6b14d75ca54e11e992a6c11c
                 for line in string.split(conffiles,"\n"):
@@ -114,9 +114,9 @@ def conffile_prompt(destFile):
 
 
 def dpkg_conffile_prompt():
-    if not apt_pkg.Config.has_key("DPkg::Options"):
+    if "DPkg::Options" not in apt_pkg.config:
         return True
-    options = apt_pkg.Config.ValueList("DPkg::Options")
+    options = apt_pkg.config.value_list("DPkg::Options")
     for option in map(string.strip, options):
         if (option == "--force-confold" or
 	    option == "--force-confnew"):
@@ -127,7 +127,7 @@ def rewind_cache(cache, pkgs_to_upgrade):
     " set the cache back to the state with packages_to_upgrade "
     cache.clear()
     for pkg2 in pkgs_to_upgrade:
-        pkg2.markUpgrade()
+        pkg2.mark_upgrade()
 
 def host():
     return os.uname()[1]
@@ -176,13 +176,13 @@ def main():
     #    os.mkdir(dldir+"/partial")
     #except OSError:
     #    pass
-    #apt_pkg.Config.Set("Dir::Cache::archives",dldir)
+    #apt_pkg.config.set("Dir::Cache::archives",dldir)
 
     # format (origin, archive), e.g. ("Ubuntu","dapper-security")
-    allowed_origins = map(string.split, apt_pkg.Config.ValueList("Unattended-Upgrade::Allowed-Origins"))
+    allowed_origins = map(string.split, apt_pkg.config.value_list("Unattended-Upgrade::Allowed-Origins"))
 
     # pkgs that are (for some reason) not save to install
-    blacklisted_pkgs = apt_pkg.Config.ValueList("Unattended-Upgrade::Package-Blacklist")
+    blacklisted_pkgs = apt_pkg.config.value_list("Unattended-Upgrade::Package-Blacklist")
     logging.info(_("Initial blacklisted packages: %s"), " ".join(blacklisted_pkgs))
     logging.info(_("Starting unattended upgrades script"))
 
@@ -191,23 +191,23 @@ def main():
     
     # get a cache
     cache = MyCache()
-    if cache._depcache.BrokenCount > 0:
+    if cache._depcache.broken_count > 0:
         print _("Cache has broken packages, exiting")
         logging.error(_("Cache has broken packages, exiting"))
         sys.exit(1)
     # speed things up with latest apt
-    actiongroup = apt_pkg.GetPkgActionGroup(cache._depcache)
+    actiongroup = apt_pkg.ActionGroup(cache._depcache)
 
     # find out about the packages that are upgradable (in a allowed_origin)
     pkgs_to_upgrade = []
     pkgs_kept_back = []
     for pkg in cache:
-        if options.debug and pkg.isUpgradable:
+        if options.debug and pkg.is_upgradable:
             logging.debug("Checking: %s (%s)" % (pkg.name, map(str, pkg.candidate.origins)))
-        if (pkg.isUpgradable and 
+        if (pkg.is_upgradable and 
 	    is_allowed_origin(pkg,allowed_origins)):
             try:
-                pkg.markUpgrade()
+                pkg.mark_upgrade()
                 if check_changes_for_sanity(cache, allowed_origins,
                                             blacklisted_pkgs):
                     pkgs_to_upgrade.append(pkg)
@@ -227,40 +227,40 @@ def main():
            
     # download what looks good
     if options.debug:
-        fetcher = apt_pkg.GetAcquire(apt.progress.TextFetchProgress())
+        fetcher = apt_pkg.Acquire(apt.progress.text.AcquireProgress())
     else:
-        fetcher = apt_pkg.GetAcquire()
-    list = apt_pkg.GetPkgSourceList()
-    list.ReadMainList()
+        fetcher = apt_pkg.Acquire()
+    list = apt_pkg.SourceList()
+    list.read_main_list()
     recs = cache._records
-    pm = apt_pkg.GetPackageManager(cache._depcache)
+    pm = apt_pkg.PackageManager(cache._depcache)
     try:
-        pm.GetArchives(fetcher,list,recs)
+        pm.get_archives(fetcher,list,recs)
     except SystemError, e:
         logging.error(_("GetArchives() failed: '%s'") % e)
-    res = fetcher.Run()
+    res = fetcher.run()
 
     if dpkg_conffile_prompt():
         # now check the downloaded debs for conffile conflicts and build
         # a blacklist
-        for item in fetcher.Items:
+        for item in fetcher.items:
             logging.debug("%s" % item)
-            if item.Status == item.StatError:
-                print _("An error ocured: '%s'") % item.ErrorText
-                logging.error(_("An error ocured: '%s'") % item.ErrorText)
-            if item.Complete == False:
-                print _("The URI '%s' failed to download, aborting") % item.DescURI
-                logging.error(_("The URI '%s' failed to download, aborting") % item.DescURI)
+            if item.status == item.STAT_ERROR:
+                print _("An error ocured: '%s'") % item.error_text
+                logging.error(_("An error ocured: '%s'") % item.error_text)
+            if not item.complete:
+                print _("The URI '%s' failed to download, aborting") % item.desc_uri
+                logging.error(_("The URI '%s' failed to download, aborting") % item.desc_uri)
                 sys.exit(1)
-            if item.IsTrusted == False:
-                blacklisted_pkgs.append(pkgname_from_deb(item.DestFile))
-            if conffile_prompt(item.DestFile):
+            if not item.is_trusted:
+                blacklisted_pkgs.append(pkgname_from_deb(item.destfile))
+            if conffile_prompt(item.destfile):
                 # FIXME: skip package (means to re-run the whole marking again
                 # and making sure that the package will not be pulled in by
                 # some other package again!
-                logging.warning(_("Package '%s' has conffile prompt and needs to be upgraded manually") % pkgname_from_deb(item.DestFile))
-                blacklisted_pkgs.append(pkgname_from_deb(item.DestFile))
-                pkgs_kept_back.append(pkgname_from_deb(item.DestFile))
+                logging.warning(_("Package '%s' has conffile prompt and needs to be upgraded manually") % pkgname_from_deb(item.destfile))
+                blacklisted_pkgs.append(pkgname_from_deb(item.destfile))
+                pkgs_kept_back.append(pkgname_from_deb(item.destfile))
 
 
         # redo the selection about the packages to upgrade based on the new
@@ -273,7 +273,7 @@ def main():
             pkgs_to_upgrade = []
             for pkg in old_pkgs_to_upgrade:
                 logging.debug("Checking (blacklist): %s" % (pkg.name))
-                pkg.markUpgrade()
+                pkg.mark_upgrade()
                 if check_changes_for_sanity(cache, allowed_origins,
                                             blacklisted_pkgs):
                      pkgs_to_upgrade.append(pkg)
@@ -283,11 +283,11 @@ def main():
                     logging.info(_("package '%s' not upgraded") % pkg.name)
                     cache.clear()
                     for pkg2 in pkgs_to_upgrade:
-                        pkg2.markUpgrade()
+                        pkg2.mark_upgrade()
     else:
         logging.debug("dpkg is configured not to cause conffile prompts")
 
-    logging.debug("InstCount=%i DelCount=%i BrokenCout=%i" % (cache._depcache.InstCount, cache._depcache.DelCount, cache._depcache.BrokenCount))
+    logging.debug("InstCount=%i DelCount=%i BrokenCout=%i" % (cache._depcache.inst_count, cache._depcache.del_count, cache._depcache.broken_count))
 
     # exit if there is nothing to do and nothing to report
     if (len(pkgs_to_upgrade) == 0) and (len(pkgs_kept_back) == 0):
@@ -316,30 +316,30 @@ def main():
     
     # enable debugging
     if options.debug:
-        apt_pkg.Config.Set("Debug::pkgDPkgPM","1")
+        apt_pkg.config.set("Debug::pkgDPkgPM","1")
     # create a new package-manager. the blacklist may have changed
     # the markings in the depcache
-    pm = apt_pkg.GetPackageManager(cache._depcache)
-    if not pm.GetArchives(fetcher,list,recs):
+    pm = apt_pkg.PackageManager(cache._depcache)
+    if not pm.get_archives(fetcher,list,recs):
         logging.error(_("pm.GetArchives() failed"))
     # run the fetcher again (otherwise local file:// 
     # URIs are unhappy (see LP: #56832)
-    res = fetcher.Run()
+    res = fetcher.run()
     # now do the actual install
     try:
-        res = pm.DoInstall()
+        res = pm.do_install()
     except SystemError,e:
         logging.error(_("Installing the upgrades failed!"))
         logging.error(_("error message: '%s'") % e)
         res = False
                 
-    if res == pm.ResultFailed:
+    if res == pm.RESULT_FAILED:
         logging.error(_("dpkg returned a error! See '%s' for details") % logfile_dpkg)
     else:
         logging.info(_("All upgrades installed"))
 
     # check if we need to send a mail
-    email = apt_pkg.Config.Find("Unattended-Upgrade::Mail", "")
+    email = apt_pkg.config.find("Unattended-Upgrade::Mail", "")
     if email != "":
         if not os.path.exists("/usr/bin/mail"):
             logging.error(_("No '/usr/bin/mail', can not send mail. "
@@ -382,9 +382,9 @@ if __name__ == "__main__":
         os.makedirs("/var/log/unattended-upgrades")
 
     # init the logging
-    logdir = apt_pkg.Config.FindDir("APT::UnattendedUpgrades::LogDir",
+    logdir = apt_pkg.config.find_dir("APT::UnattendedUpgrades::LogDir",
                                     "/var/log/unattended-upgrades/")
-    logfile = logdir+apt_pkg.Config.Find("APT::UnattendedUpgrades::LogFile",
+    logfile = logdir+apt_pkg.config.find("APT::UnattendedUpgrades::LogFile",
                                          "unattended-upgrades.log")
     logging.basicConfig(level=logging.INFO,
                         format='%(asctime)s %(levelname)s %(message)s',
-- 
1.7.0

Attachment: pgplR8pAbPrNw.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: unattended-upgrades
Source-Version: 0.42debian2

We believe that the bug you reported is fixed in the latest version of
unattended-upgrades, which is due to be installed in the Debian FTP archive:

unattended-upgrades_0.42debian2.dsc
  to main/u/unattended-upgrades/unattended-upgrades_0.42debian2.dsc
unattended-upgrades_0.42debian2.tar.gz
  to main/u/unattended-upgrades/unattended-upgrades_0.42debian2.tar.gz
unattended-upgrades_0.42debian2_all.deb
  to main/u/unattended-upgrades/unattended-upgrades_0.42debian2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Vogt <[email protected]> (supplier of updated unattended-upgrades package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Wed, 21 Apr 2010 13:54:06 +0200
Source: unattended-upgrades
Binary: unattended-upgrades
Architecture: source all
Version: 0.42debian2
Distribution: unstable
Urgency: low
Maintainer: Michael Vogt <[email protected]>
Changed-By: Michael Vogt <[email protected]>
Description: 
 unattended-upgrades - automatic installation of security upgrades
Closes: 572088
Changes: 
 unattended-upgrades (0.42debian2) unstable; urgency=low
 .
   * apply patch by Julian Andres Klode to move to the new
     python-apt 0.8 API (closes: #572088)
Checksums-Sha1: 
 f0c34bc8388eb1f43684320a2e6f640e366379bd 856 
unattended-upgrades_0.42debian2.dsc
 c2226cbc08c0753c652664b038c5a1dad5cb493c 29467 
unattended-upgrades_0.42debian2.tar.gz
 ef5d1ff32b47ec140419b45267d463b9c783400d 19766 
unattended-upgrades_0.42debian2_all.deb
Checksums-Sha256: 
 764dc1f2d634e33378316f8a21351582562e3591f5159521fbd087f5cb3778a0 856 
unattended-upgrades_0.42debian2.dsc
 e326f8cbc8774b681281f40b124b50a9a0c6a80036a10ebae53ab398f43b15f4 29467 
unattended-upgrades_0.42debian2.tar.gz
 0ce3b23c915d0164671952293ce1a1aad07d22a0f868d87ff9eaca890cce7956 19766 
unattended-upgrades_0.42debian2_all.deb
Files: 
 6bf28abe897aa1500f8b317de385005c 856 admin optional 
unattended-upgrades_0.42debian2.dsc
 833bcfbc5cba17388ad9101973285092 29467 admin optional 
unattended-upgrades_0.42debian2.tar.gz
 4a62353201aacca2750829be96652d93 19766 admin optional 
unattended-upgrades_0.42debian2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvO7cUACgkQliSD4VZixzTFJACcCShcx4NJjjLYIyoXCJKlK+Bd
YBcAoIwkN+lDzsIK/KC89LibJYdeYk0J
=IVWr
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to