insane.bbclass: Add QA package check for mixed bins and libs
cover insane.bbclass: Add QA package check for mixed bins and libs
In multi-lib cases some packages with mixed binaries and libraries could have a problem. Explanations with GDB and bmap-tools.
GDB requires python binary (RDEPENDS) and bmap-tools too. GDB is installed as 32bit variant and bmap-tools as 64bit. In the current state both type (32+64) of required libraries will be installed on the target. (I think' this is the right case.)
At the end a 32bit variant of binaries wins and overrides the 64bit. Finally GDB is working without any problems and bmap-tools not. Bacuse 64-bit python binary was overriden with 32-bit.
All-arch variant has been disabled for multilib. Is there any special reson why?
How we can proceed with this kind of problem? There are many others tools like python, perl, ... .
Just for info, I have run this check locally with current bitbake world, >100 packages have this problem.
Andrej Valek (1):
insane.bbclass: Add QA package check for mixed bins and libs
meta/classes/insane.bbclass | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
Signature · 1 line
2.11.0
PATCH 1/1 insane.bbclass: Add QA package check for mixed bins and libs
Warn about mixed binaries and libraries in the same package. This could makes unexpected behavior in multi-lib cases.
--- meta/classes/insane.bbclass | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
meta/classes/insane.bbclass +27 -0
@@ -17,6 +17,8 @@ # -Check that scripts in base_[bindir|sbindir|libdir] do not reference # files under exec_prefix # -Check if the package name is upper case +# -Check that binaries and libraries base_[bindir|sbindir|libdir] are +# not mixed in the same package QA_SANE = "True"
@@ -28,6 +30,7 @@ WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \ pn-overrides infodir build-deps \ unknown-configure-option symlink-to-sysroot multilib \ invalid-packageconfig host-user-contaminated uppercase-pn patch-fuzz \ + mixed-libs-bins-in-pkg \ " ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \ perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
@@ -893,6 +896,30 @@ def package_qa_check_host_user(path, name, d, elf, messages): return True +QAPKGTEST[mixed-libs-bins-in-pkg] = "package_qa_check_bins_libs" +def package_qa_check_bins_libs(pkg, d, messages): + """Check for mixed binaries and libraries in the same package.""" + pkgdest = d.getVar('PKGDEST') + pkg_dir = pkgdest + os.sep + pkg + os.sep + + # Skip unneeded packages + if pkg.endswith("-dev") or pkg.endswith("-staticdev") or pkg.endswith("-dbg") or pkg.endswith("-ptest") or pkg.startswith("nativesdk-"): + return True + + binaries = [d.getVar('base_bindir'), d.getVar('base_sbindir'), d.getVar('bindir'), d.getVar('sbindir')] + libraries = [d.getVar('base_libdir'), d.getVar('libdir') ] + d.getVar('MULTILIB_VARIANTS').split() + [d.getVar('exec_prefix') + x for x in d.getVar('MULTILIB_VARIANTS').split()] + + # Check pkg_dir content + for bin in binaries: + if os.path.exists(pkg_dir + bin) and not os.path.islink(pkg_dir + bin): + for lib in libraries: + if os.path.exists(pkg_dir + lib) and not os.path.islink(pkg_dir + lib): + package_qa_add_message(messages, "mixed-libs-bins-in-pkg", "Package %s has mixed binaries and libraries" % pkg) + return False + + return True + + # The PACKAGE FUNC to scan each package python do_package_qa () { import subprocess
Signature · 1 line
2.11.0
Quoted 8 lines · Andrej Valek
In multi-lib cases some packages with mixed binaries and libraries could have a problem. Explanations with GDB and bmap-tools.
GDB requires python binary (RDEPENDS) and bmap-tools too. GDB is installed as 32bit variant and bmap-tools as 64bit. In the current state both type (32+64) of required libraries will be installed on the target. (I think' this is the right case.)
Quoted 6 lines
At the end a 32bit variant of binaries wins and overrides the 64bit. Finally GDB is working without any problems and bmap-tools not. Bacuse 64-bit python binary was overriden with 32-bit.
All-arch variant has been disabled for multilib. Is there any special reson why?
Yes, this had long discussion and was done very reluctantly.
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d9ba0219b2f6643ffc825d4b8d3494d07237dd0b
was the commit but there was a lot of discussion on the list before it merged.
Quoted 5 lines
How we can proceed with this kind of problem? There are many others tools like python, perl, ... .
Just for info, I have run this check locally with current
bitbake world, >100 packages have this problem.
Merging a QA test which causes hundreds of warnings isn't really going to help unless we have a strategy for fixing it.
As I understand it, if you install python 32bit and 64 bit, you should get the libraries from both but only the binaries from the one that wins. That should mean anything linking to the lib should work?
What am I missing? Is something not working like that? Is this with the rpm or opkg implementation? (they're very different)
Cheers,
Richard
Hi Richard,
Quoted 23 lines · Richard Purdie
Quoted 8 lines · Andrej Valek
In multi-lib cases some packages with mixed binaries and libraries could have a problem. Explanations with GDB and bmap-tools.
GDB requires python binary (RDEPENDS) and bmap-tools too. GDB is installed as 32bit variant and bmap-tools as 64bit. In the current state both type (32+64) of required libraries will be installed on the target. (I think' this is the right case.)
Quoted 6 lines
At the end a 32bit variant of binaries wins and overrides the 64bit. Finally GDB is working without any problems and bmap-tools not. Bacuse 64-bit python binary was overriden with 32-bit.
All-arch variant has been disabled for multilib. Is there any special reson why?
Yes, this had long discussion and was done very reluctantly.
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d9ba0219b2f6643ffc825d4b8d3494d07237dd0b
was the commit but there was a lot of discussion on the list before it merged.
Quoted 9 lines
Quoted 5 lines
How we can proceed with this kind of problem? There are many others tools like python, perl, ... .
Just for info, I have run this check locally with current
bitbake world, >100 packages have this problem.Merging a QA test which causes hundreds of warnings isn't really going to help unless we have a strategy for fixing it.
It was a test, to get list of packages, which could have a problem.
Quoted 4 lines
As I understand it, if you install python 32bit and 64 bit, you should get the libraries from both but only the binaries from the one that wins. That should mean anything linking to the lib should work?
Yes, this is working well. But Let say, python modules are installed on the different location for 64-bit (/usr/lib/python) and 32-bit (/usr/lib32/python3.5). Each python version is searching for modules on certain path. So linker don't know about this behavior, because it's handled by python itself.
Maybe we can extend the "PYTHONPATH" to search also for modules in another path. But I am not sure about the 64/32 bit module compatibility.
Quoted 3 lines
What am I missing? Is something not working like that? Is this with the rpm or opkg implementation? (they're very different)
I have tested it via opkg. Is it somehow "fixed" in rpm?
Quoted 4 lines
Cheers,
Richard
Regards,
Andrej
Quoted 3 lines · Richard Purdie
Merging a QA test which causes hundreds of warnings isn't really going to help unless we have a strategy for fixing it.
I agree merging this only makes sense if we commit to fixing the issue.
In my opinion the strategy for fixing it would be to always split packages that consists of both binaries and libs into two. This is already done for many like sqlite3 (sqlite3 vs libsqlite3). This check would just ensure that this rule is always followed.
This would make it easier to separate the two. Let's take the example that you have two applications A (32bit) and B (64bit) both using sqlite3. In this case the two would link to lib32-libsqlite3 and libsqlite3.
If the package contained both the library and the binary you would end up with both libs but one of the two binaries (not sure this is deterministic). If the packages are only lib and only binary then you would explicitly need to select either the 32bit or the 64bit variant.
In practice this would not only benefit the multilib case. It would also help with avoiding unnecessarily installed binaries just because somebody is using a library bundled in the same package.
Quoted 7 lines
As I understand it, if you install python 32bit and 64 bit, you should get the libraries from both but only the binaries from the one that wins. That should mean anything linking to the lib should work?
What am I missing? Is something not working like that? Is this with the rpm or opkg implementation? (they're very different)
I think the issue with scripting languages (especially python) is different from the general case above (sqlite3). And maybe the insane check in the current form is not covering all cases.
Pascal