def build_debs(distro, stack_name, os_platform, arch, staging_dir, force, noupload, interactive):
    distro_name = distro.release_name

    if stack_name != "ALL" and stack_name not in distro.released_stacks:
        raise BuildFailure("stack [%s] not found in distro [%s]." % (stack_name, distro_name))

    # Create the environment where we build the debs, if necessary
    create_chroot(distro, distro_name, os_platform, arch)
    subprocess.check_call(["sudo", "apt-get", "install", "-y", "pkg-config"])

    # Load blacklisted information
    missing_primary, missing_dep, missing_excluded, missing_excluded_dep = list_missing.get_missing(
        distro, os_platform, arch
    )
    missing_ok = missing_excluded.union(missing_excluded_dep)

    # Find all the deps in the distro for this stack
    deps = compute_deps(distro, stack_name)
    # filter down to debs we expect to build
    deps = [(sn, sv) for (sn, sv) in deps if sn not in missing_ok]

    broken = set()
    skipped = set()

    keep_building = True
    while keep_building:
        printable_list = "\n".join(["%s" % str(x) for x in deps])
        debug(
            "looking for next stack to build. Current deps list is\n=======================\n%s\n==================="
            % (printable_list)
        )
        buildable = get_buildable(deps, distro_name, os_platform, arch, stack_name, force)
        if buildable is None:
            debug("Nothing left to build")
            keep_building = False
        else:
            debug("Attempting to build: %s" % (str(buildable)))
            deps.remove(buildable)
            sn, sv = buildable
            si = load_info(sn, sv)
            depends = set(si["depends"])
            if depends.isdisjoint(broken.union(skipped)):
                debug("Initiating build of: %s" % (str(buildable)))
                try:
                    do_deb_build(
                        distro_name, sn, sv, os_platform, arch, staging_dir, noupload, interactive and sn == stack_name
                    )
                except:
                    debug("Build of [%s] failed, adding to broken list" % (str(buildable)))
                    broken.add(sn)
            else:
                debug("Skipping %s (%s) since dependencies not built: %s" % (sn, sv, broken.union(skipped) & depends))
                skipped.add(sn)

    if broken.union(skipped):
        raise StackBuildFailure(
            "debbuild did not complete successfully. A list of broken and skipped stacks are below. Broken means the stack itself did not build. Skipped stacks means that the stack's dependencies could not be built.\n\nBroken stacks: %s.  Skipped stacks: %s"
            % (broken, skipped)
        )
def gen_metapkgs(distro, os_platform, arch, staging_dir, force=False):
    distro_name = distro.release_name

    # Retrieve the package list from the shadow repo
    packageurl=REPO_URL+"/dists/%(os_platform)s/main/binary-%(arch)s/Packages"%locals()
    packagetxt = urllib2.urlopen(packageurl).read()
    packagelist = parse_deb_packages(packagetxt)

    debs = []

    missing = []

    missing_primary, missing_dep, missing_excluded, missing_excluded_dep = list_missing.get_missing(distro, os_platform, arch)

    missing_ok = missing_excluded.union(missing_excluded_dep)

    
    # if (metapkg missing) or (metapkg missing deps), then create
    # modify create to version-lock deps

    wet_distro = rosdistro.Rosdistro(distro_name)


    # Build the new meta packages
    for (v,d) in distro.variants.iteritems():

        deb_name = "ros-%s-%s"%(distro_name, debianize_name(v))

        # If the metapkg is in the packagelist AND already has the right deps, we leave it:
        if deb_name in packagelist:
            list_deps = set([x.split()[0].strip() for x in packagelist[deb_name]['Depends'].split(',')])
            mp_deps = set(["ros-%s-%s"%(distro_name, debianize_name(x)) for x in set(d.stack_names) - missing_ok])
            if list_deps == mp_deps:
                debug("Metapackage %s already has correct deps"%deb_name)
                continue

        # Else, we create the new metapkg
        mp = create_meta_pkg(packagelist, distro, distro_name, v, set(d.stack_names) - missing_ok, os_platform, arch, staging_dir, wet_distro)
        if mp:
            debs.append(mp)
        else:
            missing.append(v)

    # We should always need to build the special "all" metapackage
    mp = create_meta_pkg(packagelist, distro, distro_name, "all", set(distro.released_stacks.keys()) - missing_ok, os_platform, arch, staging_dir, wet_distro)
    if mp:
        debs.append(mp)
    else:
        missing.append('all')

    upload_binary_debs(debs, distro_name, os_platform, arch)

    if missing:
        raise StackBuildFailure("Did not generate all metapkgs: %s."%missing)
Example #3
0
def gen_metapkgs(distro, os_platform, arch, staging_dir, force=False):
    distro_name = distro.release_name

    # Retrieve the package list from the shadow repo
    packageurl = "http://packages.ros.org/ros-shadow/ubuntu/dists/%(os_platform)s/main/binary-%(arch)s/Packages" % locals(
    )
    packagetxt = urllib2.urlopen(packageurl).read()
    packagelist = parse_deb_packages(packagetxt)

    debs = []

    missing = []

    missing_primary, missing_dep, missing_excluded, missing_excluded_dep = list_missing.get_missing(
        distro, os_platform, arch)

    missing_ok = missing_excluded.union(missing_excluded_dep)

    # if (metapkg missing) or (metapkg missing deps), then create
    # modify create to version-lock deps

    # Build the new meta packages
    for (v, d) in distro.variants.iteritems():

        deb_name = "ros-%s-%s" % (distro_name, debianize_name(v))

        # If the metapkg is in the packagelist AND already has the right deps, we leave it:
        if deb_name in packagelist:
            list_deps = set([
                x.split()[0].strip()
                for x in packagelist[deb_name]['Depends'].split(',')
            ])
            mp_deps = set([
                "ros-%s-%s" % (distro_name, debianize_name(x))
                for x in set(d.stack_names) - missing_ok
            ])
            if list_deps == mp_deps:
                debug("Metapackage %s already has correct deps" % deb_name)
                continue

        # Else, we create the new metapkg
        mp = create_meta_pkg(packagelist, distro, distro_name, v,
                             set(d.stack_names) - missing_ok, os_platform,
                             arch, staging_dir)
        if mp:
            debs.append(mp)
        else:
            missing.append(v)

    # We should always need to build the special "all" metapackage
    mp = create_meta_pkg(packagelist, distro, distro_name, "all",
                         set(distro.released_stacks.keys()) - missing_ok,
                         os_platform, arch, staging_dir)
    if mp:
        debs.append(mp)
    else:
        missing.append('all')

    upload_debs(debs, distro_name, os_platform, arch)

    if missing:
        raise StackBuildFailure("Did not generate all metapkgs: %s." % missing)
Example #4
0
def build_debs(distro, stack_name, os_platform, arch, staging_dir, force,
               noupload, interactive):
    distro_name = distro.release_name

    if stack_name != 'ALL' and stack_name not in distro.released_stacks:
        raise BuildFailure("stack [%s] not found in distro [%s]." %
                           (stack_name, distro_name))

    # Create the environment where we build the debs, if necessary
    create_chroot(distro, distro_name, os_platform, arch)
    subprocess.check_call(['sudo', 'apt-get', 'install', '-y', 'pkg-config'])

    # Load blacklisted information
    missing_primary, missing_dep, missing_excluded, missing_excluded_dep = list_missing.get_missing(
        distro, os_platform, arch)
    missing_ok = missing_excluded.union(missing_excluded_dep)

    # Find all the deps in the distro for this stack
    deps = compute_deps(distro, stack_name)
    # filter down to debs we expect to build
    deps = [(sn, sv) for (sn, sv) in deps if sn not in missing_ok]

    broken = set()
    skipped = set()

    keep_building = True
    while keep_building:
        printable_list = '\n'.join(["%s" % str(x) for x in deps])
        debug(
            "looking for next stack to build. Current deps list is\n=======================\n%s\n==================="
            % (printable_list))
        buildable = get_buildable(deps, distro_name, os_platform, arch,
                                  stack_name, force)
        if buildable is None:
            debug("Nothing left to build")
            keep_building = False
        else:
            debug("Attempting to build: %s" % (str(buildable)))
            deps.remove(buildable)
            sn, sv = buildable
            si = load_info(sn, sv)
            depends = set(si['depends'])
            if depends.isdisjoint(broken.union(skipped)):
                debug("Initiating build of: %s" % (str(buildable)))
                try:
                    do_deb_build(distro_name, sn, sv, os_platform, arch,
                                 staging_dir, noupload, interactive
                                 and sn == stack_name)
                except:
                    debug("Build of [%s] failed, adding to broken list" %
                          (str(buildable)))
                    broken.add(sn)
            else:
                debug("Skipping %s (%s) since dependencies not built: %s" %
                      (sn, sv, broken.union(skipped) & depends))
                skipped.add(sn)

    if broken.union(skipped):
        raise StackBuildFailure(
            "debbuild did not complete successfully. A list of broken and skipped stacks are below. Broken means the stack itself did not build. Skipped stacks means that the stack's dependencies could not be built.\n\nBroken stacks: %s.  Skipped stacks: %s"
            % (broken, skipped))