Skip to content

Add support for bitbake recipes #1243 #3092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

pombredanne
Copy link
Member

This PR adds basic support bitbake recipes treated as package data.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁

Sorry, something went wrong.

@pombredanne
Copy link
Member Author

@chinyeungli @priv-kweihmann you review is welcomed!
@priv-kweihmann I would like to know in particular if I am using oelint-parser correctly in https://github.com/nexB/scancode-toolkit/pull/3092/files#diff-af7c94424fa6a057497534cd0f8f26d906dfb225318819c29c919c8905493dc2R37

requirements.txt Outdated
@@ -39,6 +39,7 @@ lxml==4.9.1
MarkupSafe==2.1.1
more-itertools==8.13.0
normality==2.3.3
oelint_parser==2.6.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think current version is 2.8.0 - so this might need an update


# add any bitbake like-file
# TODO: may be we should handle the bbclass and bbappend here?
oestash.AddFile(location)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bbclass files are handled automatically (if being within the same layer) - but yeah, bbappends have to be added manually

version = data.get('PV')
description = data.get('DESCRIPTION')
homepage_url = data.get('HOMEPAGE')
download_url = data.get('PREMIRRORS')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why premirrors? Normally one would take this kind of information from SRC_URI

# Therefore, I cannot differentiate md5, sha1, or src file location reference
# See: https://github.com/priv-kweihmann/oelint-parser/issues/3
sha1 = data.get('SRC_URI[sha1sum]')
md5 = data.get('SRC_URI[md5sum]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md5sum is pretty outdated a while now - people have been encouraged to drop the support for md5 for years now - sha256 on the other hand is mandatory for most of the file based downloads, so this one should be used


# Build deps: this is a list of plain BB recipes names
# https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-ref-variables.html#term-DEPENDS
build_deps = data.get('DEPENDS', '').split()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEPENDS just refers to buildtime dependencies - I think what you really want is a mix of RDEPENDS:* and DEPENDS - while RDEPENDS (the packages needed at runtime are more of importance) - sometimes DEPENDS contains elements that will be only used at buildtime and leave no trace within the shipped binaries, so from a license point of view they can be safely ignored

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would say that license wise DEPENDS doesn't play any role and should not be considered

SRC_URI = "file://init-install-testfs.sh"
DEPENDS = "do_this and that"

RDEPENDS_${PN} = "grub (== 12.23) parted e2fsprogs-mke2fs"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test should use a recipe that is a bit more complex than this one here - for me https://git.yoctoproject.org/poky/plain/meta/recipes-graphics/cairo/cairo_1.16.0.bb was always a good example

description = data.get('DESCRIPTION')
homepage_url = data.get('HOMEPAGE')
download_url = data.get('PREMIRRORS')
declared_license = data.get('LICENSE')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep in mind that LICENSE settings can also be package specific (fine example can be found here https://git.yoctoproject.org/poky/plain/meta/recipes-graphics/cairo/cairo_1.16.0.bb) - so it would be better to iterate over all variable items of LICENSE and then pick the best matching, where plain LICENSE should always be the fall back

@pombredanne pombredanne added this to the v32.1 milestone Jan 6, 2023
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@jloehel
Copy link

jloehel commented Apr 23, 2025

@pombredanne I am a bit curious how would you handle the empty SRC_URI [1] for the gcc builds? There are also a couple of recipes which have just "local" files and no upstream download URL or where the a couple of files get constructed on the fly. Like mender-artifact-info.bb. I would extract also the download_url from the SRC_URI. The SRC_URI array should include also the patches. In case of git download URLs the SRCREV is also helpful.

I made the experience that some older recipes SRC_URIs are broken. In example for mesa 22.0.3 (https://mesa.freedesktop.org/archive/mesa-22.0.3.tar.xz The redirect to https://archive.mesa3d.org/older-versions/ is not working correctly) and chrony 4.2 (https://download.tuxfamily.org/chrony/chrony-4.2.tar.gz tuxfamily does not work anymore). How will you handle broken download_urls?

It would be nice to extract also LIC_FILES_CHKSUM? Sometimes it includes also license snippets with bline and eline.

[1] openembedded/openembedded-core@0df9d45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants