3 from config import config
6 return re.sub("([\"\\\\$`])", r"\\\1", cmd)
8 def command(cmd, user = "builder"):
9 return "sudo chroot %s su - %s -c \"export LC_ALL=C; %s\"" % (config.chroot, user, quote(cmd))
12 return "sudo chroot %s /bin/sh -c \"export LC_ALL=C; %s\"" % (config.chroot, quote(cmd))
14 def popen(cmd, user = None):
15 f = os.popen(command(cmd, user))
18 def run(cmd, user = None, logfile = None)
19 c = command(cmd, user)
21 c = "%s >> %s 2>&1" % (c, logfile)
23 for l in f.xreadlines():