[Pkg-uml-commit] r155 - trunk/src/rootstrap

Mattia Dongili malattia at costa.debian.org
Sun Aug 20 18:53:42 UTC 2006


Author: malattia
Date: 2006-08-20 18:53:41 +0000 (Sun, 20 Aug 2006)
New Revision: 155

Modified:
   trunk/src/rootstrap/builder
Log:
easier debugging checking /bin/sh return codes

Modified: trunk/src/rootstrap/builder
===================================================================
--- trunk/src/rootstrap/builder	2006-08-20 18:53:00 UTC (rev 154)
+++ trunk/src/rootstrap/builder	2006-08-20 18:53:41 UTC (rev 155)
@@ -35,20 +35,34 @@
 def dispatch(module, vars):
     "Invoke a rootstrap module"
 
-    found = 0
     for scriptpat in ('/etc/rootstrap/workdir/modules/%s',
                       '/etc/rootstrap/modules/%s',
                       '/usr/lib/rootstrap/modules/%s'):
         script = scriptpat % module
-        if os.path.exists(script):
+
+	if os.path.exists(script):
             print "Using rootstrap module %s from:\n\t%s" % (module,script)
-            status = os.spawnle(os.P_WAIT, script, script, vars)
-            if status != 0:
-	        if "debug" in vars and vars["debug"] == "true":
-		    status = os.spawnle(os.P_WAIT, "/bin/sh", "/bin/sh", vars)
-                raise "rootstrap: Module '%s' failed, status: %d" % (module,status)
-            return
 
+	    # try to ease module debugging
+	    #
+	    # debug_exit == 0 --> exit and raise exception
+	    #               1 --> re-eval script that failed
+	    #               2 --> go on with next script
+	    #               X --> exit and raise exception
+	    while 1:
+                status = os.spawnle(os.P_WAIT, script, script, vars)
+
+                if status != 0:
+	            if "debug" in vars and vars["debug"] == "true":
+	                debug_exit = os.spawnle(os.P_WAIT, "/bin/sh", "/bin/sh", vars)
+			if debug_exit == 1:
+			    continue
+			elif debug_exit == 2:
+			    return
+
+                        raise "rootstrap: Module '%s' failed, status: %d" % (module,status)
+		return
+
     raise "rootstrap: unknown module: %s\n" % module
         
 config = ConfigParser.ConfigParser()




More information about the Pkg-uml-commit mailing list