コード例 #1
0
ファイル: common.py プロジェクト: 130s/bloom
 def fn(config):
     global _patch_config_keys
     conf_path = 'patches.conf'
     if directory is not None:
         conf_path = os.path.join(directory, conf_path)
     config_keys = config.keys()
     config_keys.sort()
     if _patch_config_keys != config_keys:
         raise RuntimeError("Invalid config passed to set_patch_config")
     cmd = 'git config -f {0} patches.'.format(conf_path)
     try:
         for key in config:
             _cmd = cmd + key + ' "' + config[key] + '"'
             execute_command(_cmd, cwd=directory)
         # Stage the patches.conf file
         cmd = 'git add ' + conf_path
         execute_command(cmd, cwd=directory)
         if has_changes(directory):
             # Commit the changed config file
             cmd = 'git commit -m "Updated patches.conf"'
             execute_command(cmd, cwd=directory)
     except subprocess.CalledProcessError as err:
         print_exc(traceback.format_exc())
         error("Failed to set patches info: " + str(err))
         raise
コード例 #2
0
ファイル: common.py プロジェクト: nayomal/bloom
def update_rosdep():
    info("Running 'rosdep update'...")
    try:
        rosdep2.catkin_support.update_rosdep()
    except:
        print_exc(traceback.format_exc())
        error("Failed to update rosdep, did you run 'rosdep init' first?", exit=True)
コード例 #3
0
ファイル: common.py プロジェクト: vrabaud/bloom
 def fn(config):
     global _patch_config_keys
     conf_path = 'patches.conf'
     if directory is not None:
         conf_path = os.path.join(directory, conf_path)
     config_keys = list(config.keys())
     config_keys.sort()
     if _patch_config_keys != config_keys:
         raise RuntimeError("Invalid config passed to set_patch_config")
     cmd = 'git config -f {0} patches.'.format(conf_path)
     try:
         for key in config:
             _cmd = cmd + key + ' "' + config[key] + '"'
             execute_command(_cmd, cwd=directory)
         # Stage the patches.conf file
         cmd = 'git add ' + conf_path
         execute_command(cmd, cwd=directory)
         if has_changes(directory):
             # Commit the changed config file
             cmd = 'git commit -m "Updated patches.conf"'
             execute_command(cmd, cwd=directory)
     except subprocess.CalledProcessError as err:
         print_exc(traceback.format_exc())
         error("Failed to set patches info: " + str(err))
         raise
コード例 #4
0
def update_rosdep():
    info("Running 'rosdep update'...")
    try:
        rosdep2.catkin_support.update_rosdep()
    except:
        print_exc(traceback.format_exc())
        error("Failed to update rosdep, did you run 'rosdep init' first?",
              exit=True)
コード例 #5
0
ファイル: generator.py プロジェクト: isherman/bloom
 def update_rosdep(self):
     info("Running 'rosdep update'...")
     from rosdep2.catkin_support import update_rosdep
     try:
         update_rosdep()
     except:
         print_exc(traceback.format_exc())
         error("Failed to update rosdep, did you run "
               "'rosdep init' first?")
         return code.ROSDEP_FAILED
     self.has_run_rosdep = True
コード例 #6
0
ファイル: generate.py プロジェクト: hershwg/bloom
def try_execute(msg, err_msg, func, *args, **kwargs):
    try:
        retcode = func(*args, **kwargs)
        retcode = retcode if retcode is not None else 0
    except CalledProcessError as err:
        print_exc(traceback.format_exc())
        error("Error calling {0}: ".format(msg) + str(err))
        retcode = err.returncode
    ret_msg = msg + " returned exit code ({0})".format(str(retcode))
    if retcode > 0:
        error(ret_msg)
        raise CommandFailed(retcode)
    elif retcode < 0:
        debug(ret_msg)
コード例 #7
0
ファイル: generate.py プロジェクト: stonier/bloom
def try_execute(msg, err_msg, func, *args, **kwargs):
    retcode = 0
    try:
        retcode = func(*args, **kwargs)
        retcode = retcode if retcode is not None else 0
    except CalledProcessError as err:
        print_exc(traceback.format_exc())
        error("Error calling {0}: {1}".format(msg, str(err)))
        retcode = err.returncode
    ret_msg = msg + " returned exit code ({0})".format(str(retcode))
    if retcode > 0:
        error(ret_msg)
        raise CommandFailed(retcode)
    elif retcode < 0:
        debug(ret_msg)
    return retcode
コード例 #8
0
def get_upstream_meta(upstream_dir):
    meta = None
    # Check for stack.xml
    stack_path = os.path.join(upstream_dir, 'stack.xml')
    info("Checking for package.xml(s)")
    # Check for package.xml(s)
    try:
        from catkin_pkg.packages import find_packages
        from catkin_pkg.packages import verify_equal_package_versions
    except ImportError:
        error("catkin_pkg was not detected, please install it.",
              file=sys.stderr)
        sys.exit(1)
    packages = find_packages(basepath=upstream_dir)
    if packages == {}:
        if has_rospkg:
            info("package.xml(s) not found, looking for stack.xml")
            if os.path.exists(stack_path):
                info("stack.xml found")
                # Assumes you are at the top of the repo
                stack = rospkg.stack.parse_stack_file(stack_path)
                meta = {}
                meta['name'] = [stack.name]
                meta['version'] = stack.version
                meta['type'] = 'stack.xml'
            else:
                error("Neither stack.xml, nor package.xml(s) were detected.")
                sys.exit(1)
        else:
            error("Package.xml(s) were not detected.")
            sys.exit(1)
    else:
        info("package.xml(s) found")
        try:
            version = verify_equal_package_versions(packages.values())
        except RuntimeError as err:
            print_exc(traceback.format_exc())
            error("Releasing multiple packages with different versions is "
                  "not supported: " + str(err))
            sys.exit(1)
        meta = {}
        meta['version'] = version
        meta['name'] = [p.name for p in packages.values()]
        meta['type'] = 'package.xml'
    return meta
コード例 #9
0
ファイル: __init__.py プロジェクト: jbohren-forks/bloom
 def pre_branch(self, destination, source):
     # Run rosdep update is needed
     if not self.has_run_rosdep:
         info("Running 'rosdep update'...")
         from rosdep2.catkin_support import update_rosdep
         try:
             update_rosdep()
         except:
             print_exc(traceback.format_exc())
             error("Failed to update rosdep, did you run "
                   "'rosdep init' first?")
             return code.ROSDEP_FAILED
         self.has_run_rosdep = True
     # Determine the current package being generated
     name = destination.split('/')[-1]
     distro = destination.split('/')[-2]
     # Retrieve the stackage
     stackage, kind = self.packages[name]
     # Report on this package
     self.summarize_package(stackage, kind, distro)
コード例 #10
0
ファイル: patch_main.py プロジェクト: 130s/bloom
def main(sysargs=None):
    parser = get_argument_parser()
    add_global_arguments(parser)
    args = parser.parse_args(sysargs)
    handle_global_arguments(args)
    retcode = "command not run"
    if get_root() is None:
        parser.print_help()
        error("This command must be run in a valid git repository.", exit=True)
    ensure_git_root()
    try:
        retcode = args.func(args) or 0
    except CalledProcessError as err:
        # Problem calling out to git probably
        print_exc(traceback.format_exc())
        error(str(err))
        retcode = 2
    except Exception as err:
        # Unhandled exception, print traceback
        print_exc(traceback.format_exc())
        error(str(err))
        retcode = 3
    sys.exit(retcode)
コード例 #11
0
def main(sysargs=None):
    parser = get_argument_parser()
    add_global_arguments(parser)
    args = parser.parse_args(sysargs)
    handle_global_arguments(args)
    retcode = "command not run"
    if get_root() is None:
        parser.print_help()
        error("This command must be run in a valid git repository.", exit=True)
    ensure_git_root()
    try:
        retcode = args.func(args) or 0
    except CalledProcessError as err:
        # Problem calling out to git probably
        print_exc(traceback.format_exc())
        error(str(err))
        retcode = 2
    except Exception as err:
        # Unhandled exception, print traceback
        print_exc(traceback.format_exc())
        error(str(err))
        retcode = 3
    sys.exit(retcode)
コード例 #12
0
ファイル: patch_main.py プロジェクト: hershwg/bloom
def main():
    if len(sys.argv) > 1:
        command = sys.argv[1]
    else:
        error("You must specify a command, e.g. git-bloom-patch <command>")
        usage()
    if get_root() == None:

        error("This command must be run in a valid git repository.")
        usage()
    try:
        if command == "export":
            retcode = export_cmd.main()
        elif command == "import":
            retcode = import_cmd.main()
        elif command == "remove":
            retcode = remove_cmd.main()
        elif command == "rebase":
            retcode = rebase_cmd.main()
        elif command == "trim":
            retcode = trim_cmd.main()
        else:
            error("Invalid command specified: {0}".format(command))
            usage(False)
            retcode = 1
    except CalledProcessError as err:
        # Problem calling out to git probably
        print_exc(traceback.format_exc())
        error(str(err))
        retcode = 2
    except Exception as err:
        # Unhandled exception, print traceback
        print_exc(traceback.format_exc())
        error(str(err))
        retcode = 3
    sys.exit(retcode)