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

Holger Levsen holger at alioth.debian.org
Sat Dec 5 18:33:41 UTC 2009


Author: holger
Date: 2009-12-05 18:33:41 +0000 (Sat, 05 Dec 2009)
New Revision: 537

Modified:
   trunk/debian/changelog
   trunk/piuparts.1.txt
   trunk/piuparts.py
Log:
- Add support for warning on broken symlinks. Thanks to Carl Chenet for
the patch. (Closes: #440151)  

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-12-04 15:08:56 UTC (rev 536)
+++ trunk/debian/changelog	2009-12-05 18:33:41 UTC (rev 537)
@@ -3,6 +3,8 @@
   * piuparts.py:
     - Add support for using LVM snapshots. Thanks to
       Patrick Schoenfeld for the patch. (Closes: #559449)
+  * - Add support for warning on broken symlinks. Thanks to Carl Chenet for
+      the patch. (Closes: #440151)  
 
  -- Holger Levsen <holger at debian.org>  Fri, 04 Dec 2009 15:55:42 +0100
 

Modified: trunk/piuparts.1.txt
===================================================================
--- trunk/piuparts.1.txt	2009-12-04 15:08:56 UTC (rev 536)
+++ trunk/piuparts.1.txt	2009-12-05 18:33:41 UTC (rev 537)
@@ -115,6 +115,9 @@
 *-N, --no-symlinks*::
   Don't check for broken symlinks.
 
+*-W, --warn-symlinks*::
+  Check for broken symlinks, but warn only if found.
+
 *-p, --pbuilder*::
   Use _/var/cache/pbuilder/base.tgz_ as the base tarball. This is a shorthand so that you don't need to use '-b' for it.
 

Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py	2009-12-04 15:08:56 UTC (rev 536)
+++ trunk/piuparts.py	2009-12-05 18:33:41 UTC (rev 537)
@@ -149,7 +149,8 @@
         self.no_upgrade_test = False
         self.skip_cronfiles_test = False
         self.check_broken_symlinks = True
-	self.debfoster_options = None
+        self.warn_broken_symlinks = False
+        self.debfoster_options = None
         self.ignored_files = [
             "/dev/MAKEDEV",
             "/etc/aliases",
@@ -573,7 +574,7 @@
         if settings.scriptsdir is not None:
             dest = self.relative("tmp/scripts/")
             if not os.path.exists(self.relative("tmp/scripts/")):
-              os.mkdir(dest)
+                os.mkdir(dest)
             logging.debug("Copying scriptsdir to %s" % dest)
             for file in os.listdir(settings.scriptsdir):
                 if (file.startswith("post_") or file.startswith("pre_")) and os.path.isfile(os.path.join((settings.scriptsdir), file)):
@@ -963,9 +964,13 @@
                         target = "<unknown>"
                     broken.append("%s -> %s" % (name, target))
         if broken:
-            logging.error("FAIL: Broken symlinks:\n%s" % 
-                          indent_string("\n".join(broken)))
-	    panic()
+            if settings.warn_broken_symlinks:
+                logging.error("WARN: Broken symlinks:\n%s" %
+                              indent_string("\n".join(broken)))
+            else:
+                logging.error("FAIL: Broken symlinks:\n%s" %
+                              indent_string("\n".join(broken)))
+                panic()
         else:
             logging.debug("No broken symlinks as far as we can find.")
 	    
@@ -1872,6 +1877,10 @@
                       action="store_true", default=False,
                       help="No meaning anymore.")
 
+    parser.add_option("-W", "--warn-symlinks", action="store_true",
+                      default=False,
+                      help="Warn only for broken symlinks.")
+
     parser.add_option("--debfoster-options",
                       default="-o MaxPriority=required -o UseRecommends=no -f -n apt debfoster",
 		      help="Run debfoster with different parameters (default: -o MaxPriority=required -o UseRecommends=no -f -n apt debfoster).")
@@ -1902,6 +1911,7 @@
     settings.debian_mirrors = [parse_mirror_spec(x, defaults.get_components())
                                for x in opts.mirror]
     settings.check_broken_symlinks = not opts.no_symlinks
+    settings.warn_broken_symlinks = opts.warn_symlinks
     settings.savetgz = opts.save
     settings.warn_on_others = opts.warn_on_others
     settings.debfoster_options = opts.debfoster_options.split()




More information about the Piuparts-commits mailing list