3 from config import config
6 return re.sub("([\"\\\\$`])", r"\\\1", cmd)
8 def command(cmd, user = None):
10 user = config.builder_user
11 return "%s sudo chroot %s su - %s -c \"export LC_ALL=C; %s\"" \
12 % (config.sudo_chroot_wrapper, config.chroot, user, quote(cmd))
15 return "%s sudo chroot %s /bin/sh -c \"export LC_ALL=C; %s\"" \
16 % (config.sudo_chroot_wrapper, config.chroot, quote(cmd))
18 def popen(cmd, user = "builder", mode = "r"):
19 f = os.popen(command(cmd, user), mode)
22 def run(cmd, user = "builder", logfile = None):
23 c = command(cmd, user)
26 c = "%s >> %s 2>&1" % (c, logfile)
27 except UnicodeDecodeError:
28 c..decode('iso-8859-2')
29 c = "%s >> %s 2>&1" % (c, logfile)
31 for l in f.xreadlines():