kadischi/livecd_generator kadischi.py,1.21,1.22

Chitlesh GOORAH (chitlesh) fedora-extras-commits at redhat.com
Tue Jul 4 15:02:11 UTC 2006


Author: chitlesh

Update of /cvs/devel/kadischi/livecd_generator
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29317/livecd_generator

Modified Files:
	kadischi.py 
Log Message:



Index: kadischi.py
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/kadischi.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- kadischi.py	4 Jul 2006 14:44:49 -0000	1.21
+++ kadischi.py	4 Jul 2006 15:02:09 -0000	1.22
@@ -22,6 +22,7 @@
 
 def main():
     force = False
+    method = None
     # setup dirs
     bindir = sys.path [0]
     confdir = normalize_path(['/etc/kadischi'])
@@ -107,7 +108,7 @@
     print "[kadischi]: running post installation scripts"
     run_scripts(sysdir)
 
-    ### Calculate size of result ISO image by known ratios for SquashFS (anywhere from 2.5 to 2.7)
+    ### Calculate size of result ISO image by known ratios for SquashFS (anywhere from 2.6 to 2.8)
     size = 0
     stepsize = 0
 
@@ -118,8 +119,8 @@
         stepsize = (size + stepsize)
 
     totalsize = stepsize
-    estimate0 = (totalsize / 2.5) ## Observed ratio for SquashFS
-    estimate1 = (totalsize / 2.7) ## Observed ratio for SquashFS
+    estimate0 = (totalsize / 2.6) ## Observed ratio for SquashFS
+    estimate1 = (totalsize / 2.8) ## Observed ratio for SquashFS
 
     print ("Estimated %s size is between %s and %s bytes" % (isoimage, estimate1, estimate0))
 
@@ -234,6 +235,28 @@
     return parser.parse_args()
 
 
+def method_check(method):
+    def exists(url):
+        try:
+            u = grabber.urlopen(url, retry=5)
+            u.close()
+            print "[kadischi]: Repository seems to be OK."
+            return True
+        except grabber.URLGrabError, e:
+            print "[kadischi]: Repository validation failed. Aborting execution."
+            logging.debug("[kadischi]: Unable to find %s: %s" %(url, e))
+            return False
+
+    if method.startswith("http://") or method.startswith("ftp://") or method.find(":") == -1:
+        if not exists("%s/repodata/repomd.xml" %(method,)):
+            return None
+        if method.find(":") == -1:
+            method = "nfs:/%s" %(method,)
+        return method
+    print >> sys.stderr, "Unable to determine how to use method"
+    return None
+
+
 def buildstamping(builddir):
     """ check if we can open buildstamp file """
     if not os.access(buildstamp, os.R_OK):
@@ -278,41 +301,21 @@
         if rc != 0:
             logging.warn("script %s exited abnormally" %(os.path.basename(s),))
 
-def method_check(method):
-    def exists(url):
-        try:
-            u = grabber.urlopen(url, retry=5)
-            u.close()
-            print "[kadischi]: Repository seems to be OK."
-            return True
-        except grabber.URLGrabError, e:
-            print "[kadischi]: Repository validation failed. Aborting execution."
-            logging.debug("[kadischi]: Unable to find %s: %s" %(url, e))
-            return False
-
-    if method.startswith("http://") or method.startswith("ftp://") or method.find(":") == -1:
-        if not exists("%s/repodata/repomd.xml" %(method,)):
-            return None
-        if method.find(":") == -1:
-            method = "nfs:/%s" %(method,)
-        return method
-    print >> sys.stderr, "Unable to determine how to use method"
-    return None
 
 def execute (args):
     if not os.access(args[0], os.X_OK):
-        print >> sys.stderr, "[kadischi]: unable to access", args[0]
-        cleanup(builddir)
+        print "unable to access", args[0]
     rc = subprocess.call(args)
     if rc:
         raise RuntimeError, "Failed to execute", args[0]
         cleanup(builddir)
-        
+
+
 if __name__ == "__main__":
     try:
         rc = main()
     except KeyboardInterrupt, e:
-        print >> sys.stderr, "\n\n[kadischi]: Exiting on user cancel.(ctrl+c)"
+        print >> sys.stderr, "\n\nExiting on user cancel."
         cleanup(builddir)
         sys.exit(1)
     except RuntimeError, e:




More information about the fedora-extras-commits mailing list