diff mbox series

[2/2] staging.bbclass: Ignore installing multiple symlinks of the same name

Message ID 20220513134829.1895574-3-zboszor@pr.hu
State New
Headers show
Series [1/2] npm.bbclass: Fix file permissions before opening it for writing | expand

Commit Message

Böszörményi Zoltán May 13, 2022, 1:48 p.m. UTC
From: Zoltán Böszörményi <zboszor@gmail.com>

Recipes using "inherit npm" install the same /usr/lib/node symlink
that points to node_modules. When a recipe DEPENDS on multiple
npm based recipe, do_prepare_recipe_sysroot() fails.

Ignore this symlink in a way that the set of ignored symlinks
can be extended later if needed.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 meta/classes/staging.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Böszörményi Zoltán May 13, 2022, 2:02 p.m. UTC | #1
2022. 05. 13. 15:55 keltezéssel, Alexander Kanavin írta:
> Apologies, but special-casing this in staging class is not right
> either. The problem should be addressed at the making of
> sysroot-destdir/ step from the npm class.

npm.bbclass creates the symlink in sysroot-destdir for recipe A

But then it's the job of staging.bbclass to populate a recipe B's
recipe-sysroot and recipe-sysroot-native from recipe A.

How can this be worked around from npm.bbclass?

> 
> Alex
> 
> 
> On Fri, 13 May 2022 at 15:49, Zoltan Boszormenyi via
> lists.openembedded.org <zboszor=pr.hu@lists.openembedded.org> wrote:
>>
>> From: Zoltán Böszörményi <zboszor@gmail.com>
>>
>> Recipes using "inherit npm" install the same /usr/lib/node symlink
>> that points to node_modules. When a recipe DEPENDS on multiple
>> npm based recipe, do_prepare_recipe_sysroot() fails.
>>
>> Ignore this symlink in a way that the set of ignored symlinks
>> can be extended later if needed.
>>
>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>> ---
>>   meta/classes/staging.bbclass | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
>> index 9fc8f4f283..f7b6056219 100644
>> --- a/meta/classes/staging.bbclass
>> +++ b/meta/classes/staging.bbclass
>> @@ -528,6 +528,7 @@ python extend_recipe_sysroot() {
>>
>>               with open(manifest, "r") as f:
>>                   manifests[dep] = manifest
>> +                ignored_dests = [ ''.join([d.getVar('nonarch_libdir'), '/node' ]) ]
>>                   for l in f:
>>                       l = l.strip()
>>                       if l.endswith("/fixmepath"):
>> @@ -545,7 +546,10 @@ python extend_recipe_sysroot() {
>>                       hashname = targetdir + dest
>>                       if not hashname.endswith("/"):
>>                           if hashname in fileset:
>> -                            bb.fatal("The file %s is installed by both %s and %s, aborting" % (dest, c, fileset[hashname]))
>> +                            if os.path.islink(hashname) and  dest in ignored_dests:
>> +                                bb.note("The symlink '%s' %s wants to install is already installed by %s, ignoring" % (dest, c, fileset[hashname]))
>> +                            else:
>> +                                bb.fatal("The file %s is installed by both %s and %s, aborting" % (dest, c, fileset[hashname]))
>>                           else:
>>                               fileset[hashname] = c
>>
>> --
>> 2.36.1
>>
>>
>>
>>
>>
>>
>> 
>>
diff mbox series

Patch

diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 9fc8f4f283..f7b6056219 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -528,6 +528,7 @@  python extend_recipe_sysroot() {
 
             with open(manifest, "r") as f:
                 manifests[dep] = manifest
+                ignored_dests = [ ''.join([d.getVar('nonarch_libdir'), '/node' ]) ]
                 for l in f:
                     l = l.strip()
                     if l.endswith("/fixmepath"):
@@ -545,7 +546,10 @@  python extend_recipe_sysroot() {
                     hashname = targetdir + dest
                     if not hashname.endswith("/"):
                         if hashname in fileset:
-                            bb.fatal("The file %s is installed by both %s and %s, aborting" % (dest, c, fileset[hashname]))
+                            if os.path.islink(hashname) and  dest in ignored_dests:
+                                bb.note("The symlink '%s' %s wants to install is already installed by %s, ignoring" % (dest, c, fileset[hashname]))
+                            else:
+                                bb.fatal("The file %s is installed by both %s and %s, aborting" % (dest, c, fileset[hashname]))
                         else:
                             fileset[hashname] = c