[1/2] package_manager: Avoid looking at other multiconfigs for dependencies

Submitted by Alejandro Enedino Hernandez Samaniego on Jan. 5, 2019, 9:16 p.m. | Patch ID: 157596

Details

Message ID 1546723013-27417-1-git-send-email-alejandr@xilinx.com
State New
Headers show

Commit Message

Alejandro Enedino Hernandez Samaniego Jan. 5, 2019, 9:16 p.m.
When creating the rootfs, we look at direct and indirect dependencies
and then after processing them we create a link for rpm/ipk/deb packages
needed for each of them on the deploy directory.

The process looks at dependencies that we've already seen to avoid
copying them twice, but when BB_MULTICONFIG is enabled, the dependencies
themsevlves contain "mc:<mc_name>" in them, so duplicate packages are
not found if they come from different multiconfigs, causing an error
when linking the package file since it already exists.

Check which multiconfig we are currently building and avoid processing
dependencies from other multiconfigs.

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
---
 meta/lib/oe/package_manager.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 392fe7e..444da5d 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -643,10 +643,11 @@  def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencie
 
     taskdepdata = d.getVar("BB_TASKDEPDATA", False)
     mytaskname = d.getVar("BB_RUNTASK")
+    mc = d.getVar("BB_CURRENT_MC")
     pn = d.getVar("PN")
     seendirs = set()
     multilibs = {}
-   
+
     bb.utils.remove(subrepo_dir, recurse=True)
     bb.utils.mkdirhier(subrepo_dir)
 
@@ -660,6 +661,10 @@  def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencie
     for dep in taskdepdata:
         data = taskdepdata[dep]
         if data[1] == mytaskname and data[0] == pn:
+            if mc != 'default':
+                depmc = dep.split(':')[1]
+                if depmc != mc:
+                    continue
             start = dep
             break
     if start is None:
@@ -673,6 +678,11 @@  def create_packages_dir(d, subrepo_dir, deploydir, taskname, filterbydependencie
         next = []
         for dep2 in start:
             for dep in taskdepdata[dep2][3]:
+                # We shouldnt care of other multiconfigs
+                if mc != 'default':
+                    depmc = dep.split(':')[1]
+                    if depmc != mc:
+                        continue
                 if taskdepdata[dep][0] != pn:
                     if "do_" + taskname in dep:
                         pkgdeps.add(dep)

Comments

Richard Purdie Jan. 7, 2019, 2:52 p.m.
On Sat, 2019-01-05 at 13:16 -0800, Alejandro Enedino Hernandez
Samaniego wrote:
> When creating the rootfs, we look at direct and indirect dependencies
> and then after processing them we create a link for rpm/ipk/deb
> packages
> needed for each of them on the deploy directory.
> 
> The process looks at dependencies that we've already seen to avoid
> copying them twice, but when BB_MULTICONFIG is enabled, the
> dependencies
> themsevlves contain "mc:<mc_name>" in them, so duplicate packages are
> not found if they come from different multiconfigs, causing an error
> when linking the package file since it already exists.
> 
> Check which multiconfig we are currently building and avoid
> processing
> dependencies from other multiconfigs.
> 
> Signed-off-by: Alejandro Enedino Hernandez Samaniego <
> alejandr@xilinx.com>
> ---
>  meta/lib/oe/package_manager.py | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/package_manager.py
> b/meta/lib/oe/package_manager.py
> index 392fe7e..444da5d 100644
> --- a/meta/lib/oe/package_manager.py
> +++ b/meta/lib/oe/package_manager.py
> @@ -643,10 +643,11 @@ def create_packages_dir(d, subrepo_dir,
> deploydir, taskname, filterbydependencie
>  
>      taskdepdata = d.getVar("BB_TASKDEPDATA", False)
>      mytaskname = d.getVar("BB_RUNTASK")
> +    mc = d.getVar("BB_CURRENT_MC")
>      pn = d.getVar("PN")
>      seendirs = set()
>      multilibs = {}
> -   
> +
>      bb.utils.remove(subrepo_dir, recurse=True)
>      bb.utils.mkdirhier(subrepo_dir)
>  
> @@ -660,6 +661,10 @@ def create_packages_dir(d, subrepo_dir,
> deploydir, taskname, filterbydependencie
>      for dep in taskdepdata:
>          data = taskdepdata[dep]
>          if data[1] == mytaskname and data[0] == pn:
> +            if mc != 'default':
> +                depmc = dep.split(':')[1]
> +                if depmc != mc:
> +                    continue

Is this the right test?

Don't we also need a "if mc == 'default', dep not startswith
'multiconfig:' ?

i.e. what happens if we're the default mc but we find a multiconfig
dependency?

I think to fix this properly we may need to add an "mc" element to
taskdepdata. We can then just do:

mc = d.getVar("BB_CURRENT_MC")

if mc == "default":
    mc = ""

if data[1] == mytaskname and data[0] == pn and data[X] == mc: 

It means a bitbake version bump but its the right time to do that and
fix this properly so the code reads understandably. The "default"
string was probably a bad idea in hindsight :(

Cheers,

Richard