Patchwork package bbclass: allow per package PRIVATE_LIBS

login
register
mail settings
Submitter Koen Kooi
Date Jan. 26, 2012, 5:03 p.m.
Message ID <1327597394-31990-1-git-send-email-koen@dominion.thruhere.net>
Download mbox | patch
Permalink /patch/20191/
State New
Headers show

Comments

Koen Kooi - Jan. 26, 2012, 5:03 p.m.
If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
 meta/classes/package.bbclass |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Richard Purdie - Jan. 26, 2012, 8:51 p.m.
On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
> 
> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> ---
>  meta/classes/package.bbclass |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 45447e3..22a76cf 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
>  				if not this_soname in sonames:
>  					# if library is private (only used by package) then do not build shlib for it
>  					if not private_libs or -1 == private_libs.find(this_soname):
> -						sonames.append(this_soname)
> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
> +							sonames.append(this_soname)
>  				if libdir_re.match(root):
>  					needs_ldconfig = True
>  				if snap_symlinks and (file != this_soname):
> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
>  	shlib_provider = {}
>  	private_libs = d.getVar('PRIVATE_LIBS', True)
>  	for pkg in packages.split():
> +		if not private_libs:
> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)

You might as well just put:

                         private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)

and drop the first bit of the patch.

Cheers,

Richard
Koen Kooi - Jan. 26, 2012, 11:17 p.m.
Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:

> On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
>> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
>> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
>> 
>> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
>> ---
>> meta/classes/package.bbclass |    5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>> 
>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>> index 45447e3..22a76cf 100644
>> --- a/meta/classes/package.bbclass
>> +++ b/meta/classes/package.bbclass
>> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
>> 				if not this_soname in sonames:
>> 					# if library is private (only used by package) then do not build shlib for it
>> 					if not private_libs or -1 == private_libs.find(this_soname):
>> -						sonames.append(this_soname)
>> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
>> +							sonames.append(this_soname)
>> 				if libdir_re.match(root):
>> 					needs_ldconfig = True
>> 				if snap_symlinks and (file != this_soname):
>> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
>> 	shlib_provider = {}
>> 	private_libs = d.getVar('PRIVATE_LIBS', True)
>> 	for pkg in packages.split():
>> +		if not private_libs:
>> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
> 
> You might as well just put:
> 
>                         private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
> 
> and drop the first bit of the patch.

Wouldn't that kill backward compatibility?

regards,

Koen
Richard Purdie - Jan. 26, 2012, 11:52 p.m.
On Fri, 2012-01-27 at 00:17 +0100, Koen Kooi wrote:
> Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:
> 
> > On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
> >> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
> >> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
> >> 
> >> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> >> ---
> >> meta/classes/package.bbclass |    5 ++++-
> >> 1 files changed, 4 insertions(+), 1 deletions(-)
> >> 
> >> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> >> index 45447e3..22a76cf 100644
> >> --- a/meta/classes/package.bbclass
> >> +++ b/meta/classes/package.bbclass
> >> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
> >> 				if not this_soname in sonames:
> >> 					# if library is private (only used by package) then do not build shlib for it
> >> 					if not private_libs or -1 == private_libs.find(this_soname):
> >> -						sonames.append(this_soname)
> >> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
> >> +							sonames.append(this_soname)
> >> 				if libdir_re.match(root):
> >> 					needs_ldconfig = True
> >> 				if snap_symlinks and (file != this_soname):
> >> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
> >> 	shlib_provider = {}
> >> 	private_libs = d.getVar('PRIVATE_LIBS', True)
> >> 	for pkg in packages.split():
> >> +		if not private_libs:
> >> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
> > 
> > You might as well just put:
> > 
> >                         private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
> > 
> > and drop the first bit of the patch.
> 
> Wouldn't that kill backward compatibility?

No, since it would only take effect if the plain PRIVATE_LIBS was not
set...

Cheers,

Richard
Koen Kooi - Jan. 27, 2012, 9:45 a.m.
Op 27 jan. 2012, om 00:52 heeft Richard Purdie het volgende geschreven:

> On Fri, 2012-01-27 at 00:17 +0100, Koen Kooi wrote:
>> Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:
>> 
>>> On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
>>>> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
>>>> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
>>>> 
>>>> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
>>>> ---
>>>> meta/classes/package.bbclass |    5 ++++-
>>>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>>> 
>>>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>>>> index 45447e3..22a76cf 100644
>>>> --- a/meta/classes/package.bbclass
>>>> +++ b/meta/classes/package.bbclass
>>>> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
>>>> 				if not this_soname in sonames:
>>>> 					# if library is private (only used by package) then do not build shlib for it
>>>> 					if not private_libs or -1 == private_libs.find(this_soname):
>>>> -						sonames.append(this_soname)
>>>> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
>>>> +							sonames.append(this_soname)
>>>> 				if libdir_re.match(root):
>>>> 					needs_ldconfig = True
>>>> 				if snap_symlinks and (file != this_soname):
>>>> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
>>>> 	shlib_provider = {}
>>>> 	private_libs = d.getVar('PRIVATE_LIBS', True)
>>>> 	for pkg in packages.split():
>>>> +		if not private_libs:
>>>> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
>>> 
>>> You might as well just put:
>>> 
>>>                        private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
>>> 
>>> and drop the first bit of the patch.
>> 
>> Wouldn't that kill backward compatibility?
> 
> No, since it would only take effect if the plain PRIVATE_LIBS was not
> set...

The problem with the 'private_libs' var is that it's global and this needs a pkg local variable.

regards,

Koen
Richard Purdie - Jan. 27, 2012, 9:50 a.m.
On Fri, 2012-01-27 at 10:45 +0100, Koen Kooi wrote:
> Op 27 jan. 2012, om 00:52 heeft Richard Purdie het volgende geschreven:
> 
> > On Fri, 2012-01-27 at 00:17 +0100, Koen Kooi wrote:
> >> Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:
> >> 
> >>> On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
> >>>> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
> >>>> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
> >>>> 
> >>>> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> >>>> ---
> >>>> meta/classes/package.bbclass |    5 ++++-
> >>>> 1 files changed, 4 insertions(+), 1 deletions(-)
> >>>> 
> >>>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> >>>> index 45447e3..22a76cf 100644
> >>>> --- a/meta/classes/package.bbclass
> >>>> +++ b/meta/classes/package.bbclass
> >>>> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
> >>>> 				if not this_soname in sonames:
> >>>> 					# if library is private (only used by package) then do not build shlib for it
> >>>> 					if not private_libs or -1 == private_libs.find(this_soname):
> >>>> -						sonames.append(this_soname)
> >>>> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
> >>>> +							sonames.append(this_soname)
> >>>> 				if libdir_re.match(root):
> >>>> 					needs_ldconfig = True
> >>>> 				if snap_symlinks and (file != this_soname):
> >>>> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
> >>>> 	shlib_provider = {}
> >>>> 	private_libs = d.getVar('PRIVATE_LIBS', True)
> >>>> 	for pkg in packages.split():
> >>>> +		if not private_libs:
> >>>> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
> >>> 
> >>> You might as well just put:
> >>> 
> >>>                        private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
> >>> 
> >>> and drop the first bit of the patch.
> >> 
> >> Wouldn't that kill backward compatibility?
> > 
> > No, since it would only take effect if the plain PRIVATE_LIBS was not
> > set...
> 
> The problem with the 'private_libs' var is that it's global and this needs a pkg local variable.

I see your point. How about just doing:

	private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)

?

The code just looks more complex in your patch than I think it needs to be.

Cheers,

Richard
Koen Kooi - Jan. 27, 2012, 11:55 a.m.
Op 27 jan. 2012, om 10:50 heeft Richard Purdie het volgende geschreven:

> On Fri, 2012-01-27 at 10:45 +0100, Koen Kooi wrote:
>> Op 27 jan. 2012, om 00:52 heeft Richard Purdie het volgende geschreven:
>> 
>>> On Fri, 2012-01-27 at 00:17 +0100, Koen Kooi wrote:
>>>> Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:
>>>> 
>>>>> On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
>>>>>> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
>>>>>> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
>>>>>> 
>>>>>> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
>>>>>> ---
>>>>>> meta/classes/package.bbclass |    5 ++++-
>>>>>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>>>>> 
>>>>>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>>>>>> index 45447e3..22a76cf 100644
>>>>>> --- a/meta/classes/package.bbclass
>>>>>> +++ b/meta/classes/package.bbclass
>>>>>> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
>>>>>> 				if not this_soname in sonames:
>>>>>> 					# if library is private (only used by package) then do not build shlib for it
>>>>>> 					if not private_libs or -1 == private_libs.find(this_soname):
>>>>>> -						sonames.append(this_soname)
>>>>>> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
>>>>>> +							sonames.append(this_soname)
>>>>>> 				if libdir_re.match(root):
>>>>>> 					needs_ldconfig = True
>>>>>> 				if snap_symlinks and (file != this_soname):
>>>>>> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
>>>>>> 	shlib_provider = {}
>>>>>> 	private_libs = d.getVar('PRIVATE_LIBS', True)
>>>>>> 	for pkg in packages.split():
>>>>>> +		if not private_libs:
>>>>>> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
>>>>> 
>>>>> You might as well just put:
>>>>> 
>>>>>                       private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
>>>>> 
>>>>> and drop the first bit of the patch.
>>>> 
>>>> Wouldn't that kill backward compatibility?
>>> 
>>> No, since it would only take effect if the plain PRIVATE_LIBS was not
>>> set...
>> 
>> The problem with the 'private_libs' var is that it's global and this needs a pkg local variable.
> 
> I see your point. How about just doing:
> 
> 	private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)
> 
> ?

That would still set the global variable when it encounters a subpackage with PRIVATE_LIBS set. And that would mean it will come down to carefully ordering PACKAGES and hoping the class iterates them in the same order.

> The code just looks more complex in your patch than I think it needs to be.

I agree but I couldn't figure out a way that keeps both the old global syntax working and enables the per-package one to work as well. But I must admit that I lack the most basic python skills :)

regards,

Koen
Richard Purdie - Jan. 27, 2012, 1:07 p.m.
On Fri, 2012-01-27 at 12:55 +0100, Koen Kooi wrote:
> Op 27 jan. 2012, om 10:50 heeft Richard Purdie het volgende geschreven:
> 
> > On Fri, 2012-01-27 at 10:45 +0100, Koen Kooi wrote:
> >> Op 27 jan. 2012, om 00:52 heeft Richard Purdie het volgende geschreven:
> >> 
> >>> On Fri, 2012-01-27 at 00:17 +0100, Koen Kooi wrote:
> >>>> Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:
> >>>> 
> >>>>> On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
> >>>>>> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
> >>>>>> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
> >>>>>> 
> >>>>>> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> >>>>>> ---
> >>>>>> meta/classes/package.bbclass |    5 ++++-
> >>>>>> 1 files changed, 4 insertions(+), 1 deletions(-)
> >>>>>> 
> >>>>>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> >>>>>> index 45447e3..22a76cf 100644
> >>>>>> --- a/meta/classes/package.bbclass
> >>>>>> +++ b/meta/classes/package.bbclass
> >>>>>> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
> >>>>>> 				if not this_soname in sonames:
> >>>>>> 					# if library is private (only used by package) then do not build shlib for it
> >>>>>> 					if not private_libs or -1 == private_libs.find(this_soname):
> >>>>>> -						sonames.append(this_soname)
> >>>>>> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
> >>>>>> +							sonames.append(this_soname)
> >>>>>> 				if libdir_re.match(root):
> >>>>>> 					needs_ldconfig = True
> >>>>>> 				if snap_symlinks and (file != this_soname):
> >>>>>> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
> >>>>>> 	shlib_provider = {}
> >>>>>> 	private_libs = d.getVar('PRIVATE_LIBS', True)
> >>>>>> 	for pkg in packages.split():
> >>>>>> +		if not private_libs:
> >>>>>> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
> >>>>> 
> >>>>> You might as well just put:
> >>>>> 
> >>>>>                       private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
> >>>>> 
> >>>>> and drop the first bit of the patch.
> >>>> 
> >>>> Wouldn't that kill backward compatibility?
> >>> 
> >>> No, since it would only take effect if the plain PRIVATE_LIBS was not
> >>> set...
> >> 
> >> The problem with the 'private_libs' var is that it's global and this needs a pkg local variable.
> > 
> > I see your point. How about just doing:
> > 
> > 	private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)
> > 
> > ?
> 
> That would still set the global variable when it encounters a
> subpackage with PRIVATE_LIBS set. And that would mean it will come
> down to carefully ordering PACKAGES and hoping the class iterates them
> in the same order.
> 
> > The code just looks more complex in your patch than I think it needs
> to be.
> 
> I agree but I couldn't figure out a way that keeps both the old global
> syntax working and enables the per-package one to work as well. But I
> must admit that I lack the most basic python skills :)

I was meaning to do:

        shlib_provider = {}
-       private_libs = d.getVar('PRIVATE_LIBS', True)
        for pkg in packages.split():
+               private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)
                needs_ldconfig = False
                bb.debug(2, "calculating shlib provides for %s" % pkg)

so private_libs is reset each time to the correct value.

Cheers,

Richard
Koen Kooi - Jan. 27, 2012, 2:32 p.m.
Op 27 jan. 2012, om 14:07 heeft Richard Purdie het volgende geschreven:

> On Fri, 2012-01-27 at 12:55 +0100, Koen Kooi wrote:
>> Op 27 jan. 2012, om 10:50 heeft Richard Purdie het volgende geschreven:
>> 
>>> On Fri, 2012-01-27 at 10:45 +0100, Koen Kooi wrote:
>>>> Op 27 jan. 2012, om 00:52 heeft Richard Purdie het volgende geschreven:
>>>> 
>>>>> On Fri, 2012-01-27 at 00:17 +0100, Koen Kooi wrote:
>>>>>> Op 26 jan. 2012, om 21:51 heeft Richard Purdie het volgende geschreven:
>>>>>> 
>>>>>>> On Thu, 2012-01-26 at 18:03 +0100, Koen Kooi wrote:
>>>>>>>> If a recipe packages multiple versions of shlib (e.g. powervr drivers) we only want the shlib code to pickup $PN, not $PN-foo subpackages.
>>>>>>>> This keeps backward compatibility with the global PRIVATE_LIBS usage if no per package PRIVATE_LIBS are set for a given package. In other words: this doesn't break the firefox recipe.
>>>>>>>> 
>>>>>>>> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
>>>>>>>> ---
>>>>>>>> meta/classes/package.bbclass |    5 ++++-
>>>>>>>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>>>>>>> 
>>>>>>>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>>>>>>>> index 45447e3..22a76cf 100644
>>>>>>>> --- a/meta/classes/package.bbclass
>>>>>>>> +++ b/meta/classes/package.bbclass
>>>>>>>> @@ -1246,7 +1246,8 @@ python package_do_shlibs() {
>>>>>>>> 				if not this_soname in sonames:
>>>>>>>> 					# if library is private (only used by package) then do not build shlib for it
>>>>>>>> 					if not private_libs or -1 == private_libs.find(this_soname):
>>>>>>>> -						sonames.append(this_soname)
>>>>>>>> +						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
>>>>>>>> +							sonames.append(this_soname)
>>>>>>>> 				if libdir_re.match(root):
>>>>>>>> 					needs_ldconfig = True
>>>>>>>> 				if snap_symlinks and (file != this_soname):
>>>>>>>> @@ -1328,6 +1329,8 @@ python package_do_shlibs() {
>>>>>>>> 	shlib_provider = {}
>>>>>>>> 	private_libs = d.getVar('PRIVATE_LIBS', True)
>>>>>>>> 	for pkg in packages.split():
>>>>>>>> +		if not private_libs:
>>>>>>>> +			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
>>>>>>> 
>>>>>>> You might as well just put:
>>>>>>> 
>>>>>>>                      private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True)
>>>>>>> 
>>>>>>> and drop the first bit of the patch.
>>>>>> 
>>>>>> Wouldn't that kill backward compatibility?
>>>>> 
>>>>> No, since it would only take effect if the plain PRIVATE_LIBS was not
>>>>> set...
>>>> 
>>>> The problem with the 'private_libs' var is that it's global and this needs a pkg local variable.
>>> 
>>> I see your point. How about just doing:
>>> 
>>> 	private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)
>>> 
>>> ?
>> 
>> That would still set the global variable when it encounters a
>> subpackage with PRIVATE_LIBS set. And that would mean it will come
>> down to carefully ordering PACKAGES and hoping the class iterates them
>> in the same order.
>> 
>>> The code just looks more complex in your patch than I think it needs
>> to be.
>> 
>> I agree but I couldn't figure out a way that keeps both the old global
>> syntax working and enables the per-package one to work as well. But I
>> must admit that I lack the most basic python skills :)
> 
> I was meaning to do:
> 
>        shlib_provider = {}
> -       private_libs = d.getVar('PRIVATE_LIBS', True)
>        for pkg in packages.split():
> +               private_libs = d.getVar('PRIVATE_LIBS_' + pkg, True) or d.getVar('PRIVATE_LIBS', True)
>                needs_ldconfig = False
>                bb.debug(2, "calculating shlib provides for %s" % pkg)
> 
> so private_libs is reset each time to the correct value.

I'll try a build with that and send a v2 of the patch if it works as we expect it :)

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 45447e3..22a76cf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1246,7 +1246,8 @@  python package_do_shlibs() {
 				if not this_soname in sonames:
 					# if library is private (only used by package) then do not build shlib for it
 					if not private_libs or -1 == private_libs.find(this_soname):
-						sonames.append(this_soname)
+						if not private_libs_pkg or -1 == private_libs_pkg.find(this_soname):
+							sonames.append(this_soname)
 				if libdir_re.match(root):
 					needs_ldconfig = True
 				if snap_symlinks and (file != this_soname):
@@ -1328,6 +1329,8 @@  python package_do_shlibs() {
 	shlib_provider = {}
 	private_libs = d.getVar('PRIVATE_LIBS', True)
 	for pkg in packages.split():
+		if not private_libs:
+			private_libs_pkg = d.getVar('PRIVATE_LIBS_' + pkg, True)
 		needs_ldconfig = False
 		bb.debug(2, "calculating shlib provides for %s" % pkg)