def trigger_if_necessary(da, pkg, rosdistro, jenkins_instance,
                         missing_by_arch):
    if da != 'source' and 'source' in missing_by_arch and \
            pkg in missing_by_arch['source']:
        print(
            "  Skipping trigger of binarydeb job for package '%s' on arch '%s' as the sourcedeb job will trigger them automatically"
            % (pkg, da))
        return False

    if da == 'source':
        job_name = '%s_sourcedeb' % (debianize_package_name(rosdistro, pkg))
    else:
        job_name = '%s_binarydeb_%s' % (debianize_package_name(rosdistro,
                                                               pkg), da)
    job_info = jenkins_instance.get_job_info(job_name)

    if 'color' in job_info and 'anime' in job_info['color']:
        print("  Skipping trigger of job %s because it's already running" %
              job_name)
        return False

    if 'inQueue' in job_info and job_info['inQueue']:
        print("  Skipping trigger of job '%s' because it's already queued" %
              job_name)
        return False

    if da != 'source' and 'upstreamProjects' in job_info:
        upstream = job_info['upstreamProjects']
        for p in missing_by_arch[da]:
            p_name = '%s_binarydeb_%s' % (debianize_package_name(rosdistro,
                                                                 p), da)
            for u in upstream:
                if u['name'] == p_name:
                    print(
                        "  Skipping trigger of job '%s' because the upstream job '%s' is also triggered"
                        % (job_name, p_name))
                    return False

    print("Triggering '%s'" % (job_name))
    #return jenkins_instance.build_job(job_name)
    # replicate internal implementation of Jenkins.build_job()
    import urllib2
    if not jenkins_instance.job_exists(job_name):
        raise jenkins.JenkinsException('no such job[%s]' % (job_name))
    # pass parameters to create a POST request instead of GET
    return jenkins_instance.jenkins_open(
        urllib2.Request(jenkins_instance.build_job_url(job_name), 'foo=bar'))
예제 #2
0
def trigger_if_necessary(da, pkg, rosdistro,
                         jenkins_instance, missing_by_arch):
    if da != 'source' and 'source' in missing_by_arch and \
            pkg in missing_by_arch['source']:
        print("  Skipping trigger of binarydeb job for package '%s' on arch '%s' as the sourcedeb job will trigger them automatically" % (pkg, da))
        return False

    if da == 'source':
        job_name = '%s_sourcedeb' % (debianize_package_name(rosdistro, pkg))
    else:
        job_name = '%s_binarydeb_%s' % (debianize_package_name(rosdistro, pkg),
                                        da)
    job_info = jenkins_instance.get_job_info(job_name)

    if 'color' in job_info and 'anime' in job_info['color']:
        print("  Skipping trigger of job %s because it's already running" % job_name)
        return False

    if 'inQueue' in job_info and job_info['inQueue']:
        print("  Skipping trigger of job '%s' because it's already queued" % job_name)
        return False

    if da != 'source' and 'upstreamProjects' in job_info:
        upstream = job_info['upstreamProjects']
        for p in missing_by_arch[da]:
            p_name = '%s_binarydeb_%s' % (debianize_package_name(rosdistro, p),
                                          da)
            for u in upstream:
                if u['name'] == p_name:
                    print("  Skipping trigger of job '%s' because the upstream job '%s' is also triggered" % (job_name, p_name))
                    return False

    print("Triggering '%s'" % (job_name))
    #return jenkins_instance.build_job(job_name)
    # replicate internal implementation of Jenkins.build_job()
    import urllib2
    if not jenkins_instance.job_exists(job_name):
        raise jenkins.JenkinsException('no such job[%s]' % (job_name))
    # pass parameters to create a POST request instead of GET
    return jenkins_instance.jenkins_open(urllib2.Request(jenkins_instance.build_job_url(job_name), 'foo=bar'))
예제 #3
0
 def __init__(self, name, rosdistro):
     self._name = name
     self.debian_name = debianize_package_name(rosdistro, name)
     self._versions = {}
예제 #4
0
def make_versions_table(rd_data, pkg_data,
                        da_strs, repo_names, rosdistro):
    '''
    Returns an in-memory table with all the information that will be displayed:
    ros package names and versions followed by debian versions for each
    distro/arch.
    '''
    left_columns = [('name', object), ('repo', object), ('version', object), ('wet', object)]
    right_columns = [(da_str, object) for da_str in da_strs]
    columns = left_columns + right_columns

    distro_pkg_names = [debianize_package_name(rosdistro, pkg.name) for pkg in rd_data.packages.values()]

    # prefixes of other ros distros
    prefixes = ['ros-electric-', 'ros-fuerte-', 'ros-unstable-']
    for distribution in rd_data.rosdistro_index.distributions:
        prefixes.append('ros-%s-' % distribution)
    rosdistro_prefix = 'ros-%s-' % rosdistro
    if rosdistro_prefix in prefixes:
        prefixes.remove(rosdistro_prefix)

    non_distro_pkg_names = []
    for pkg_name in pkg_data.get_packages():
        skip = False
        # skip packages from other ros distros
        for prefix in prefixes:
            if pkg_name.startswith(prefix):
                skip = True
        if skip:
            continue
        # skip packages which are in the rosdistro
        if pkg_name in distro_pkg_names:
            continue
        # skip packages without prefix of this ros distro
        if not pkg_name.startswith(rosdistro_prefix):
            continue
        non_distro_pkg_names.append(pkg_name)

    table = np.empty(len(rd_data.packages) + len(non_distro_pkg_names),
                     dtype=columns)

    # add all packages coming from the distro (wet, dry, variant)
    for i, pkg_vars in enumerate(rd_data.packages.values()):
        table['name'][i] = pkg_vars.name
        repo_name = ''
        try:
            repo_name = rd_data.rosdistro_dist.release_packages[pkg_vars.name].repository_name
        except KeyError:
            pass
        table['repo'][i] = repo_name
        table['version'][i] = pkg_vars.version
        table['wet'][i] = pkg_vars.type
        for da_str in da_strs:
            pkg_name = debianize_package_name(rosdistro, pkg_vars.name)
            versions = get_versions(pkg_data, pkg_name,
                                    repo_names, da_str)
            table[da_str][i] = add_version_cell(versions)

    i = len(rd_data.packages)
    for pkg_name in non_distro_pkg_names:
        #undebianized_pkg_name = undebianize_package_name(rosdistro, pkg_name)
        if pkg_name.startswith(rosdistro_prefix):
            pkg_name = pkg_name[len(rosdistro_prefix):]
        table['name'][i] = pkg_name
        table['repo'][i] = ''
        table['version'][i] = ''
        table['wet'][i] = 'unknown'
        all_versions = []
        for da_str in da_strs:
            versions = get_versions(pkg_data, pkg_name,
                                    repo_names, da_str)
            table[da_str][i] = add_version_cell(versions)
            all_versions.extend(versions)
        # if all version values are the same (or None) lets assume that is the expected version
        unique_versions = set([v for v in all_versions if v != 'None'])
        if len(unique_versions) == 1:
            table['version'][i] = unique_versions.pop()
        i += 1

    return table
예제 #5
0
def make_versions_table(rd_data, apt_data, da_strs, repo_names, rosdistro):
    '''
    Returns an in-memory table with all the information that will be displayed:
    ros package names and versions followed by debian versions for each
    distro/arch.
    '''
    left_columns = [('name', object), ('repo', object), ('version', object),
                    ('wet', object)]
    right_columns = [(da_str, object) for da_str in da_strs]
    columns = left_columns + right_columns

    distro_debian_names = [
        debianize_package_name(rosdistro, pkg.name)
        for pkg in rd_data.packages.values()
    ]

    # prefixes of other ros distros
    prefixes = ['ros-electric-', 'ros-fuerte-', 'ros-unstable-']
    for distribution in rd_data.rosdistro_index.distributions:
        prefixes.append('ros-%s-' % distribution)
    rosdistro_prefix = 'ros-%s-' % rosdistro
    if rosdistro_prefix in prefixes:
        prefixes.remove(rosdistro_prefix)

    non_distro_debian_names = []
    for debian_name in apt_data.debian_packages:
        skip = False
        # skip packages from other ros distros
        for prefix in prefixes:
            if debian_name.startswith(prefix):
                skip = True
        if skip:
            continue
        # skip packages which are in the rosdistro
        if debian_name in distro_debian_names:
            continue
        # skip packages without prefix of this ros distro
        if not debian_name.startswith(rosdistro_prefix):
            continue
        non_distro_debian_names.append(debian_name)

    table = np.empty(len(rd_data.packages) + len(non_distro_debian_names),
                     dtype=columns)

    # add all packages coming from the distro (wet, dry, variant)
    for i, pkg_data in enumerate(rd_data.packages.values()):
        table['name'][i] = pkg_data.name
        repo_name = ''
        try:
            repo_name = rd_data.rosdistro_dist.release_packages[
                pkg_data.name].repository_name
        except KeyError:
            pass
        table['repo'][i] = repo_name
        table['version'][i] = pkg_data.version
        table['wet'][i] = pkg_data.type
        for da_str in da_strs:
            debian_name = debianize_package_name(rosdistro, pkg_data.name)
            versions = get_versions(apt_data, debian_name, repo_names, da_str)
            table[da_str][i] = add_version_cell(versions)

    i = len(rd_data.packages)
    for debian_name in non_distro_debian_names:
        #undebianized_pkg_name = undebianize_package_name(rosdistro, pkg_name)
        pkg_name = debian_name
        if pkg_name.startswith(rosdistro_prefix):
            pkg_name = pkg_name[len(rosdistro_prefix):]
        table['name'][i] = pkg_name
        table['repo'][i] = ''
        table['version'][i] = ''
        table['wet'][i] = 'unknown'
        all_versions = []
        for da_str in da_strs:
            versions = get_versions(apt_data, debian_name, repo_names, da_str)
            table[da_str][i] = add_version_cell(versions)
            all_versions.extend(versions)
        # if all version values are the same (or None) lets assume that is the expected version
        unique_versions = set([v for v in all_versions if v != 'None'])
        if len(unique_versions) == 1:
            table['version'][i] = unique_versions.pop()
        i += 1

    return table
예제 #6
0
    if args.rosdistro == 'groovy':
        # even for wet_only the dry packages need to be consider, else they are not added as downstream dependencies for the wet jobs
        stack_depends, dry_maintainers = release_jobs.dry_get_stack_dependencies(args.rosdistro, workspace)
        dry_jobgraph = release_jobs.dry_generate_jobgraph(args.rosdistro, dependencies, stack_depends)
    else:
        stack_depends, dry_maintainers = {}, {}
        dry_jobgraph = {}

    combined_jobgraph = {}
    for k, v in dry_jobgraph.iteritems():
        combined_jobgraph[k] = v
    for k, v in dependencies.iteritems():
        combined_jobgraph[k] = v

    # setup a job triggered by all other debjobs
    combined_jobgraph[debianize_package_name(args.rosdistro, 'metapackages')] = combined_jobgraph.keys()
    combined_jobgraph[debianize_package_name(args.rosdistro, 'sync')] = [debianize_package_name(args.rosdistro, 'metapackages')]

    results_map = doit(
        rd,
        args.distros,
        args.arches,
        apt_target_repository,
        args.fqdn,
        combined_jobgraph,
        rosdistro=args.rosdistro,
        packages=packages,
        dry_maintainers=dry_maintainers,
        commit=args.commit,
        delete_extra_jobs=args.delete,
        whitelist_repos=args.repos,
예제 #7
0
        stack_depends, dry_maintainers = release_jobs.dry_get_stack_dependencies(
            args.rosdistro, workspace)
        dry_jobgraph = release_jobs.dry_generate_jobgraph(
            args.rosdistro, dependencies, stack_depends)
    else:
        stack_depends, dry_maintainers = {}, {}
        dry_jobgraph = {}

    combined_jobgraph = {}
    for k, v in dry_jobgraph.iteritems():
        combined_jobgraph[k] = v
    for k, v in dependencies.iteritems():
        combined_jobgraph[k] = v

    # setup a job triggered by all other debjobs
    combined_jobgraph[debianize_package_name(
        args.rosdistro, 'metapackages')] = combined_jobgraph.keys()
    combined_jobgraph[debianize_package_name(args.rosdistro, 'sync')] = [
        debianize_package_name(args.rosdistro, 'metapackages')
    ]

    results_map = doit(rd,
                       args.distros,
                       args.arches,
                       apt_target_repository,
                       args.fqdn,
                       combined_jobgraph,
                       rosdistro=args.rosdistro,
                       packages=packages,
                       dry_maintainers=dry_maintainers,
                       commit=args.commit,
                       delete_extra_jobs=args.delete,
예제 #8
0
def make_versions_table(rd_data, apt_data, da_strs, repo_names, rosdistro):
    """
    Returns an in-memory table with all the information that will be displayed:
    ros package names and versions followed by debian versions for each
    distro/arch.
    """
    left_columns = [("name", object), ("repo", object), ("version", object), ("wet", object)]
    right_columns = [(da_str, object) for da_str in da_strs]
    columns = left_columns + right_columns

    distro_debian_names = [debianize_package_name(rosdistro, pkg.name) for pkg in rd_data.packages.values()]

    # prefixes of other ros distros
    prefixes = ["ros-electric-", "ros-fuerte-", "ros-unstable-"]
    for distribution in rd_data.rosdistro_index.distributions:
        prefixes.append("ros-%s-" % distribution)
    rosdistro_prefix = "ros-%s-" % rosdistro
    if rosdistro_prefix in prefixes:
        prefixes.remove(rosdistro_prefix)

    non_distro_debian_names = []
    for debian_name in apt_data.debian_packages:
        skip = False
        # skip packages from other ros distros
        for prefix in prefixes:
            if debian_name.startswith(prefix):
                skip = True
        if skip:
            continue
        # skip packages which are in the rosdistro
        if debian_name in distro_debian_names:
            continue
        # skip packages without prefix of this ros distro
        if not debian_name.startswith(rosdistro_prefix):
            continue
        non_distro_debian_names.append(debian_name)

    table = np.empty(len(rd_data.packages) + len(non_distro_debian_names), dtype=columns)

    # add all packages coming from the distro (wet, dry, variant)
    for i, pkg_data in enumerate(rd_data.packages.values()):
        table["name"][i] = pkg_data.name
        repo_name = ""
        try:
            repo_name = rd_data.rosdistro_dist.release_packages[pkg_data.name].repository_name
        except KeyError:
            pass
        table["repo"][i] = repo_name
        table["version"][i] = pkg_data.version
        table["wet"][i] = pkg_data.type
        for da_str in da_strs:
            debian_name = debianize_package_name(rosdistro, pkg_data.name)
            versions = get_versions(apt_data, debian_name, repo_names, da_str)
            table[da_str][i] = add_version_cell(versions)

    i = len(rd_data.packages)
    for debian_name in non_distro_debian_names:
        # undebianized_pkg_name = undebianize_package_name(rosdistro, pkg_name)
        pkg_name = debian_name
        if pkg_name.startswith(rosdistro_prefix):
            pkg_name = pkg_name[len(rosdistro_prefix) :]
        table["name"][i] = pkg_name
        table["repo"][i] = ""
        table["version"][i] = ""
        table["wet"][i] = "unknown"
        all_versions = []
        for da_str in da_strs:
            versions = get_versions(apt_data, debian_name, repo_names, da_str)
            table[da_str][i] = add_version_cell(versions)
            all_versions.extend(versions)
        # if all version values are the same (or None) lets assume that is the expected version
        unique_versions = set([v for v in all_versions if v != "None"])
        if len(unique_versions) == 1:
            table["version"][i] = unique_versions.pop()
        i += 1

    return table