def configure_doc_jobs(<EOL>config_url, rosdistro_name, doc_build_name, groovy_script=None,<EOL>dry_run=False, whitelist_repository_names=None):
config = get_config_index(config_url)<EOL>build_files = get_doc_build_files(config, rosdistro_name)<EOL>build_file = build_files[doc_build_name]<EOL>index = get_index(config.rosdistro_index_url)<EOL>dist_cache = None<EOL>if build_file.notify_maintainers:<EOL><INDENT>dist_cache = get_distribution_cache(index, rosdistro_name)<EOL><DEDENT>targets = []<EOL>for os_name in build_file.targets.keys():<EOL><INDENT>for os_code_name in build_file.targets[os_name].keys():<EOL><INDENT>for arch in build_file.targets[os_name][os_code_name]:<EOL><INDENT>targets.append((os_name, os_code_name, arch))<EOL><DEDENT><DEDENT><DEDENT>print('<STR_LIT>')<EOL>for os_name, os_code_name, arch in targets:<EOL><INDENT>print('<STR_LIT>', os_name, os_code_name, arch)<EOL><DEDENT>dist_file = get_distribution_file(index, rosdistro_name, build_file)<EOL>if not dist_file:<EOL><INDENT>print('<STR_LIT>')<EOL>return<EOL><DEDENT>doc_view_name = get_doc_view_name(rosdistro_name, doc_build_name)<EOL>from ros_buildfarm.jenkins import connect<EOL>jenkins = connect(config.jenkins_url) if groovy_script is None else False<EOL>view_configs = {}<EOL>views = {}<EOL>views[doc_view_name] = configure_doc_view(<EOL>jenkins, doc_view_name, dry_run=dry_run)<EOL>if not jenkins:<EOL><INDENT>view_configs.update(views)<EOL><DEDENT>groovy_data = {<EOL>'<STR_LIT>': dry_run,<EOL>'<STR_LIT>': len(view_configs),<EOL>}<EOL>repo_names = dist_file.repositories.keys()<EOL>filtered_repo_names = build_file.filter_repositories(repo_names)<EOL>job_names = []<EOL>job_configs = OrderedDict()<EOL>for repo_name in sorted(repo_names):<EOL><INDENT>if whitelist_repository_names:<EOL><INDENT>if repo_name not in whitelist_repository_names:<EOL><INDENT>print(<EOL>"<STR_LIT>" %<EOL>repo_name, file=sys.stderr)<EOL>continue<EOL><DEDENT><DEDENT>is_disabled = repo_name not in filtered_repo_names<EOL>if is_disabled and build_file.skip_ignored_repositories:<EOL><INDENT>print("<STR_LIT>" % repo_name,<EOL>file=sys.stderr)<EOL>continue<EOL><DEDENT>repo = dist_file.repositories[repo_name]<EOL>if not repo.doc_repository:<EOL><INDENT>print("<STR_LIT>" % repo_name)<EOL>continue<EOL><DEDENT>if not repo.doc_repository.version:<EOL><INDENT>print("<STR_LIT>" % repo_name)<EOL>continue<EOL><DEDENT>for os_name, os_code_name, arch in targets:<EOL><INDENT>try:<EOL><INDENT>job_name, job_config = configure_doc_job(<EOL>config_url, rosdistro_name, doc_build_name,<EOL>repo_name, os_name, os_code_name, arch,<EOL>config=config, build_file=build_file,<EOL>index=index, dist_file=dist_file,<EOL>dist_cache=dist_cache, jenkins=jenkins, views=views,<EOL>is_disabled=is_disabled,<EOL>groovy_script=groovy_script,<EOL>dry_run=dry_run)<EOL>job_names.append(job_name)<EOL>if groovy_script is not None:<EOL><INDENT>print("<STR_LIT>" % job_name)<EOL>job_configs[job_name] = job_config<EOL><DEDENT><DEDENT>except JobValidationError as e:<EOL><INDENT>print(e.message, file=sys.stderr)<EOL><DEDENT><DEDENT><DEDENT>groovy_data['<STR_LIT>'] = len(job_configs)<EOL>groovy_data['<STR_LIT>'] = {}<EOL>job_prefix = '<STR_LIT>' % doc_view_name<EOL>if not whitelist_repository_names:<EOL><INDENT>groovy_data['<STR_LIT>']['<STR_LIT>'] = (job_prefix, job_names)<EOL>if groovy_script is None:<EOL><INDENT>from ros_buildfarm.jenkins import remove_jobs<EOL>print('<STR_LIT>')<EOL>remove_jobs(jenkins, job_prefix, job_names, dry_run=dry_run)<EOL><DEDENT><DEDENT>if groovy_script is not None:<EOL><INDENT>print(<EOL>"<STR_LIT>" %<EOL>(groovy_script, len(view_configs), len(job_configs)))<EOL>content = expand_template(<EOL>'<STR_LIT>', groovy_data)<EOL>write_groovy_script_and_configs(<EOL>groovy_script, content, job_configs, view_configs=view_configs)<EOL><DEDENT>
Configure all Jenkins doc jobs.

L{configure_doc_job} will be invoked for doc repository and target
which matches the build file criteria.