[yocto] [[meta-raspberrypi]][PATCH] bluepy: add it

Paul Barker pbarker at toganlabs.com
Thu Nov 30 09:11:43 PST 2017


On Tue, Nov 28, 2017 at 1:48 AM, Dengke Du <dengke.du at windriver.com> wrote:
> The bluepy can let us programming bluetooth le application in python.
>
> Signed-off-by: Dengke Du <dengke.du at windriver.com>
> ---
>  recipes-devtools/bluepy/bluepy_git.bb              | 48 ++++++++++++++++++++++
>  ...compiling-get-the-cross-compiler-from-env.patch | 28 +++++++++++++
>  2 files changed, 76 insertions(+)
>  create mode 100644 recipes-devtools/bluepy/bluepy_git.bb
>  create mode 100644 recipes-devtools/bluepy/files/0001-When-cross-compiling-get-the-cross-compiler-from-env.patch
>
> diff --git a/recipes-devtools/bluepy/bluepy_git.bb b/recipes-devtools/bluepy/bluepy_git.bb
> new file mode 100644
> index 0000000..3e2e7de
> --- /dev/null
> +++ b/recipes-devtools/bluepy/bluepy_git.bb
> @@ -0,0 +1,48 @@
> +SUMMARY = "Python module for interfacing with BLE devices through Bluez"
> +HOMEPAGE = "https://github.com/IanHarvey/bluepy"
> +# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
> +# your responsibility to verify that the values are complete and correct.
> +#
> +# The following license files were not able to be identified and are
> +# represented as "Unknown" below, you will need to check them yourself:
> +#   LICENSE.txt
> +#   bluez-5.29/COPYING.LIB
> +#
> +# NOTE: multiple licenses have been detected; they have been separated with &
> +# in the LICENSE value for now since it is a reasonable assumption that all
> +# of the licenses apply. If instead there is a choice between the multiple
> +# licenses then you should change the value to separate the licenses with |
> +# instead of &. If there is any doubt, check the accompanying documentation
> +# to determine which situation is applicable.
> +LICENSE = "Unknown & GPLv2"

You'll need to fix this as explained in the comment above (which the
recipe generator has added) and then drop the comment.

> +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=59e0d45ea684dda215889aa1b5acd001 \
> +                    file://bluez-5.29/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
> +                    file://bluez-5.29/COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09"
> +
> +SRC_URI = "git://github.com/IanHarvey/bluepy.git;protocol=https \
> +           file://0001-When-cross-compiling-get-the-cross-compiler-from-env.patch \
> +"
> +
> +# Modify these as desired

You can drop this comment.

> +PV = "1.1.2+git${SRCPV}"
> +SRCREV = "b1178fba2729692532e02d95e7368c742814f725"

Is there any reason for using this commit from git rather than the
latest version on pypi (https://pypi.python.org/pypi/bluepy)? You can
look at the recipe for rpi-gpio to see how to use the pypi bbclass to
simplify fetching from pypi.

> +
> +S = "${WORKDIR}/git"
> +
> +inherit setuptools
> +
> +DEPENDS += " glib-2.0"
> +
> +# WARNING: the following rdepends are determined through basic analysis of the
> +# python sources, and might not be 100% accurate.

You can drop this comment if you've checked the RDEPENDS.

> +RDEPENDS_${PN} += "python-argparse python-core python-io python-json python-subprocess"
> +
> +# WARNING: We were unable to map the following python package/module
> +# dependencies to the bitbake packages which include them:
> +#    bluepy
> +#    bluepy.btle
> +#    bs4
> +#    requests

You can drop this comment if you've reviewed those modules and ensured
that whatever provides them is in the dependencies.

> +
> +INHIBIT_PACKAGE_STRIP = "1"
> +INSANE_SKIP_${PN} += "ldflags"

It's probably worth adding a couple of comments to say why these 2
lines are needed.

> diff --git a/recipes-devtools/bluepy/files/0001-When-cross-compiling-get-the-cross-compiler-from-env.patch b/recipes-devtools/bluepy/files/0001-When-cross-compiling-get-the-cross-compiler-from-env.patch
> new file mode 100644
> index 0000000..8799058
> --- /dev/null
> +++ b/recipes-devtools/bluepy/files/0001-When-cross-compiling-get-the-cross-compiler-from-env.patch
> @@ -0,0 +1,28 @@
> +From abf880ff4c276134564e1f1e63a3b6699060da7f Mon Sep 17 00:00:00 2001
> +From: Dengke Du <dengke.du at windriver.com>
> +Date: Mon, 27 Nov 2017 03:48:16 -0500
> +Subject: [PATCH] When cross compiling, get the cross compiler from environment
> +
> +Signed-off-by: Dengke Du <dengke.du at windriver.com>

Please include an "Upstream-status" line as described in
https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations.

> +---
> + bluepy/Makefile | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/bluepy/Makefile b/bluepy/Makefile
> +index 76bafec..42f145b 100644
> +--- a/bluepy/Makefile
> ++++ b/bluepy/Makefile
> +@@ -9,8 +9,8 @@ BLUEZ_SRCS += src/shared/io-glib.c src/shared/timeout-glib.c
> + IMPORT_SRCS = $(addprefix $(BLUEZ_PATH)/, $(BLUEZ_SRCS))
> + LOCAL_SRCS  = bluepy-helper.c
> +
> +-CC = gcc
> +-CFLAGS = -Os -g -Wall # -Werror
> ++CC ?= gcc
> ++CFLAGS ?= -Os -g -Wall # -Werror
> +
> + CPPFLAGS = -DHAVE_CONFIG_H
> + ifneq ($(DEBUGGING),)
> +--
> +2.8.1
> +

You might not need this patch. You can pass extra arguments to make by
giving an EXTRA_OEMAKE value in the recipe - see the recipe for
wiringpi for an example of how this can be used. I can't exactly
remember the details of make assignment precedence so I'm not
guaranteeing that will work, if it does work it would be the preferred
approach though.

Once you've addressed these comments you'll need to submit this as a
pull request on github (https://github.com/agherzan/meta-raspberrypi).

Thanks,

-- 
Paul Barker
Togán Labs Ltd



More information about the yocto mailing list