Skip to contentSkip to conversation

package.bbclass: add QA check: file-depends

PATCH New Robert Yang 1 participant 2 messages Jul 15, 2014

lore
Share & tools
lore
#0 lore raw

v2 cover package.bbclass: add QA check: file-depends

V2:
* Only print warnings when enabled, let the user fix the RDEPENDS by hand as Mark suggested.
* Use ${bindir}/perl rather than /usr/bin/perl as Ross suggested, also fix for nativesdk.

V1:
* Initial version.

// Robert

The following changes since commit fa325e44f5b429b4038022b31285af9c94672943:

insane: Ensure do_package_qa happens after do_packagedata (2014-07-11 23:19:18 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/filedep
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/filedep

Robert Yang (1):
package.bbclass: add QA check: file-depends

 meta/classes/insane.bbclass  |    2 +-
 meta/classes/package.bbclass |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 package.bbclass: add QA check: file-depends

The ipk or deb can't depend on file such as "/usr/bin/perl", so it would know nothing about perl, and there would be dependencies problems when we run "apt-get install" on the target, this check can help us figure out the depends, and the user can fix it manually.

[YOCTO #1662]

---
 meta/classes/insane.bbclass  |    2 +-
 meta/classes/package.bbclass |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +1 -1
index 106ace7..1a136b7 100644
@@ -29,7 +29,7 @@ QA_SANE = "True"
 WARN_QA ?= "ldflags useless-rpaths rpaths staticdev libdir xorg-driver-abi \
             textrel already-stripped incompatible-license files-invalid \
             installed-vs-shipped compile-host-path install-host-path \
-            pn-overrides infodir \
+            pn-overrides infodir file-depends \
             "
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch pkgconfig la \
             perms dep-cmp pkgvarcheck perm-config perm-line perm-link \
meta/classes/package.bbclass +25 -0
index 26a20d1..eaf7ddf 100644
@@ -52,6 +52,10 @@ LOCALE_SECTION ?= ''
 
 ALL_MULTILIB_PACKAGE_ARCHS = "${@all_multilib_tune_values(d, 'PACKAGE_ARCHS')}"
 
+BASH_PATH ?= "${base_bindir}/bash"
+PERL_PATH ?= "${bindir}/perl"
+PYTHON_PATH ?= "${bindir}/python"
+
 # rpm is used for the per-file dependency identification
 PACKAGE_DEPENDS += "rpm-native"
 
@@ -1318,6 +1322,11 @@ python package_do_filedeps() {
     pool.close()
     pool.join()
 
+    # Used for converting file depends into pkg depends
+    prog_maps = {d.getVar("BASH_PATH", True): "bash",
+            d.getVar("PERL_PATH", True): "perl",
+            d.getVar("PYTHON_PATH", True): "python"}
+
     provides_files = {}
     requires_files = {}
 
@@ -1334,10 +1343,26 @@ python package_do_filedeps() {
             key = "FILERPROVIDES_" + file + "_" + pkg
             d.setVar(key, " ".join(provides[file]))
 
+        req_file_pkgs = []
         for file in requires:
             requires_files[pkg].append(file)
             key = "FILERDEPENDS_" + file + "_" + pkg
             d.setVar(key, " ".join(requires[file]))
+            for req_file in requires[file]:
+                if req_file in prog_maps and prog_maps[req_file] not in req_file_pkgs:
+                    if bb.data.inherits_class("nativesdk", d):
+                        req_file_pkgs.append("nativesdk-" + prog_maps[req_file])
+                    else:
+                        req_file_pkgs.append(prog_maps[req_file])
+
+        if req_file_pkgs:
+            rdepends = bb.utils.explode_deps(d.getVar('RDEPENDS_' + pkg, True) or "")
+            for p in req_file_pkgs:
+                if p not in rdepends:
+                    if p == "python" and "python3" in rdepends:
+                        continue
+                    msg = "RDEPENDS_%s should contain %s, please consider fixing it" %  (pkg, p)
+                    package_qa_handle_error("file-depends", msg, d)
 
     for pkg in requires_files:
         d.setVar("FILERDEPENDSFLIST_" + pkg, " ".join(requires_files[pkg]))
Signature · 1 line
1.7.9.5