@@ -0,0 +1,703 @@
+#%0A# Copyright (c) 2007 rPath, Inc.%0A#%0A# All rights reserved%0A#%0A%0Aimport os%0Aimport logging%0Alog = logging%0Aimport popen2%0A%0Adef rewriteFile(template, target, data):%0A    if not os.path.exists(template):%0A        return%0A    f = open(template, 'r')%0A    templateData = f.read()%0A    f.close()%0A    f = open(target, 'w')%0A    f.write(templateData %25 data)%0A    f.close()%0A    os.unlink(template)%0A%0A%0Adef logCall(cmd, checkReturn = True):%0A    log.debug(%22+ %22 + cmd)%0A    p = popen2.Popen4(cmd)%0A    if p.wait() and checkReturn:%0A        err = p.fromchild.read()%0A        raise RuntimeError(%22Error %25s%22 %25 (err))%0A    else:%0A        p.wait()%0A        err = p.fromchild.read()%0A        %5Blog.debug(errLine) for errLine in err.split(%22%5Cn%22)%5D%0A%0A

split out utility functions into separate module