import util
from constants import *
-from errors import BuildRootLocked
+from errors import BuildError, BuildRootLocked, Error
class Builder(object):
def build(self):
self.create_icecream_toolchain()
- self.make("build")
+ try:
+ self.make("build")
+
+ except Error:
+ raise BuildError, "The build command failed."
for pkg in reversed(self.packages):
packager = packages.Packager(self.pakfire, pkg, self)
self.pkg.dist(self)
def shell(self, args=[]):
+ if not util.cli_is_interactive():
+ logging.warning("Cannot run shell on non-interactive console.")
+ return
+
# XXX need to set CFLAGS here
command = "/usr/sbin/chroot %s /usr/bin/chroot-shell %s" % \
(self.chrootPath(), " ".join(args))
import packages
import repository
+import util
from pakfire import Pakfire
If the software is running in a non-inteactive shell, no question
is asked at all and the answer is always "yes".
"""
- if not sys.stdin.isatty() or not sys.stdout.isatty() or not sys.stderr.isatty():
+ if not util.cli_is_interactive():
return True
print _("%s [y/N]") % question,
_libc.unshare.restype = ctypes.c_int
CLONE_NEWNS = 0x00020000
+def cli_is_interactive():
+ """
+ Say weather a shell is interactive or not.
+ """
+ if sys.stdin.isatty() and sys.stdout.isatty() and sys.stderr.isatty():
+ return True
+
+ return False
+
def rm(path, *args, **kargs):
"""
version of shutil.rmtree that ignores no-such-file-or-directory errors,