On 08/02/2013 04:24 PM, Paul Eggleton wrote:
Hi Hongxu,

Great idea! This should be very useful indeed.

Just a few feedback points:

On Thursday 01 August 2013 19:04:05 Hongxu Jia 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 <[email protected]>
---
  scripts/contrib/list-packageconfig-flag.py | 180
+++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+)
  create mode 100755 scripts/contrib/list-packageconfig-flag.py
I think the script ought to be called "list-packageconfig-flags" rather than
"list-packageconfig-flag".

Agree, I will rename it.
...
+def parse_recipe(recipe):
+    ''' Parse a recipe to collect PACKAGECONFIG's flags '''
This should say "collect available PACKAGECONFIG flags". The same applies to
other messages/comments.

Agree
+    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
So, this is fairly simple and works for most cases; however it would probably
be a bit more robust if the script used bitbake's own parser to extract the
flags. The "tinfoil" module should help with this. We can always address this
in a follow-up patch later on, though - I can certainly show you some examples
of how to do this or I can do it, whichever you prefer.
Great, this is what I hope to do in the follow-up, I am very pleased to
do the investigate on bitbake parser, very thankful to share some
examples of how to do this with me.

Should this simple patch be accepted? And I will include bitbake parser
in follow-up patch.
Or
Drop this patch and waiting till bitbake parser has been included.

Thanks,
Hongxu
Cheers,
Paul


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to