Patchwork [2/2] package.bbclass: convert file depends into pkg depends

login
register
mail settings
Submitter Robert Yang
Date July 14, 2014, 9:41 a.m.
Message ID <965b510cf2d609b1fac50901312b3372d4e063a5.1405330780.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/75449/
State New
Headers show

Comments

Robert Yang - July 14, 2014, 9:41 a.m.
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. Convert the file depends into
pkg depends can fix the issue:

/bin/bash -> bash
/usr/bin/perl -> perl
/usr/bin/python -> python

NOTE, we still need the QA check package_qa_check_file_depends though we
have this fix, manually add the pkg to RDEPENDS is correct, anyway.

TODO:
- Add a global var for the paths, such as BASH_PATH = "/bin/bash" rather than
  directly use /bin/bash ?

[YOCTO #1662]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/package.bbclass |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
Ross Burton - July 14, 2014, 10:29 a.m.
On 14 July 2014 10:41, Robert Yang <liezhi.yang@windriver.com> wrote:
> +    prog_maps = {"/bin/bash": "bash", "/usr/bin/perl": "perl", "/usr/bin/python": "python"}

Use something like d.expand("${bindir}/perl") instead of hard-coding paths.

Ross
Robert Yang - July 14, 2014, 10:34 a.m.
On 07/14/2014 06:29 PM, Burton, Ross wrote:
> On 14 July 2014 10:41, Robert Yang <liezhi.yang@windriver.com> wrote:
>> +    prog_maps = {"/bin/bash": "bash", "/usr/bin/perl": "perl", "/usr/bin/python": "python"}
>
> Use something like d.expand("${bindir}/perl") instead of hard-coding paths.

Good idea, thanks, will update it sooner.

// Robert

>
> Ross
>
>
Robert Yang - July 14, 2014, 4:25 p.m.
Hello,

Found that eglibc-utils/usr/bin/tzselect is a bash script, should we
add:

RDEPENDS_eglibc-utils += "bash" ?

The problem is that this would cause bash installed to meta-toolchain,
the dependencies chain is:

meta-toolchain -> eglibc-utils -> bash

Maybe we should only warn rather than add the RDEPENDS atm, please ?

// Robert

On 07/14/2014 06:29 PM, Burton, Ross wrote:
> On 14 July 2014 10:41, Robert Yang <liezhi.yang@windriver.com> wrote:
>> +    prog_maps = {"/bin/bash": "bash", "/usr/bin/perl": "perl", "/usr/bin/python": "python"}
>
> Use something like d.expand("${bindir}/perl") instead of hard-coding paths.
>
> Ross
>
>
Mark Hatle - July 14, 2014, 8:04 p.m.
On 7/14/14, 11:25 AM, Robert Yang wrote:
>
> Hello,
>
> Found that eglibc-utils/usr/bin/tzselect is a bash script, should we
> add:
>
> RDEPENDS_eglibc-utils += "bash" ?
>
> The problem is that this would cause bash installed to meta-toolchain,
> the dependencies chain is:
>
> meta-toolchain -> eglibc-utils -> bash
>
> Maybe we should only warn rather than add the RDEPENDS atm, please ?

Hmm at one point I thought someone has re-written tzselect as posix sh, to avoid 
the bash dependency.

I'd actually suggest this be a defect and we try to find someone who can fix it. 
  (I'd like to eliminate bash dependencies in anything core to a tiny system.)

--Mark

> // Robert
>
> On 07/14/2014 06:29 PM, Burton, Ross wrote:
>> On 14 July 2014 10:41, Robert Yang <liezhi.yang@windriver.com> wrote:
>>> +    prog_maps = {"/bin/bash": "bash", "/usr/bin/perl": "perl", "/usr/bin/python": "python"}
>>
>> Use something like d.expand("${bindir}/perl") instead of hard-coding paths.
>>
>> Ross
>>
>>

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 26a20d1..419cdcf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1318,6 +1318,9 @@  python package_do_filedeps() {
     pool.close()
     pool.join()
 
+    # Used for converting file depends into pkg depends
+    prog_maps = {"/bin/bash": "bash", "/usr/bin/perl": "perl", "/usr/bin/python": "python"}
+
     provides_files = {}
     requires_files = {}
 
@@ -1334,10 +1337,21 @@  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:
+                    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:
+                    bb.note("Adding %s to RDEPENDS_%s" % (p, pkg))
+                    d.appendVar("RDEPENDS_" + pkg, ' ' + p)
 
     for pkg in requires_files:
         d.setVar("FILERDEPENDSFLIST_" + pkg, " ".join(requires_files[pkg]))