Esempio n. 1
0
def get_recipe_info(tinfoil, rn):
    try:
        info = tinfoil.get_recipe_info(rn)
    except Exception:
        print('Failed to get recipe info for: %s' % rn)
        return []
    if not info:
        print('No recipe info found for: %s' % rn)
        return []
    append_files = tinfoil.get_file_appends(info.fn)
    appends = True
    data = tinfoil.parse_recipe_file(info.fn, appends, append_files)
    data.pn = info.pn
    data.pv = info.pv
    return data
Esempio n. 2
0
def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True):
    """Parse the specified recipe"""
    try:
        recipefile = tinfoil.get_recipe_file(pn)
    except bb.providers.NoProvider as e:
        logger.error(str(e))
        return None
    if appends:
        append_files = tinfoil.get_file_appends(recipefile)
        if filter_workspace:
            # Filter out appends from the workspace
            append_files = [path for path in append_files if
                            not path.startswith(config.workspace_path)]
    else:
        append_files = None
    return tinfoil.parse_recipe_file(recipefile, appends, append_files)
Esempio n. 3
0
def print_deps(tinfoil, abcd_file, rn):
    try:
        info = tinfoil.get_recipe_info(rn)
    except Exception:
        print('Failed to get recipe info for: %s' % rn)
        return []
    if not info:
        print('No recipe info found for: %s' % rn)
        return []
    append_files = tinfoil.get_file_appends(info.fn)
    appends = True
    data = tinfoil.parse_recipe_file(info.fn, appends, append_files)
    src_uri = data.getVar('SRC_URI').split()
    lic = data.getVar('LICENSE')
    summary = data.getVar('SUMMARY')
    description = data.getVar('DESCRIPTION')
    homepage = data.getVar('HOMEPAGE')
    srcrev = data.getVar('SRCREV')
    branch = data.getVar('BRANCH')
    depends = data.getVar('DEPENDS').split()

    abcd_file.write('- id:\n')
    abcd_file.write('    package_manager: "Yocto"\n')
    abcd_file.write('    name: "%s"\n' % info.pn)
    abcd_file.write('    version: "%s"\n' % info.pv)
    abcd_file.write('  declared_lics:\n')
    abcd_file.write('  - "%s"\n' % lic)
    if summary:
        abcd_file.write('  description: "%s"\n' % summary)
    else:
        abcd_file.write('  description: "%s"\n' % description)
    abcd_file.write('  homepage_url: "%s"\n' % homepage)
    abcd_file.write('  source_artifact:\n')
    repos = []
    for src in src_uri:
        # Strip options.
        # TODO: ignore files with apply=false?
        src = src.split(';', maxsplit=1)[0]
        src_type = src.split('://', maxsplit=1)[0]
        if src_type == 'file':
            # TODO: Get full path of patches and other files within the source
            # repo, not just the filesystem?
            fetch = bb.fetch2.Fetch([], data)
            local = fetch.localpath(src)
            abcd_file.write('  - "%s"\n' % local)
        else:
            abcd_file.write('  - "%s"\n' % src)
            if src_type != 'http' and src_type != 'https' and src_type != 'ftp' and src_type != 'ssh':
                repos.append(src)
    if len(repos) > 1:
        print('Multiple repos not fully supported yet. Pacakge: %s' % info.pn)
    for repo in repos:
        vcs_type, url = repo.split('://', maxsplit=1)
        abcd_file.write('  vcs:\n')
        if vcs_type == 'gitsm':
            vcs_type = 'git'
        abcd_file.write('    type: "%s"\n' % vcs_type)
        abcd_file.write('    url: "%s"\n' % url)
        # TODO: Actually support multiple repos here:
        abcd_file.write('    revision: "%s"\n' % srcrev)
        abcd_file.write('    branch: "%s"\n' % branch)

    abcd_file.write('  dependencies:\n')
    for dep in depends:
        abcd_file.write('  - "%s"\n' % dep)
        # TODO: search for transitive dependencies here? Each dependency will
        # get checked for its own dependencies sooner or later.

    return depends