[Piuparts-commits] rev 837 - in trunk: . debian

Holger Levsen holger at alioth.debian.org
Mon Dec 27 12:26:04 UTC 2010


Author: holger
Date: 2010-12-27 12:26:02 +0000 (Mon, 27 Dec 2010)
New Revision: 837

Modified:
   trunk/debian/changelog
   trunk/piuparts.py
Log:
apply patch by Andres Mejia to fix parsing of the --force-confdef option
and also to configure apt to use that option. Thanks, Andres. 
(Closes: #605475)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2010-12-27 11:43:43 UTC (rev 836)
+++ trunk/debian/changelog	2010-12-27 12:26:02 UTC (rev 837)
@@ -67,6 +67,10 @@
       separated list of packages / changes files being tested.
     - do not call apt-get with --no-remove when installing packages. 
       (Closes: #603453)
+    - apply patch by Andres Mejia to fix parsing of the --force-confdef option
+      and also to configure apt to use that option. Thanks, Andres. 
+      (Closes: #605475)
+
   * piuparts.1.txt: 
     - update the pointer to custom-scripts.txt to point to README.txt, as
       those two files have been merged. Thanks to Gregor Hermann for 

Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py	2010-12-27 11:43:43 UTC (rev 836)
+++ trunk/piuparts.py	2010-12-27 12:26:02 UTC (rev 837)
@@ -413,6 +413,17 @@
         panic()
 
 
+def append_to_file(name, contents):
+    """Append contents to an existing file."""
+    try:
+        f = file(name, "a")
+        f.write(contents)
+        f.close()
+    except IOError, detail:
+        logging.error("Couldn't append to file %s: %s" % (name, detail))
+        panic()
+
+
 def remove_files(filenames):
     """Remove some files."""
     for filename in filenames:
@@ -669,12 +680,15 @@
                     'APT::Get::Assume-Yes "yes";\n' +
                     'APT::Install-Recommends "0";\n' +
                     'APT::Install-Suggests "0";\n')
+        if settings.dpkg_force_confdef:
+          append_to_file(self.relative("etc/apt/apt.conf"),
+                         'Dpkg::Options {"--force-confdef";};\n')
 
     def create_dpkg_conf(self):
         """Create /etc/dpkg/dpkg.cfg.d/piuparts inside the chroot."""
         if settings.dpkg_force_confdef:
           create_file(self.relative("etc/dpkg/dpkg.cfg.d/piuparts"),
-                    'force-confdef')
+                    'force-confdef\n')
           logging.info("Warning: dpkg has been configured to use the force-confdef option. This will hide problems, see #466118.")
 
     def create_policy_rc_d(self):
@@ -1899,7 +1913,8 @@
 
     parser.add_option("--dpkg-force-confdef",
                       default=False,
-		      help="Make dpkg use --force-confdev, which lets dpkg always choose the default action when a modified conffile is found. This options will make piuparts ignore errors it was designed to report and therefore should only be used to hide problems in depending packages.")
+                      action='store_true',
+		      help="Make dpkg use --force-confdef, which lets dpkg always choose the default action when a modified conffile is found. This options will make piuparts ignore errors it was designed to report and therefore should only be used to hide problems in depending packages.")
      
     parser.add_option("--do-not-verify-signatures", default=False,
                       action='store_true',




More information about the Piuparts-commits mailing list