[OE-core] [PATCH 2/2] package.bbclass: convert file depends into pkg depends

2014-07-14 Thread Robert Yang
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 
---
 meta/classes/package.bbclass |   14 ++
 1 file changed, 14 insertions(+)

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]))
-- 
1.7.9.5

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 2/2] package.bbclass: convert file depends into pkg depends

2014-07-14 Thread Burton, Ross
On 14 July 2014 10:41, Robert Yang  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
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 2/2] package.bbclass: convert file depends into pkg depends

2014-07-14 Thread Robert Yang



On 07/14/2014 06:29 PM, Burton, Ross wrote:

On 14 July 2014 10:41, Robert Yang  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



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 2/2] package.bbclass: convert file depends into pkg depends

2014-07-14 Thread Robert Yang


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  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



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 2/2] package.bbclass: convert file depends into pkg depends

2014-07-14 Thread Mark Hatle

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  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




--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core