Bug 1762673

Summary: Review Request: python-bluepy - Python interface to Bluetooth LE
Product: [Fedora] Fedora Reporter: Alessio <alciregi>
Component: Package ReviewAssignee: Robert-André Mauchin 🐧 <zebob.m>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: brian, mail, package-review, zebob.m
Target Milestone: ---Flags: zebob.m: fedora-review+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-21 00:56:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alessio 2019-10-17 08:34:40 UTC
Spec URL: https://alciregi.fedorapeople.org/bluepy/python-bluepy.spec
SRPM URL: https://alciregi.fedorapeople.org/bluepy/python-bluepy-1.3.0-1.fc31.src.rpm
Description: Python interface to Bluetooth LE on Linux. This is a project to provide an API to allow access to Bluetooth Low Energy devices from Python.
Fedora Account System Username: alciregi

Successful koji build: https://koji.fedoraproject.org/koji/taskinfo?taskID=38341562

Comment 1 Brian J. Murrell 2019-10-26 18:01:15 UTC
How do we progress this?

Comment 2 Alessio 2019-10-28 09:08:13 UTC
(In reply to Brian J. Murrell from comment #1)
> How do we progress this?

Hello.
In what sense?

Comment 3 Brian J. Murrell 2019-10-28 12:34:03 UTC
(In reply to Alessio from comment #2)
> In what sense?

I assume you didn't open this ticket just to have a koji build done, yes?  I assume there is some goal beyond that or this ticket could be closed as RESOLVED, right?

I would assume that the goal here is to get this package into a Fedora distribution and then later, perhaps EL7 or EPEL7.

Comment 4 Alessio 2019-10-28 12:58:02 UTC
(In reply to Brian J. Murrell from comment #3)
> (In reply to Alessio from comment #2)

> I would assume that the goal here is to get this package into a Fedora
> distribution and then later, perhaps EL7 or EPEL7.

Oh well, the package need someone that review it, right?

Comment 5 Brian J. Murrell 2019-10-28 15:56:43 UTC
That seems reasonable.

I have not gone through this package submission process myself.  Do you know how this gets progressed to being reviewed?  I guess it's only 11 days old.  Maybe patience still at this point.  :-/

Comment 6 Alessio 2019-10-28 16:17:43 UTC
(In reply to Brian J. Murrell from comment #5)
> That seems reasonable.
> 
> I have not gone through this package submission process myself.  Do you know
> how this gets progressed to being reviewed?  I guess it's only 11 days old. 
> Maybe patience still at this point.  :-/

Well, I'm waiting for someone willing to review it. Personally, I'm not in a hurry :-)

Comment 7 Fabian Affolter 2019-10-30 19:13:29 UTC
Just some quick comments:

- URL:            https://github.com/IanHarvey/%{modname}

  -> I (and probably many other) prefer if the link can be copied and pasted. 

- Source0:        https://github.com/IanHarvey/%{modname}/archive/v/%{version}.tar.gz

  -> Source0:        https://github.com/IanHarvey/bluepy/archive/v/%{version}/%{modname}-%{version}.tar.gz

- %{?python_enable_dependency_generator}

  -> can be removed (default for new Fedora releases) https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_automatically_generated_dependencies

- %doc docs/_build/html

  -> Putting the docs into a subpackage will keep the main package small.

The main issue seems that the build is done with a bundled release of bluez (bluez-5.47). Fedora already ships bluez, thus that code should be used.

Comment 8 Alessio 2019-10-31 08:42:37 UTC
(In reply to Fabian Affolter from comment #7)

> The main issue seems that the build is done with a bundled release of bluez
> (bluez-5.47). Fedora already ships bluez, thus that code should be used.

So it is a big effort. I mean, as far as I can see and understand, there will be to create a patch to Makefile and .c files in order to get rid of the bundled bluez stuff.

Comment 9 Fabian Affolter 2019-10-31 11:05:36 UTC
The packaging guidelines (https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling) contains additional information about the bundling.

In an ideal world upstream would allow to use a different bluez. Often it's enough to patch the Makefiles but that depends.

Comment 10 Alessio 2019-10-31 16:04:42 UTC
I contacted upstream, but probably I'm unable to explain where is the problem.
https://github.com/IanHarvey/bluepy/issues/383

However, as far as I can understand, the bundled bluez stuff is only sed to include some C file during compilation.
The fact that I'm not a C developer, stop me to going further.

Comment 11 Alessio 2019-11-06 10:56:09 UTC
Did you read the upstream's answer? What do you think?

"bluepy uses a copy of some source files from the BlueZ project to build a C language executable, bluepy-helper, which is a shim between Python and the kernel's Bluetooth interface. It does not build or install any binaries which are the same as what the BlueZ package provides - so at no point would you have a "bluepy" and a "system" version of the same thing on your disk."

Comment 12 Brian J. Murrell 2019-11-06 14:42:43 UTC
I guess the question is why bluepy needs to use source files and cannot use the bluez-libs-devel RPM.

Or maybe it can, and the RPM build just needs to do that.

Comment 13 Fabian Affolter 2019-11-06 14:59:01 UTC
The Makefile contains BLUEZ_PATH=./bluez-5.47. Perhaps it's as simple as pointing to the location of the content of bluez devel files on the disk.

Comment 14 Alessio 2019-11-06 15:50:29 UTC
(In reply to Fabian Affolter from comment #13)
> The Makefile contains BLUEZ_PATH=./bluez-5.47. Perhaps it's as simple as
> pointing to the location of the content of bluez devel files on the disk.

But looking at the Makefile, it uses also .c files, not only of the headers provided by bluez-libs-devel RPM

BLUEZ_SRCS  = lib/bluetooth.c lib/hci.c lib/sdp.c lib/uuid.c

Isn't it?

Comment 15 Robert-André Mauchin 🐧 2019-12-08 20:26:06 UTC
 IanHarvey commented on Nov 2

bluepy uses a copy of some source files from the BlueZ project to build a C language executable, bluepy-helper, which is a shim between Python and the kernel's Bluetooth interface. It does not build or install any binaries which are the same as what the BlueZ package provides - so at no point would you have a "bluepy" and a "system" version of the same thing on your disk.

Note that there isn't a realistic way to "use the system's BlueZ" - BlueZ itself provides various command line executables and daemons, but there isn't a library or low-level interface suitable for calling from Python. (I looked at the D-Bus interface but at the time it was very incomplete, and its availability is likely to vary a lot between distributions).


Take a look at https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/python-bluepy too, you probably will need to do the same edits on the makefile to use Fedora default build flags by setting %set_build_flags before building.

Comment 16 Alessio 2019-12-09 16:05:29 UTC
So, here you can find the new spec file and the SRPM:
 
Spec URL: https://alciregi.fedorapeople.org/bluepy/python-bluepy.spec
SRPM URL: https://alciregi.fedorapeople.org/bluepy/python-bluepy-1.3.0-1.fc31.src.rpm

Comment 17 Robert-André Mauchin 🐧 2019-12-09 19:19:59 UTC
 - Explain the license breakdown in a comment:

License:        Public Domain and GPLv2

 - Use a better name for your archive:

Source0:        https://github.com/IanHarvey/bluepy/archive/v%{version}/bluepy-%{version}.tar.gz

 - Not needed:

%defattr (-,root,root)

 - Own this directory by removing the glob:

%{python3_sitelib}/bluepy/* → %{python3_sitelib}/bluepy/

 - This should go before %py3_build:

sed 's|CFLAGS =|CFLAGS +=|g' -i bluepy/Makefile
sed 's|CPPFLAGS =|CPPFLAGS +=|g' -i bluepy/Makefile
sed 's| $(LDLIBS)| $(LDFLAGS) $(LDLIBS)|g' -i bluepy/Makefile
%py3_build

 %py3_build is what build the binaries. See log:

+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
running build
running build_py
Working dir is /builddir/build/BUILD/bluepy-v-1.3.0
execute make -C ./bluepy clean
execute make -C bluepy -j1


Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed


===== MUST items =====

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[x]: If your application is a C or C++ application you must list a
     BuildRequires against gcc, gcc-c++ or clang.
[x]: Header files in -devel subpackage, if present.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "*No copyright* Public domain", "Unknown or generated", "GPL
     (v2 or later)", "GPL (v2)", "GNU Lesser General Public License (v2.1
     or later)", "BSD 2-clause "Simplified" License". 33 files have unknown
     license. Detailed output of licensecheck in
     /home/bob/packaging/review/python-bluepy/review-python-
     bluepy/licensecheck.txt
[x]: License file installed when any subpackage combination is installed.
[!]: If the package is under multiple licenses, the licensing breakdown
     must be documented in the spec.
[!]: Package requires other packages for directories it uses.
     Note: No known owner of /usr/lib/python3.8/site-packages/bluepy
[!]: %build honors applicable compiler flags or justifies otherwise.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Useful -debuginfo package or justification otherwise.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 10240 bytes in 2 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build
     process.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

Generic:
[-]: Uses parallel make %{?_smp_mflags} macro.
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[-]: Fully versioned dependency in subpackages if applicable.
     Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in
     python3-bluepy
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[-]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Large data in /usr/share should live in a noarch subpackage if package
     is arched.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: python3-bluepy-1.3.0-1.fc32.x86_64.rpm
          python-bluepy-doc-1.3.0-1.fc32.x86_64.rpm
          python-bluepy-debugsource-1.3.0-1.fc32.x86_64.rpm
          python-bluepy-1.3.0-1.fc32.src.rpm
python3-bluepy.x86_64: W: no-manual-page-for-binary blescan
python3-bluepy.x86_64: W: no-manual-page-for-binary sensortag
python3-bluepy.x86_64: W: no-manual-page-for-binary thingy52
4 packages and 0 specfiles checked; 0 errors, 3 warnings.

Comment 18 Alessio 2019-12-09 21:21:21 UTC
This doesn seem to work:

> Source0:       
> https://github.com/IanHarvey/bluepy/archive/v%{version}/bluepy-%{version}.
> tar.gz

Is this ok? 
Source0: https://github.com/IanHarvey/bluepy/archive/v/%{version}.tar.gz

Comment 19 Robert-André Mauchin 🐧 2019-12-10 16:10:04 UTC
 Sorry this one:

Source0:        https://github.com/IanHarvey/bluepy/archive/v/%{version}/bluepy-%{version}.tar.gz

Comment 21 Robert-André Mauchin 🐧 2019-12-11 14:56:16 UTC
Package approved.

Comment 22 Gwyn Ciesla 2019-12-11 16:17:28 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/python-bluepy

Comment 23 Fedora Update System 2019-12-12 08:26:22 UTC
FEDORA-2019-9c630b2766 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-9c630b2766

Comment 24 Fedora Update System 2019-12-12 08:26:56 UTC
FEDORA-2019-0b98ef4c78 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-0b98ef4c78

Comment 25 Fedora Update System 2019-12-13 01:48:42 UTC
python-bluepy-1.3.0-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-0b98ef4c78

Comment 26 Fedora Update System 2019-12-13 02:56:08 UTC
python-bluepy-1.3.0-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-9c630b2766

Comment 27 Fedora Update System 2019-12-21 00:56:26 UTC
python-bluepy-1.3.0-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2019-12-21 02:06:36 UTC
python-bluepy-1.3.0-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.