-
-
Save kergoth/f434af71e9b8d442e0f0 to your computer and use it in GitHub Desktop.
Prototyped semi-automated handling of cases where we have a source recipe of something, but we can't legally distribute its sources, only its binaries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prototyping. The expectation is, in reality, one would probably inherit this | |
# globally and list the licenses they want to be affected by it. | |
LICENSES_BINARY_ONLY += "${LICENSE}" | |
inherit binary-only-licenses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LICENSES_BINARY_ONLY ?= "Freescale-EULA" | |
LICENSES_BINARY_ONLY[doc] = "List of licenses (including wildcards) where we can distribute binaries, but not sources" | |
LICENSES_BINARY_ONLY[type] = "list" | |
BBCLASSEXTEND += "source-to-binary" | |
def inherit_binary(d): | |
if d.getVar('BPN', True) != d.getVar('PN', True): | |
return | |
import oe.license | |
binary_only = oe.data.typed_value('LICENSES_BINARY_ONLY', d) | |
licenses = d.getVar('LICENSE', True) | |
for pkg in d.getVar('PACKAGES', True).split(): | |
licenses += d.getVar('LICENSE_%s' % pkg, True) or '' | |
try: | |
included, _ = oe.license.is_included(licenses, binary_only, None) | |
except oe.license.LicenseError as exc: | |
bb.fatal('%s: %s' % (d.getVar('PF', True), exc)) | |
if included: | |
return 'binary' | |
else: | |
return '' | |
INHERIT_BINARY ?= "${@inherit_binary(d)}" | |
inherit ${INHERIT_BINARY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SPECIAL_PKGSUFFIX += "-binary" | |
#PROVIDES += "${BPN}" | |
DEPENDS = "" | |
INHIBIT_DEFAULT_DEPS = "1" | |
INHIBIT_AUTOTOOLS_DEPS = "1" | |
WARN_QA_remove = "build-deps" | |
ERROR_QA_remove = "build-deps" | |
# Disable license checking, as these are pre-built binaries. This isn't ideal, | |
# since the license in the packages end up inaccurate, but it's needed for now. | |
LICENSE = "CLOSED" | |
LIC_FILES_CHKSUM = "" | |
SRC_URI_binary = "file://${DL_DIR}/${BP}-binary.tar.xz;subdir=${BP}" | |
do_configure[noexec] = "1" | |
do_compile[noexec] = "1" | |
B = "${S}" | |
do_install_binary () { | |
find . -print0 | cpio --null --owner=0:0 -pdu "${D}" | |
} | |
python () { | |
d.setVar('do_install', 'do_install_binary\n') | |
d.setVar('SRC_URI', '${SRC_URI_binary}\n') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: ship files from LIC_FILES_CHKSUM, but remove them from ${D} in the | |
# binary recipe. | |
SPECIAL_PKGSUFFIX += "-source-to-binary" | |
PROVIDES = "" | |
deltask do_populate_sysroot | |
deltask package | |
deltask packagedata | |
deltask package_qa | |
deltask package_write_ipk | |
deltask package_write_deb | |
deltask package_write_rpm | |
deltask package_write | |
do_packagedata[stamp-extra-info] = "" | |
do_populate_sysroot[stamp-extra-info] = "" | |
do_archive_binary_tarball () { | |
tar -cJf "${DL_DIR}/${BP}-binary.tar.xz" . | |
} | |
do_archive_binary_tarball[dirs] = "${D}" | |
do_archive_binary_tarball[nostamp] = "1" | |
addtask archive_binary_tarball after do_install before do_${BB_DEFAULT_TASK} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment