Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding check to prevent tool cross talk #214

Merged
merged 4 commits into from
Dec 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions catkin_tools/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,6 @@ def summary(self, notes=[]):
if not self.source_space_exists():
summary_warnings += [clr(
"Source space `@{yf}{_Context__source_space_abs}@|` does not yet exist.")]
if self.corrupted_by_catkin_make():
summary_warnings += [clr(
"Build space `@{yf}{_Context__build_space_abs}@|` exists but "
"appears to have previously been created by the `catkin_make` "
"or `catkin_make_isolated` tool. Please choose a different "
"directory to use with `catkin_tools` or clean the build "
"space.")]

summary = [
[
Expand Down Expand Up @@ -680,9 +673,3 @@ def blacklist(self):
@blacklist.setter
def blacklist(self, value):
self.__blacklist = value

def corrupted_by_catkin_make(self):
for other_tool_name in ['catkin_make_isolated', 'catkin_make']:
if os.path.exists(os.path.join(self.build_space_abs, '%s.cache' % other_tool_name)):
return True
return False
11 changes: 1 addition & 10 deletions catkin_tools/verbs/catkin_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
from catkin_pkg.topological_order import topological_order_packages
except ImportError as e:
sys.exit(
'ImportError: "from catkin_pkg.topological_order import '
'topological_order" failed: %s\nMake sure that you have installed '
'Importing "catkin_pkg" failed: %s\nMake sure that you have installed '
'"catkin_pkg", and that it is up to date and on the PYTHONPATH.' % e
)

Expand Down Expand Up @@ -541,14 +540,6 @@ def build_isolated_workspace(
log("Creating build space directory, '{0}'".format(context.build_space_abs))
os.makedirs(context.build_space_abs)

# Check for catkin_make droppings
if context.corrupted_by_catkin_make():
sys.exit(
clr("@{rf}Error:@| Build space `{0}` exists but appears to have previously been "
"created by the `catkin_make` or `catkin_make_isolated` tool. "
"Please choose a different directory to use with `catkin build` "
"or clean the build space.").format(context.build_space_abs))

# Declare a buildspace marker describing the build config for error checking
buildspace_marker_data = {
'workspace': context.workspace,
Expand Down
50 changes: 44 additions & 6 deletions catkin_tools/verbs/catkin_build/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
from __future__ import print_function

import argparse
import os
import sys
import time

from catkin_pkg.package import InvalidPackage
from catkin_pkg.tool_detection import get_previous_tool_used_on_the_space
from catkin_pkg.tool_detection import mark_space_as_built_by

from catkin_tools.argument_parsing import add_context_args
from catkin_tools.argument_parsing import add_cmake_and_make_and_catkin_make_args
Expand Down Expand Up @@ -142,6 +143,8 @@ def prepare_arguments(parser):
help='Adds a build summary to the end of a build; defaults to on with --continue-on-failure, off otherwise')
add('--no-summarize', '--no-summary', action='store_false', dest='summarize',
help='explicitly disable the end of build summary')
add('--override-build-tool-check', action='store_true', default=False,
help='use to override failure due to using differnt build tools on the same workspace.')

# Deprecated args now handled by main catkin command
add('--no-color', action='store_true', help=argparse.SUPPRESS)
Expand Down Expand Up @@ -254,16 +257,51 @@ def main(opts):
(ctx.extend_path, exc.message)))
return 1

# Display list and leave the file system untouched
if opts.dry_run:
dry_run(ctx, opts.packages, opts.no_deps, opts.start_with)
return

# Check if the context is valid before writing any metadata
if not ctx.source_space_exists():
print("catkin build: error: Unable to find source space `%s`" % ctx.source_space_abs)
return 1

# ensure the build space was previously built by catkin_tools
previous_tool = get_previous_tool_used_on_the_space(ctx.build_space_abs)
if previous_tool is not None and previous_tool != 'catkin build':
if opts.override_build_tool_check:
log(clr(
"@{yf}Warning: build space at '%s' was previously built by '%s', "
"but --override-build-tool-check was passed so continuing anyways."
% (ctx.build_space_abs, previous_tool)))
else:
print(clr(
"@{rf}The build space at '%s' was previously built by '%s'. "
"Please remove the build space or pick a different build space."
% (ctx.build_space_abs, previous_tool)))
return 1
# the build space will be marked as catkin build's if dry run doesn't return

# ensure the devel space was previously built by catkin_tools
previous_tool = get_previous_tool_used_on_the_space(ctx.devel_space_abs)
if previous_tool is not None and previous_tool != 'catkin build':
if opts.override_build_tool_check:
log(clr(
"@{yf}Warning: devel space at '%s' was previously built by '%s', "
"but --override-build-tool-check was passed so continuing anyways."
% (ctx.devel_space_abs, previous_tool)))
else:
print(clr(
"@{rf}The devel space at '%s' was previously built by '%s'. "
"Please remove the devel space or pick a different devel space."
% (ctx.devel_space_abs, previous_tool)))
return 1
# the devel space will be marked as catkin build's if dry run doesn't return

# Display list and leave the file system untouched
if opts.dry_run:
dry_run(ctx, opts.packages, opts.no_deps, opts.start_with)
return
# Now mark the build and devel spaces as catkin build's since dry run didn't return.
mark_space_as_built_by(ctx.build_space_abs, 'catkin build')
mark_space_as_built_by(ctx.devel_space_abs, 'catkin build')

# Always save the last context under the build verb
update_metadata(ctx.workspace, ctx.profile, 'build', ctx.get_stored_dict())

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Setup installation dependencies
install_requires = [
'catkin-pkg >= 0.2.8',
'catkin-pkg > 0.2.9',
'setuptools',
'PyYAML',
]
Expand Down
4 changes: 2 additions & 2 deletions stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[DEFAULT]
Depends: python-argparse, python-setuptools, python-catkin-pkg (>= 0.2.8), python-yaml
Depends3: python3-setuptools, python3-catkin-pkg (>= 0.2.8), python3-yaml
Depends: python-argparse, python-setuptools, python-catkin-pkg (> 0.2.9), python-yaml
Depends3: python3-setuptools, python3-catkin-pkg (> 0.2.9), python3-yaml
Conflicts: python3-catkin-tools
Conflicts3: python-catkin-tools
Suite: oneiric precise quantal raring saucy trusty utopic vivid wheezy jessie
Expand Down