Reverted r9779 because it makes rosmake hang on OS X
This commit is contained in:
parent
29ebd98fc4
commit
371ecfd5ef
|
@ -120,29 +120,33 @@ class CompileThread(threading.Thread):
|
|||
def run(self):
|
||||
#init_total_pkgs = len(self.build_queue.to_build)
|
||||
while not self.build_queue.is_done():
|
||||
pkg = self.build_queue.get_valid_package()
|
||||
(pkg, build_count, total_pkgs) = self.build_queue.get_valid_package()
|
||||
if not pkg:
|
||||
if self.build_queue.succeeded():
|
||||
self.rosmakeall.printer.print_verbose("[ Build Completed Thread Exiting ]", thread_name=self.name);
|
||||
self.rosmakeall.print_verbose("[ Build Completed Thread Exiting ]", thread_name=self.name);
|
||||
else:
|
||||
self.rosmakeall.printer.print_verbose("[ Build Terminated Thread Exiting ]", thread_name=self.name)
|
||||
self.rosmakeall.print_verbose("[ Build Terminated Thread Exiting ]", thread_name=self.name)
|
||||
break # no more packages must be done
|
||||
|
||||
#self.rosmakeall.print_all("[ Building package [%s] %d of %d]"%( pkg, build_count, total_pkgs));
|
||||
|
||||
if self.argument:
|
||||
self.rosmakeall.printer.print_all ("Starting >>> %s [ make %s ]"%(pkg, self.argument), thread_name=self.name)
|
||||
spaces = max(1, 30 - len(pkg) - len(self.argument))
|
||||
self.rosmakeall.print_all (">>> %s >>> [ make %s ]%s[ %d of %d ]"%(pkg, self.argument, ' '*spaces, build_count, total_pkgs), thread_name=self.name)
|
||||
else:
|
||||
self.rosmakeall.printer.print_all ("Starting >>> %s [ make ] "%pkg, thread_name=self.name)
|
||||
self.rosmakeall.update_status("old" + self.build_queue.get_thread_status() , self.build_queue.progress_str())
|
||||
spaces = max(1, 30 - len(pkg))
|
||||
self.rosmakeall.print_all (">>> %s >>> [ make ]%s[ %d of %d ]"%(pkg, ' '*spaces, build_count, total_pkgs), thread_name=self.name)
|
||||
|
||||
(result, result_string) = self.rosmakeall.build(pkg, self.argument, self.build_queue.robust_build)
|
||||
self.rosmakeall.printer.print_all("Finished <<< %s %s"%(pkg, result_string), thread_name= self.name)
|
||||
self.rosmakeall.print_all("<<< %s <<< %s"%(pkg, result_string), thread_name= self.name)
|
||||
if result or self.build_queue.robust_build:
|
||||
self.build_queue.return_built(pkg)
|
||||
if result_string.find("[Interrupted]") != -1:
|
||||
self.rosmakeall.printer.print_all("Caught Interruption", thread_name=self.name)
|
||||
self.rosmakeall.print_all("Caught Interruption", thread_name=self.name)
|
||||
self.build_queue.stop()
|
||||
break # unnecessary since build_queue is done now while will quit
|
||||
else:
|
||||
self.rosmakeall.printer.print_all("Halting due to failure in package %s. \n[ rosmake ] Waiting for other threads to complete."%pkg)
|
||||
self.rosmakeall.print_all("Halting due to failure in package %s. \n[ rosmake ] Waiting for other threads to complete."%pkg)
|
||||
self.build_queue.stop()
|
||||
break # unnecessary since build_queue is done now, while will quit
|
||||
|
||||
|
@ -157,17 +161,6 @@ class BuildQueue:
|
|||
self.condition = threading.Condition()
|
||||
self._done = False
|
||||
self.robust_build = robust_build
|
||||
self.started = {}
|
||||
|
||||
def progress_str(self):
|
||||
return "[ %d Active, %d of %d Complete ]"%(len(self.started), len(self.built), self._total_pkgs)
|
||||
|
||||
def get_thread_status(self): #TODO sort this other than hash order
|
||||
threads = []
|
||||
for p, t in self.started.iteritems():
|
||||
threads.append("[ %s: %.2f sec ]"%(p, time.time() - t))
|
||||
|
||||
return "Threads: "+ " | ".join(threads)
|
||||
|
||||
def is_done(self):
|
||||
"""Return if the build queue has been completed """
|
||||
|
@ -189,10 +182,6 @@ class BuildQueue:
|
|||
this method."""
|
||||
with self.condition:
|
||||
self.built.append(package)
|
||||
if package in self.started.keys():
|
||||
self.started.pop(package)
|
||||
else:
|
||||
pass #used early on print "\n\n\nERROR THIS SHOULDN't RETURN %s\n\n\n"%package
|
||||
if len(self.built) == self._total_pkgs: #flag that we're finished
|
||||
self._done = True
|
||||
self.condition.notifyAll() #wake up any waiting threads
|
||||
|
@ -211,15 +200,15 @@ class BuildQueue:
|
|||
break
|
||||
if dependencies_met: # all dependencies met
|
||||
self.to_build.remove(p)
|
||||
self.started[p] = time.time()
|
||||
return p # break out and return package if found
|
||||
count = self._total_pkgs - len(self.to_build)
|
||||
return (p, count, self._total_pkgs) # break out and return package if found
|
||||
|
||||
|
||||
self.condition.wait() # failed to find a package wait for a notify before looping
|
||||
if self.is_done():
|
||||
break
|
||||
|
||||
return None
|
||||
return (None, None, None)
|
||||
|
||||
|
||||
def register_prebuilt(self, package_list):
|
||||
|
|
|
@ -61,122 +61,16 @@ def make_command():
|
|||
return os.environ.get("MAKE", "make")
|
||||
|
||||
|
||||
|
||||
class Printer(threading.Thread):
|
||||
def __init__(self):
|
||||
threading.Thread.__init__(self)
|
||||
self.build_queue = None
|
||||
self.condition = threading.Condition()
|
||||
self.running = True
|
||||
self.status = ""
|
||||
self.verbose = False
|
||||
self.full_verbose = False
|
||||
self.daemon = True
|
||||
self.start()
|
||||
|
||||
|
||||
|
||||
def run(self):
|
||||
with self.condition:
|
||||
while True:
|
||||
if self.build_queue:
|
||||
try: # catch shutdown race condition when build_queue destructed
|
||||
self.set_status(self.build_queue.get_thread_status(), self.build_queue.progress_str())
|
||||
except exception.TypeError, ex:
|
||||
self.status = ''
|
||||
else:
|
||||
self.status = ""
|
||||
if len(self.status) > 0:
|
||||
n = self.terminal_width() - len(self.status)
|
||||
status = self.status
|
||||
if n > 0:
|
||||
status = " "*n + self.status
|
||||
self._print_status("%s"%status)
|
||||
time.sleep(1.0/60.) # update status at 60Hz
|
||||
|
||||
def set_status(self, left, right = ''):
|
||||
header = "[ rosmake ] "
|
||||
h = len(header)
|
||||
l = len(left)
|
||||
r = len(right)
|
||||
w = self.terminal_width()
|
||||
if l + r < w - h:
|
||||
padding = w - h - l - r
|
||||
self.status = header + left + " "*padding + right
|
||||
else:
|
||||
self.status = header + left[:(w - h - r - 4)] + "... " + right
|
||||
|
||||
def print_all(self, s, thread_name=None):
|
||||
if thread_name is None:
|
||||
sys.stdout.write("[ rosmake ] %s\n"%s)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
sys.stdout.write("[rosmake-%s] %s\n"%(thread_name, s))
|
||||
sys.stdout.flush()
|
||||
|
||||
def print_verbose(self, s, thread_name=None):
|
||||
if self.verbose or self.full_verbose:
|
||||
if thread_name:
|
||||
self.print_all(s, thread_name=thread_name)
|
||||
else:
|
||||
print "[ rosmake ] %s"%s
|
||||
|
||||
def print_full_verbose(self, s):
|
||||
if self.full_verbose:
|
||||
print "[ rosmake ] %s"%s
|
||||
|
||||
def print_tail(self, s, tail_lines=40):
|
||||
lines = s.splitlines()
|
||||
if self.full_verbose:
|
||||
tail_lines = len(lines)
|
||||
|
||||
num_lines = min(len(lines), tail_lines)
|
||||
if num_lines == tail_lines:
|
||||
print "[ rosmake ] Last %d lines"%num_lines
|
||||
else:
|
||||
print "[ rosmake ] All %d lines"%num_lines
|
||||
print "{" + "-"*79
|
||||
for l in xrange(-num_lines, -1):
|
||||
print " %s"%lines[l]
|
||||
print "-"*79 + "}"
|
||||
|
||||
def _print_status(self, s):
|
||||
sys.stdout.write("\r%s"%(s))
|
||||
sys.stdout.flush()
|
||||
|
||||
@staticmethod
|
||||
def terminal_width():
|
||||
"""Estimate the width of the terminal"""
|
||||
width = 0
|
||||
try:
|
||||
import struct, fcntl, termios
|
||||
s = struct.pack('HHHH', 0, 0, 0, 0)
|
||||
x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
|
||||
width = struct.unpack('HHHH', x)[1]
|
||||
except IOError:
|
||||
pass
|
||||
if width <= 0:
|
||||
try:
|
||||
width = int(os.environ['COLUMNS'])
|
||||
except:
|
||||
pass
|
||||
if width <= 0:
|
||||
width = 80
|
||||
|
||||
return width
|
||||
|
||||
|
||||
|
||||
|
||||
class RosMakeAll:
|
||||
def __init__(self):
|
||||
self._result_lock = threading.Lock()
|
||||
self.printer = Printer()
|
||||
self.result = {}
|
||||
self.paths = {}
|
||||
self.dependency_tracker = parallel_build.DependencyTracker()
|
||||
self.flag_tracker = package_stats.PackageFlagTracker(self.dependency_tracker)
|
||||
self.output = {}
|
||||
self.verbose = False
|
||||
self.full_verbose = False
|
||||
self.profile = {}
|
||||
self.ros_parallel_jobs = 0
|
||||
self.build_list = []
|
||||
|
@ -197,11 +91,6 @@ class RosMakeAll:
|
|||
"""
|
||||
return len(self.result[argument].keys())
|
||||
|
||||
def update_status(self, left, right):
|
||||
#thread_status = "todo1 | todo2 | todo3 | todo1 | todo2 | todo3 |" * 3
|
||||
#left = "[ Status ] " + thread_status
|
||||
self.printer.set_status("Thread Status: " + left, right)
|
||||
|
||||
def get_path(self, package):
|
||||
if not package in self.paths:
|
||||
self.paths[package] = roslib.packages.get_pkg_dir(package)
|
||||
|
@ -250,18 +139,17 @@ class RosMakeAll:
|
|||
self.build_list.append(p)
|
||||
except roslib.packages.InvalidROSPkgException, ex:
|
||||
if not self.robust_build:
|
||||
self.printer.print_all("Exiting due to missing package: %s"%ex)
|
||||
self.print_all("Exiting due to missing package: %s"%ex)
|
||||
sys.exit(-1)
|
||||
else:
|
||||
self.printer.print_all("!"*20 + " Package %s does not exist. %s"%(p, ex) + "!"*20)
|
||||
self.print_all("!"*20 + " Package %s does not exist. %s"%(p, ex) + "!"*20)
|
||||
|
||||
|
||||
def parallel_build_pkgs(self, build_queue, argument = None, threads = 1):
|
||||
self.profile[argument] = {}
|
||||
self.output[argument] = {}
|
||||
with self._result_lock:
|
||||
if argument not in self.result.keys():
|
||||
self.result[argument] = {}
|
||||
self.result[argument] = {}
|
||||
|
||||
cts = []
|
||||
for i in xrange(0, threads):
|
||||
|
@ -273,7 +161,7 @@ class RosMakeAll:
|
|||
ct.join()
|
||||
#print "naturally ended thread", ct
|
||||
except KeyboardInterrupt:
|
||||
self.printer.print_all( "Caught KeyboardInterrupt. Stopping build.")
|
||||
self.print_all( "Caught KeyboardInterrupt. Stopping build.")
|
||||
build_queue.stop()
|
||||
ct.join()
|
||||
pass
|
||||
|
@ -300,7 +188,7 @@ class RosMakeAll:
|
|||
cmd = ["bash", "-c", "cd %s && %s "%(self.get_path(package), make_command()) ] #UNIXONLY
|
||||
if argument:
|
||||
cmd[-1] += argument
|
||||
self.printer.print_full_verbose (cmd)
|
||||
self.print_full_verbose (cmd)
|
||||
command_line = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=local_env)
|
||||
(pstd_out, pstd_err) = command_line.communicate() # pstd_err should be None due to pipe above
|
||||
return (command_line.returncode, pstd_out)
|
||||
|
@ -336,7 +224,7 @@ class RosMakeAll:
|
|||
else:
|
||||
log_type = "build"
|
||||
if not returncode:
|
||||
self.printer.print_full_verbose( pstd_out)
|
||||
self.print_full_verbose( pstd_out)
|
||||
with self._result_lock:
|
||||
self.result[argument][p] = True
|
||||
|
||||
|
@ -358,7 +246,7 @@ class RosMakeAll:
|
|||
with self._result_lock:
|
||||
self.result[argument][p] = True if no_target else False
|
||||
|
||||
self.printer.print_tail( pstd_out)
|
||||
self.print_tail( pstd_out)
|
||||
self.output_to_file(p, log_type, pstd_out, always_print= not (no_target or interrupt))
|
||||
|
||||
return (False, return_string)
|
||||
|
@ -372,7 +260,7 @@ class RosMakeAll:
|
|||
except roslib.packages.InvalidROSPkgException, ex:
|
||||
with self._result_lock:
|
||||
self.result[argument][p] = False
|
||||
self.printer.print_verbose ("[SKIP] Package not found\n")
|
||||
self.print_verbose ("[SKIP] Package not found\n")
|
||||
self.output[argument][p] = "Package not found %s"%ex
|
||||
return (False, return_string)
|
||||
|
||||
|
@ -389,29 +277,22 @@ class RosMakeAll:
|
|||
stdout_file.write(stdout)
|
||||
print_string = "Output from build of package %s written to:\n[ rosmake ] %s"%(package, std_out_filename)
|
||||
if always_print:
|
||||
self.printer.print_all(print_string)
|
||||
self.print_all(print_string)
|
||||
else:
|
||||
self.printer.print_full_verbose(print_string)
|
||||
self.print_full_verbose(print_string)
|
||||
|
||||
def generate_summary_output(self, log_dir):
|
||||
if not self.logging_enabled:
|
||||
return
|
||||
|
||||
self.printer.print_all("Results:")
|
||||
if 'clean' in self.result.keys():
|
||||
self.printer.print_all("Cleaned %d packages."%len(self.result['clean']))
|
||||
if None in self.result.keys():
|
||||
self.printer.print_all("Built %d packages."%len(self.result[None]))
|
||||
if 'test' in self.result.keys():
|
||||
self.printer.print_all("Tested %d packages."%len(self.result['test']))
|
||||
self.printer.print_all("Summary output to directory")
|
||||
self.printer.print_all("%s"%self.log_dir)
|
||||
self.print_all("Summary output to directory")
|
||||
self.print_all("%s"%self.log_dir)
|
||||
if self.rosdep_install_result:
|
||||
self.printer.print_all("ERROR: Rosdep installation failed with exception: %s"%self.rosdep_install_result)
|
||||
self.print_all("ERROR: Rosdep installation failed with exception: %s"%self.rosdep_install_result)
|
||||
if self.rosdep_check_result:
|
||||
self.printer.print_all("WARNING: Rosdep did not detect the following system dependencies as installed: %s Consider using --rosdep-install option or `rosdep install %s`"%(self.rosdep_check_result, ' '.join(self.specified_packages)))
|
||||
self.print_all("WARNING: Rosdep did not detect the following system dependencies as installed: %s Consider using --rosdep-install option or `rosdep install %s`"%(self.rosdep_check_result, ' '.join(self.specified_packages)))
|
||||
if self.rejected_packages:
|
||||
self.printer.print_all("WARNING: Skipped command line arguments: %s because they could not be resolved to a stack name or a package name. "%self.rejected_packages)
|
||||
self.print_all("WARNING: Skipped command line arguments: %s because they could not be resolved to a stack name or a package name. "%self.rejected_packages)
|
||||
|
||||
|
||||
|
||||
|
@ -502,6 +383,61 @@ class RosMakeAll:
|
|||
output = output + "----------------\n" + "%.2f Cumulative, %.2f Elapsed, %.2f Speedup \n"%(total, elapsed_time, float(total) / float(elapsed_time))
|
||||
return output
|
||||
|
||||
@staticmethod
|
||||
def terminal_width():
|
||||
"""Estimate the width of the terminal"""
|
||||
width = 0
|
||||
try:
|
||||
import struct, fcntl, termios
|
||||
s = struct.pack('HHHH', 0, 0, 0, 0)
|
||||
x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
|
||||
width = struct.unpack('HHHH', x)[1]
|
||||
except IOError:
|
||||
pass
|
||||
if width <= 0:
|
||||
try:
|
||||
width = int(os.environ['COLUMNS'])
|
||||
except:
|
||||
pass
|
||||
if width <= 0:
|
||||
width = 80
|
||||
|
||||
return width
|
||||
|
||||
def print_all(self, s, thread_name=None):
|
||||
if thread_name is None:
|
||||
sys.stdout.write("\r[ rosmake ] %s"%s)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
sys.stdout.write("\r[rosmake-%s] %s"%(thread_name, s))
|
||||
sys.stdout.flush()
|
||||
|
||||
def print_verbose(self, s, thread_name=None):
|
||||
if self.verbose or self.full_verbose:
|
||||
if thread_name:
|
||||
self.print_all(s, thread_name=thread_name)
|
||||
else:
|
||||
print "[ rosmake ] %s"%s
|
||||
|
||||
def print_full_verbose(self, s):
|
||||
if self.full_verbose:
|
||||
print "[ rosmake ] %s"%s
|
||||
|
||||
def print_tail(self, s, tail_lines=40):
|
||||
lines = s.splitlines()
|
||||
if self.full_verbose:
|
||||
tail_lines = len(lines)
|
||||
|
||||
num_lines = min(len(lines), tail_lines)
|
||||
if num_lines == tail_lines:
|
||||
print "[ rosmake ] Last %d lines"%num_lines
|
||||
else:
|
||||
print "[ rosmake ] All %d lines"%num_lines
|
||||
print "{" + "-"*79
|
||||
for l in xrange(-num_lines, -1):
|
||||
print " %s"%lines[l]
|
||||
print "-"*79 + "}"
|
||||
|
||||
def assert_prebuild_built(self, ros_package_path_list, target=''):
|
||||
ret_val = True
|
||||
count = 0
|
||||
|
@ -512,12 +448,12 @@ class RosMakeAll:
|
|||
if self.flag_tracker.has_nobuild(pkg_name):
|
||||
ret_val &= True
|
||||
else:
|
||||
self.printer.print_all("Special Case: %s [ %s %s ] [ %d of %d ] "%(pkg_name, make_command(), target, count, len(ros_package_path_list)))
|
||||
self.print_all("Special Case: %s [ %s %s ] [ %d of %d ] "%(pkg_name, make_command(), target, count, len(ros_package_path_list)))
|
||||
cmd = ["bash", "-c", "cd %s && %s %s"%(os.path.join(os.environ["ROS_ROOT"], pkg), make_command(), target)]
|
||||
command_line = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
(pstd_out, pstd_err) = command_line.communicate() # pstd_err should be None due to pipe above
|
||||
|
||||
self.printer.print_verbose(pstd_out)
|
||||
self.print_verbose(pstd_out)
|
||||
if command_line.returncode:
|
||||
print >> sys.stderr, "Failed to build %s"%pkg_name
|
||||
sys.exit(-1)
|
||||
|
@ -623,7 +559,7 @@ class RosMakeAll:
|
|||
self.threads = options.threads
|
||||
self.skip_blacklist = options.skip_blacklist
|
||||
if options.skip_blacklist_osx:
|
||||
self.printer.print_all("Option --skip-blacklist-osx is deprecated. It will do nothing, please use platform declarations and --require-platform instead");
|
||||
self.print_all("Option --skip-blacklist-osx is deprecated. It will do nothing, please use platform declarations and --require-platform instead");
|
||||
self.logging_enabled = options.logging_enabled
|
||||
if options.obey_whitelist or options.obey_whitelist_recursively:
|
||||
self.obey_whitelist = True
|
||||
|
@ -631,52 +567,52 @@ class RosMakeAll:
|
|||
self.obey_whitelist_recursively = True
|
||||
|
||||
# pass through verbosity options
|
||||
self.printer.full_verbose = options.full_verbose
|
||||
self.printer.verbose = options.verbose
|
||||
self.full_verbose = options.full_verbose
|
||||
self.verbose = options.verbose
|
||||
|
||||
packages = []
|
||||
#load packages from arguments
|
||||
if options.build_all:
|
||||
packages = roslib.packages.list_pkgs()
|
||||
self.printer.print_all( "Building all packages")
|
||||
self.print_all( "Building all packages")
|
||||
else: # no need to extend if all already selected
|
||||
if options.buildtest:
|
||||
for p in options.buildtest:
|
||||
packages.extend(roslib.rospack.rospack_depends_on(p))
|
||||
self.printer.print_all( "buildtest requested for package %s adding it and all dependent packages: "%p)
|
||||
self.print_all( "buildtest requested for package %s adding it and all dependent packages: "%p)
|
||||
|
||||
if options.buildtest1:
|
||||
for p in options.buildtest1:
|
||||
packages.extend(roslib.rospack.rospack_depends_on_1(p))
|
||||
self.printer.print_all( "buildtest1 requested for package %s adding it and all depends-on1 packages: "%p)
|
||||
self.print_all( "buildtest1 requested for package %s adding it and all depends-on1 packages: "%p)
|
||||
|
||||
if len(packages) == 0 and len(args) == 0:
|
||||
p = os.path.basename(os.path.abspath('.'))
|
||||
try:
|
||||
if (os.path.samefile(roslib.packages.get_pkg_dir(p), '.')):
|
||||
packages = [p]
|
||||
self.printer.print_all( "No package specified. Building %s"%packages)
|
||||
self.print_all( "No package specified. Building %s"%packages)
|
||||
else:
|
||||
self.printer.print_all("No package selected and the current directory is not the correct path for package '%s'."%p)
|
||||
self.print_all("No package selected and the current directory is not the correct path for package '%s'."%p)
|
||||
|
||||
except roslib.packages.InvalidROSPkgException, ex:
|
||||
try:
|
||||
stack_dir = roslib.stacks.get_stack_dir(p)
|
||||
if os.path.samefile(stack_dir, '.'):
|
||||
packages = [p]
|
||||
self.printer.print_all( "No package specified. Building stack %s"%packages)
|
||||
self.print_all( "No package specified. Building stack %s"%packages)
|
||||
else:
|
||||
self.printer.print_all("No package or stack arguments and the current directory is not the correct path for stack '%s'. Stack directory is: %s."%(p, roslib.stacks.get_stack_dir(p)))
|
||||
self.print_all("No package or stack arguments and the current directory is not the correct path for stack '%s'. Stack directory is: %s."%(p, roslib.stacks.get_stack_dir(p)))
|
||||
except:
|
||||
self.printer.print_all("No package or stack specified. And current directory '%s' is not a package name or stack name."%p)
|
||||
self.print_all("No package or stack specified. And current directory '%s' is not a package name or stack name."%p)
|
||||
else:
|
||||
packages.extend(args)
|
||||
|
||||
if not self.is_rosout_built():
|
||||
packages.append("rosout")
|
||||
self.printer.print_all("Detected rosout not built, adding it to the build")
|
||||
self.print_all("Detected rosout not built, adding it to the build")
|
||||
|
||||
self.printer.print_all( "Packages requested are: %s"%packages)
|
||||
self.print_all( "Packages requested are: %s"%packages)
|
||||
|
||||
|
||||
# Setup logging
|
||||
|
@ -688,28 +624,26 @@ class RosMakeAll:
|
|||
else:
|
||||
self.log_dir = os.path.join(roslib.rosenv.get_ros_home(), "rosmake", date_time_stamp);
|
||||
|
||||
self.printer.print_all("Logging to directory")
|
||||
self.printer.print_all("%s"%self.log_dir)
|
||||
self.print_all("Logging to directory")
|
||||
self.print_all("%s"%self.log_dir)
|
||||
if os.path.exists (self.log_dir) and not os.path.isdir(self.log_dir):
|
||||
self.printer.print_all( "Log destination %s is a file; please remove it or choose a new destination"%self.log_dir)
|
||||
self.print_all( "Log destination %s is a file; please remove it or choose a new destination"%self.log_dir)
|
||||
sys.exit(1)
|
||||
if not os.path.exists (self.log_dir):
|
||||
roslib.rosenv.makedirs_with_parent_perms(self.log_dir)
|
||||
|
||||
(self.specified_packages, self.rejected_packages) = roslib.stacks.expand_to_packages(packages)
|
||||
self.printer.print_all("Expanded args %s to:\n%s"%(packages, self.specified_packages))
|
||||
self.print_all("Expanded args %s to:\n%s"%(packages, self.specified_packages))
|
||||
if self.rejected_packages:
|
||||
self.printer.print_all("WARNING: The following args could not be parsed as stacks or packages: %s"%self.rejected_packages)
|
||||
self.print_all("WARNING: The following args could not be parsed as stacks or packages: %s"%self.rejected_packages)
|
||||
if len(self.specified_packages) == 0 and options.bootstrap == False:
|
||||
self.printer.print_all("ERROR: No arguments could be parsed into valid package or stack names.")
|
||||
self.printer.running = False
|
||||
self.print_all("ERROR: No arguments could be parsed into valid package or stack names.")
|
||||
return False
|
||||
|
||||
if options.unmark_installed:
|
||||
for p in self.specified_packages:
|
||||
if self.flag_tracker.remove_nobuild(p):
|
||||
self.printer.print_all("Removed ROS_NOBUILD from %s"%p)
|
||||
self.printer.running = False
|
||||
self.print_all("Removed ROS_NOBUILD from %s"%p)
|
||||
return True
|
||||
|
||||
required_packages = self.specified_packages[:]
|
||||
|
@ -727,31 +661,31 @@ class RosMakeAll:
|
|||
buildable_packages.append(p)
|
||||
|
||||
if options.rosdep_install:
|
||||
self.printer.print_all("Generating Install Script using rosdep then executing. This may take a minute, you will be prompted for permissions. . .")
|
||||
self.print_all("Generating Install Script using rosdep then executing. This may take a minute, you will be prompted for permissions. . .")
|
||||
self.rosdep_install_result = self.install_rosdeps(buildable_packages, options.rosdep_yes)
|
||||
if self.rosdep_install_result:
|
||||
self.printer.print_all( "rosdep install failed: %s"%self.rosdep_install_result)
|
||||
self.print_all( "rosdep install failed: %s"%self.rosdep_install_result)
|
||||
else:
|
||||
self.printer.print_all("rosdep successfully installed all system dependencies")
|
||||
self.print_all("rosdep successfully installed all system dependencies")
|
||||
|
||||
elif not options.rosdep_disabled:
|
||||
self.printer.print_all("Checking rosdeps compliance for packages %s. This may take a few seconds."%(', '.join(packages)))
|
||||
self.print_all("Checking rosdeps compliance for packages %s. This may take a few seconds."%(', '.join(packages)))
|
||||
(self.rosdep_check_result, warning) = self.check_rosdep(buildable_packages)
|
||||
|
||||
if warning:
|
||||
self.printer.print_all("rosdep produced a warning: %s"%warning)
|
||||
self.print_all("rosdep produced a warning: %s"%warning)
|
||||
|
||||
if len(self.rosdep_check_result) == 0:
|
||||
self.printer.print_all( "rosdep check passed all system dependencies in packages")# %s"% packages)
|
||||
self.print_all( "rosdep check passed all system dependencies in packages")# %s"% packages)
|
||||
else:
|
||||
self.printer.print_all("rosdep check failed to find system dependencies: %s"% self.rosdep_check_result)
|
||||
self.print_all("rosdep check failed to find system dependencies: %s"% self.rosdep_check_result)
|
||||
|
||||
#generate the list of packages necessary to build(in order of dependencies)
|
||||
counter = 0
|
||||
for p in required_packages:
|
||||
|
||||
counter = counter + 1
|
||||
self.printer.print_verbose( "Processing %s and all dependencies(%d of %d requested)"%(p, counter, len(packages)))
|
||||
self.print_verbose( "Processing %s and all dependencies(%d of %d requested)"%(p, counter, len(packages)))
|
||||
self.build_or_recurse(p)
|
||||
|
||||
# remove extra packages if specified-only flag is set
|
||||
|
@ -762,16 +696,14 @@ class RosMakeAll:
|
|||
new_list.append(pkg)
|
||||
self.dependency_tracker = parallel_build.DependencyTracker(self.specified_packages) # this will make the tracker only respond to packages in the list
|
||||
|
||||
self.printer.print_all("specified-only option was used, only building packages %s"%new_list)
|
||||
self.print_all("specified-only option was used, only building packages %s"%new_list)
|
||||
self.build_list = new_list
|
||||
|
||||
if options.pre_clean:
|
||||
build_queue = parallel_build.BuildQueue(self.build_list, self.dependency_tracker, robust_build = True)
|
||||
self.printer.build_queue = build_queue
|
||||
self.parallel_build_pkgs(build_queue, "clean", threads = options.threads)
|
||||
self.printer.build_queue = None
|
||||
if "rospack" in self.build_list:
|
||||
self.printer.print_all( "Rosmake detected that rospack was requested to be cleaned. Cleaning it for it was skipped earlier.")
|
||||
self.print_all( "Rosmake detected that rospack was requested to be cleaned. Cleaning it for it was skipped earlier.")
|
||||
self.assert_prebuild_built(["tools/rospack"], 'clean')
|
||||
#subprocess.check_call(["make", "-C", os.path.join(os.environ["ROS_ROOT"], "tools/rospack"), "clean"])
|
||||
|
||||
|
@ -785,57 +717,43 @@ class RosMakeAll:
|
|||
else:
|
||||
self.assert_prebuild_built(["tools/rospack", "3rdparty/gtest", "core/genmsg_cpp"])
|
||||
|
||||
self.printer.print_verbose ("Building packages %s"% self.build_list)
|
||||
self.print_verbose ("Building packages %s"% self.build_list)
|
||||
build_queue = parallel_build.BuildQueue(self.build_list, self.dependency_tracker, robust_build = options.robust or options.best_effort)
|
||||
build_queue.register_prebuilt(["rospack", "gtest", "genmsg_cpp"])
|
||||
if None not in self.result.keys():
|
||||
self.result[None] = {}
|
||||
if 'rospack' in self.build_list:
|
||||
self.result[None]["rospack"] = True
|
||||
if 'gtest' in self.build_list:
|
||||
self.result[None]["gtest"] = True
|
||||
if 'genmsg_cpp' in self.build_list:
|
||||
self.result[None]["genmsg_cpp"] = True #don't over report results if not requested
|
||||
self.printer.build_queue = build_queue
|
||||
|
||||
build_passed = self.parallel_build_pkgs(build_queue, options.target, threads = options.threads)
|
||||
self.printer.build_queue = None
|
||||
if "rospack" in self.build_list and options.target == "clean":
|
||||
self.printer.print_all( "Rosmake detected that rospack was requested to be cleaned. Cleaning it, because it was skipped earlier.")
|
||||
self.print_all( "Rosmake detected that rospack was requested to be cleaned. Cleaning it, because it was skipped earlier.")
|
||||
self.assert_prebuild_built(["tools/rospack"], 'clean')
|
||||
if "gtest" in self.build_list and options.target == "clean":
|
||||
self.printer.print_all( "Rosmake detected that gtest was requested to be cleaned. Cleaning it, because it was skipped earlier.")
|
||||
self.print_all( "Rosmake detected that gtest was requested to be cleaned. Cleaning it, because it was skipped earlier.")
|
||||
self.assert_prebuild_built(["3rdparty/gtest"], 'clean')
|
||||
if "genmsg_cpp" in self.build_list and options.target == "clean":
|
||||
self.printer.print_all( "Rosmake detected that genmsg_cpp was requested to be cleaned. Cleaning it, because it was skipped earlier.")
|
||||
self.print_all( "Rosmake detected that genmsg_cpp was requested to be cleaned. Cleaning it, because it was skipped earlier.")
|
||||
self.assert_prebuild_built(["core/genmsg_cpp"], 'clean')
|
||||
|
||||
|
||||
tests_passed = True
|
||||
if build_passed and testing:
|
||||
self.printer.print_verbose ("Testing packages %s"% packages)
|
||||
self.print_verbose ("Testing packages %s"% packages)
|
||||
build_queue = parallel_build.BuildQueue(self.specified_packages, parallel_build.DependencyTracker(self.specified_packages), robust_build = True)
|
||||
self.printer.build_queue = build_queue
|
||||
tests_passed = self.parallel_build_pkgs(build_queue, "test", threads = 1)
|
||||
|
||||
self.printer.build_queue = None # no more status updates
|
||||
|
||||
if options.mark_installed:
|
||||
if build_passed and tests_passed:
|
||||
for p in self.specified_packages:
|
||||
if self.flag_tracker.add_nobuild(p):
|
||||
self.printer.print_all("Marking %s as installed with a ROS_NOBUILD file"%p)
|
||||
self.print_all("Marking %s as installed with a ROS_NOBUILD file"%p)
|
||||
else:
|
||||
self.printer.print_all("All builds and tests did not pass cannot mark packages as installed. ")
|
||||
self.print_all("All builds and tests did not pass cannot mark packages as installed. ")
|
||||
|
||||
|
||||
self.finish_time = time.time() #note: before profiling
|
||||
self.generate_summary_output(self.log_dir)
|
||||
|
||||
if options.print_profile:
|
||||
self.printer.print_all (self.get_profile_string())
|
||||
self.print_all (self.get_profile_string())
|
||||
|
||||
self.printer.running = False
|
||||
return build_passed and tests_passed
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue