From: Hongxu Jia <hongxu.jia@windriver.com>
To: Otavio Salvador <otavio@ossystems.com.br>
Cc: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] list-packageconfig-flag.py: add a script to list all PACKAGECONFIG's flags
Date: Fri, 2 Aug 2013 09:50:04 +0800 [thread overview]
Message-ID: <51FB104C.8020602@windriver.com> (raw)
In-Reply-To: <CAP9ODKrK-qHCVHRfRwatCfp6e2RaejP5CSm+xBgEEp95uSb13g@mail.gmail.com>
On 08/02/2013 12:46 AM, Otavio Salvador wrote:
> On Thu, Aug 1, 2013 at 8:04 AM, Hongxu Jia <hongxu.jia@windriver.com> wrote:
>> list-packageconfig-flag.py will walk the METADIR and collect recipes which
>> have PACKAGECONFIG's flags.
>>
>> The default display is to list recipes which have PACKAGECONFIG's flags in
>> METADIR. If option '-f' is used, it will list PACKAGECONFIG's flags and all
>> affected recipes in METADIR
>>
>> EXAMPLE:
>> list-packageconfig-flag.py poky/meta poky/meta-yocto
>> RECIPE NAME PACKAGECONFIG's flag
>> =========================================
>> libarchive_2.8.5.bb acl xattr largefile zlib bz2 xz openssl libxml2 expat
>> strace_4.8.bb libaio acl
>> connman.inc wifi bluetooth 3g tist openvpn vpnc l2tp pptp wispr
>>
>> list-packageconfig-flag.py -f poky/meta poky/meta-yocto
>> PACKAGECONFIG's flag RECIPE NAME
>> ====================================
>> speex gstreamer1.0-plugins-good.inc
>> keyutils rpm_5.4.9.bb
>> gallium-egl mesa.inc
>>
>> [YOCTO #4368]
>>
>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> Cool! :-)
>
>> scripts/contrib/list-packageconfig-flag.py | 180 +++++++++++++++++++++++++++++
> I'd drop .py extension and use +x permission.
>
Most scripts in scripts/contrib have '.py' or '.sh' extension, is it the
rule to be followed or not?
It looks like the following 'new file mode 10755' means +x permission is
used.
>> 1 file changed, 180 insertions(+)
>> create mode 100755 scripts/contrib/list-packageconfig-flag.py
>>
>> diff --git a/scripts/contrib/list-packageconfig-flag.py b/scripts/contrib/list-packageconfig-flag.py
>> new file mode 100755
>> index 0000000..7a5568f
>> --- /dev/null
>> +++ b/scripts/contrib/list-packageconfig-flag.py
>> @@ -0,0 +1,180 @@
>> +#!/usr/bin/env python
>> +
>> +# This program is free software; you can redistribute it and/or modify
>> +# it under the terms of the GNU General Public License as published by
>> +# the Free Software Foundation; either version 2 of the License, or
>> +# (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program; if not, write to the Free Software Foundation.
>> +#
>> +# Copyright (C) 2013 Wind River Systems, Inc.
>> +#
>> +# list recipes which have PACKAGECONFIG's flags in METADIR
>> +# list PACKAGECONFIG's flags and all affected recipes in METADIR
>> +#
>> +
>> +import sys
>> +import getopt
>> +import os
>> +import re
>> +
>> +usage_body = ''' list recipes which have PACKAGECONFIG's flags in METADIR
>> +
>> +OPTION:
>> + -h, --help display this help and exit
>> + -f, --flag list PACKAGECONFIG's flags and all affected recipes in METADIR
>> +
>> +EXAMPLE:
>> +list-packageconfig-flag.py poky/meta poky/meta-yocto
>> +list-packageconfig-flag.py -f poky/meta poky/meta-yocto
>> +'''
>> +
>> +def usage():
>> + print 'Usage: %s [OPTION] [METADIR]...' % os.path.basename(sys.argv[0])
>> + print usage_body
>> +
>> +def parse_recipe(recipe):
>> + ''' Parse a recipe to collect PACKAGECONFIG's flags '''
>> + prog = re.compile(r' *PACKAGECONFIG\[(?P<flag>.*)\] *=.*')
>> + try:
>> + r = open(recipe)
>> + except IOError as (errno, strerror):
>> + print >> sys.stderr, 'WARNING: Failed to open recipe', recipe
>> +
>> + flaglist = []
>> + for line in r:
>> + # Strip any comments from the line
>> + line = line.rsplit('#')[0]
>> + m = prog.match(line)
>> + if m:
>> + flaglist.append(m.group('flag'))
>> + r.close()
>> +
>> + return flaglist
>> +
>> +def process_recipes(metadir):
>> + ''' Collect recipes which have PACKAGECONFIG's flags in METADIR '''
>> + # recipesdict = {'recipe': ['flag1', 'flag2',...]}
>> + recipesdict = {}
>> + for root,dirs,files in os.walk(metadir):
>> + for name in files:
>> + if name.find(".bb") >= 0 or name.find(".inc") >= 0:
>> + flaglist = parse_recipe(os.path.join(root,name))
>> + if flaglist:
>> + recipesdict[name] = flaglist
>> +
>> + return recipesdict
> In case a PACKAGECONFIG is add by a class. I think this case is missing here.
Agree, sorry for the missing, I will add it.
Thanks,
Hongxu
>
next prev parent reply other threads:[~2013-08-02 1:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 11:04 [PATCH 0/1] list-packageconfig-flag.py: add a script to list all PACKAGECONFIG's flags Hongxu Jia
2013-08-01 11:04 ` [PATCH 1/1] " Hongxu Jia
2013-08-01 16:46 ` Otavio Salvador
2013-08-02 1:50 ` Hongxu Jia [this message]
2013-08-02 1:54 ` Otavio Salvador
2013-08-02 8:24 ` Paul Eggleton
2013-08-02 9:14 ` Hongxu Jia
2013-08-02 10:38 ` Paul Eggleton
2013-08-02 10:03 ` Hongxu Jia
2013-08-02 10:40 ` Paul Eggleton
2013-08-03 3:15 ` Hongxu Jia
-- strict thread matches above, loose matches on Subject: below --
2013-08-02 2:20 [PATCH V2 0/1] " Hongxu Jia
2013-08-02 2:20 ` [PATCH 1/1] " Hongxu Jia
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=51FB104C.8020602@windriver.com \
--to=hongxu.jia@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=otavio@ossystems.com.br \
/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