Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@streamunlimited.com>
To: Alexander Kanavin <alex.kanavin@gmail.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] package.bbclass: allow shell-style wildcards in PRIVATE_LIBS
Date: Wed, 4 Sep 2019 14:55:38 +0200	[thread overview]
Message-ID: <20190904125538.c6f6mz6cwcz56ebr@qschulz> (raw)
In-Reply-To: <CANNYZj_ZFESLDrUxU9XjjdTQXEp-awnq+-EJEavE32SqJOZSXA@mail.gmail.com>

Hi Alex,

On Wed, Sep 04, 2019 at 12:11:29PM +0200, Alexander Kanavin wrote:
> On Wed, 4 Sep 2019 at 09:32, Quentin Schulz <
> quentin.schulz@streamunlimited.com> wrote:
> 
> > > +++ b/meta/classes/package.bbclass
> > > @@ -1646,7 +1646,8 @@ python package_do_shlibs() {
> > >                  prov = (this_soname, ldir, pkgver)
> > >                  if not prov in sonames:
> > >                      # if library is private (only used by package) then
> > do not build shlib for it
> > > -                    if not private_libs or this_soname not in
> > private_libs:
> > > +                    import fnmatch
> > > +                    if not private_libs or len([i for i in private_libs
> > if fnmatch.fnmatch(this_soname, i)]) == 0:
> >
> > We only need to know if this_soname is matching one of the patterns, we
> > don't need to check for each and every pattern.
> >
> > Something like:
> >
> > for pattern in private_libs:
> >         if fnmatch.fnmatch(this_soname, pattern)]) == 0:
> >                 sonames.add(prov)
> >                 break
> >
> > would be possible?
> >
> 
> Actually, this suggested code snippet looks altogether wrong to me. We do

Indeed.

> need to check the file against every pattern, and only if it matches none
> of them, it gets added to sonames. Note the original code says 'this_soname

So we just need to invert the logic actually.

matched = False
for pattern in private_libs:
	if fnmatch.fnmatch(this_soname, pattern)]) == 0:
		matched = True
		break

if not matched:
	sonames.add(prov)

> not in private_libs', which also means going over every item in the list.
> 

I'd hope Python devs did optimization on this one and stopped at the
first match in the list, but I'm not one of them so...

BR,
Quentin
-- 
StreamUnlimited Engineering GmbH
High Tech Campus Vienna, Gutheil-Schoder-Gasse 10, 1100 Vienna, Austria
quentin.schulz@streamunlimited.com, www.streamunlimited.com


  reply	other threads:[~2019-09-04 12:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 16:32 [PATCH] package.bbclass: allow shell-style wildcards in PRIVATE_LIBS Alexander Kanavin
2019-09-04  7:32 ` Quentin Schulz
2019-09-04 10:04   ` Alexander Kanavin
2019-09-04 10:11   ` Alexander Kanavin
2019-09-04 12:55     ` Quentin Schulz [this message]
2019-09-04 14:52       ` Alexander Kanavin
2019-09-04 14:57         ` Quentin Schulz
2019-09-04 15:08           ` Alexander Kanavin
  -- strict thread matches above, loose matches on Subject: below --
2019-09-06 10:22 Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190904125538.c6f6mz6cwcz56ebr@qschulz \
    --to=quentin.schulz@streamunlimited.com \
    --cc=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox