Avoid Unnecessary Builds

By default, stop the universe build if a key component fails.  This
avoids useless builds when we know a package is broken anyway.
Provide a --keep-going option to override this behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173723 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene 2013-01-28 22:05:50 +00:00
parent 87e10dfefa
commit fcb979ca1a

View File

@ -1,11 +1,11 @@
#!/usr/bin/python3 #!/usr/bin/python3
##===- utils/llvmbuild - Build the LLVM project ----------------*-python-*-===## ##===- utils/llvmbuild - Build the LLVM project ----------------*-python-*-===##
# #
# The LLVM Compiler Infrastructure # The LLVM Compiler Infrastructure
# #
# This file is distributed under the University of Illinois Open Source # This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details. # License. See LICENSE.TXT for details.
# #
##===----------------------------------------------------------------------===## ##===----------------------------------------------------------------------===##
# #
# This script builds many different flavors of the LLVM ecosystem. It # This script builds many different flavors of the LLVM ecosystem. It
@ -147,6 +147,8 @@ def add_options(parser):
help=("Do not build dragonegg")) help=("Do not build dragonegg"))
parser.add_option("--no-install", default=False, action="store_true", parser.add_option("--no-install", default=False, action="store_true",
help=("Do not do installs")) help=("Do not do installs"))
parser.add_option("--keep-going", default=False, action="store_true",
help=("Keep going after failures"))
return return
def check_options(parser, options, valid_builds): def check_options(parser, options, valid_builds):
@ -282,7 +284,7 @@ class Builder(threading.Thread):
for key, value in env.items(): for key, value in env.items():
execenv[key] = value execenv[key] = value
self.logger.debug("[" + prefix + "] " + "env " + str(env) + " " self.logger.debug("[" + prefix + "] " + "env " + str(env) + " "
+ " ".join(command)); + " ".join(command));
@ -299,6 +301,11 @@ class Builder(threading.Thread):
+ str(line, "utf-8").rstrip()) + str(line, "utf-8").rstrip())
line = proc.stdout.readline() line = proc.stdout.readline()
(stdoutdata, stderrdata) = proc.communicate()
retcode = proc.wait()
return retcode
except: except:
traceback.print_exc() traceback.print_exc()
@ -327,6 +334,7 @@ class Builder(threading.Thread):
self.logger.debug("Start Gather") self.logger.debug("Start Gather")
gather = True gather = True
line = proc.stdout.readline() line = proc.stdout.readline()
except: except:
traceback.print_exc() traceback.print_exc()
self.logger.debug(includes) self.logger.debug(includes)
@ -438,7 +446,7 @@ class Builder(threading.Thread):
for component in components: for component in components:
comp = component[:] comp = component[:]
if (self.options.no_dragonegg): if (self.options.no_dragonegg):
if (comp == 'dragonegg'): if (comp == 'dragonegg'):
self.logger.info("Skipping " + component + " in " self.logger.info("Skipping " + component + " in "
@ -458,43 +466,74 @@ class Builder(threading.Thread):
"").split()) "").split())
self.logger.info("Configuring " + component + " in " + builddir) self.logger.info("Configuring " + component + " in " + builddir)
self.configure(component, srcdir, builddir, configrc = self.configure(component, srcdir, builddir,
config_args, config_args,
configure_env[comp_key][build]) configure_env[comp_key][build])
self.logger.info("Building " + component + " in " + builddir) if (configrc == None) :
self.logger.info("Build: make " + str(make_flags[comp_key][build])) self.logger.info("[None] Failed to configure " + component + " in " + installdir)
self.make(component, srcdir, builddir,
make_flags[comp_key][build],
make_env[comp_key][build])
if (not self.options.no_install): if (configrc == 0 or self.options.keep_going) :
self.logger.info("Installing " + component + " in " + installdir) self.logger.info("Building " + component + " in " + builddir)
self.make(component, srcdir, builddir, self.logger.info("Build: make " + str(make_flags[comp_key][build]))
make_install_flags[comp_key][build], buildrc = self.make(component, srcdir, builddir,
make_install_env[comp_key][build]) make_flags[comp_key][build],
make_env[comp_key][build])
self.logger.info("Testing " + component + " in " + builddir) if (buildrc == None) :
self.logger.info("Test: make " self.logger.info("[None] Failed to build " + component + " in " + installdir)
+ str(make_check_flags[comp_key][build]))
self.make(component, srcdir, builddir,
make_check_flags[comp_key][build],
make_check_env[comp_key][build])
if (buildrc == 0 or self.options.keep_going) :
self.logger.info("Testing " + component + " in " + builddir)
self.logger.info("Test: make "
+ str(make_check_flags[comp_key][build]))
testrc = self.make(component, srcdir, builddir,
make_check_flags[comp_key][build],
make_check_env[comp_key][build])
if (testrc == None) :
self.logger.info("[None] Failed to test " + component + " in " + installdir)
if ((testrc == 0 or self.options.keep_going)
and not self.options.no_install):
self.logger.info("Installing " + component + " in " + installdir)
self.make(component, srcdir, builddir,
make_install_flags[comp_key][build],
make_install_env[comp_key][build])
else :
self.logger.info("Failed testing " + component + " in " + installdir)
else :
self.logger.info("Failed to build " + component + " in " + installdir)
else :
self.logger.info("Failed to configure " + component + " in " + installdir)
def configure(self, component, srcdir, builddir, flags, env): def configure(self, component, srcdir, builddir, flags, env):
prefix = self.component_abbrev[component.replace("-", "_")]
self.logger.debug("Configure " + str(flags) + " " + str(srcdir) + " -> " self.logger.debug("Configure " + str(flags) + " " + str(srcdir) + " -> "
+ str(builddir)) + str(builddir))
configure_files = dict( configure_files = dict(
llvm=[(srcdir + "/configure", builddir + "/Makefile")], llvm=[(srcdir + "/configure", builddir + "/Makefile")],
dragonegg=[("","")]) dragonegg=[(None,None)])
doconfig = False doconfig = False
for conf, mf in configure_files[component.replace("-", "_")]: for conf, mf in configure_files[component.replace("-", "_")]:
if conf is None:
# No configure necessary
return 0
if not os.path.exists(conf): if not os.path.exists(conf):
return self.logger.info("[" + prefix + "] Configure failed, no configure script " + conf)
return -1
if not os.path.exists(mf):
self.logger.info("[" + prefix + "] Configure failed, no makefile " + mf)
return -1
if os.path.exists(conf) and os.path.exists(mf): if os.path.exists(conf) and os.path.exists(mf):
confstat = os.stat(conf) confstat = os.stat(conf)
makestat = os.stat(mf) makestat = os.stat(mf)
@ -506,16 +545,17 @@ class Builder(threading.Thread):
break break
if not doconfig and not self.options.force_configure: if not doconfig and not self.options.force_configure:
return return 0
program = srcdir + "/configure" program = srcdir + "/configure"
if not is_executable(program): if not is_executable(program):
return self.logger.info("[" + prefix + "] Configure failed, cannot execute " + program)
return -1
args = [program] args = [program]
args += ["--verbose"] args += ["--verbose"]
args += flags args += flags
self.execute(args, builddir, env, component) return self.execute(args, builddir, env, component)
def make(self, component, srcdir, builddir, flags, env): def make(self, component, srcdir, builddir, flags, env):
program = find_executable("make") program = find_executable("make")
@ -527,7 +567,7 @@ class Builder(threading.Thread):
args = [program] args = [program]
args += flags args += flags
self.execute(args, builddir, env, component) return self.execute(args, builddir, env, component)
# Global constants # Global constants
build_abbrev = dict(debug="dbg", release="opt", paranoid="par") build_abbrev = dict(debug="dbg", release="opt", paranoid="par")