Skip to contentSkip to conversation

Misc minor fixes

PATCH Applied Paul Eggleton 2 participants 8 messages Jul 22, 2011 – Jul 25, 2011

lore
Share & tools
lore
#0 lore raw

cover Misc minor fixes

Some minor usability-related fixes for bitbake and bitbake-layers.

The changes (against poky, apply against bitbake master with -p2) are available in the git repository at:
git://git.pokylinux.org/poky-contrib paule/bitbake-tweaks
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=paule/bitbake-tweaks

Paul Eggleton (6):
bitbake: add note to -b option indicating no dependency handling bitbake/cooker: show a warning when -b is specified
bitbake: adjust comments/messages for default server change
bitbake-layers: check for errors before parsing
bitbake-layers: add command help
bitbake-layers: remove unneeded do_EOF

 bitbake/bin/bitbake        |    8 +++---
 bitbake/bin/bitbake-layers |   45 +++++++++++++++++++++++++++++++++++++++----
 bitbake/lib/bb/cooker.py   |    4 +++
 3 files changed, 48 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/6 bitbake: add note to -b option indicating no dependency handling

The -b option doesn't handle dependencies so note this in the help.

---
 bitbake/bin/bitbake |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/bin/bitbake +1 -1
index 206d97b..f198fd1 100755
@@ -102,7 +102,7 @@ It expects that BBFILES is defined, which is a space separated list of files to
 be executed.  BBFILES does support wildcards.
 Default BBFILES are the .bb files in the current directory.""")
 
-    parser.add_option("-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES.",
+    parser.add_option("-b", "--buildfile", help = "execute the task against this .bb file, rather than a package from BBFILES. Does not handle any dependencies.",
                action = "store", dest = "buildfile", default = None)
 
     parser.add_option("-k", "--continue", help = "continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.",
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/6 bitbake/cooker: show a warning when -b is specified

In reply to Paul Eggleton

Too many people are using -b because they think it is the normal way of specifying a target to be built, and then get confused when the build fails due to a missing dependency; so show a warning about dependencies not being handled when this option is used.

---
 bitbake/lib/bb/cooker.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
bitbake/lib/bb/cooker.py +4 -0
index 7cf43a0..b0ddb2e 100644
@@ -906,6 +906,10 @@ class BBCooker:
         Build the file matching regexp buildfile
         """
 
+        # Too many people use -b because they think it's how you normally
+        # specify a target to be built, so show a warning
+        bb.warn("Buildfile specified, dependencies will not be handled. If this is not what you want, do not use -b / --buildfile.")
+
         # Parse the configuration here. We need to do it explicitly here since
         # buildFile() doesn't use the cache
         self.parseConfiguration()
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/6 bitbake: adjust comments/messages for default server change

In reply to Paul Eggleton

Default server is process, adjust comments and messages accordingly.

---
 bitbake/bin/bitbake |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
bitbake/bin/bitbake +3 -3
index f198fd1..8d6fef7 100755
@@ -172,8 +172,8 @@ Default BBFILES are the .bb files in the current directory.""")
 
     ui_main = get_ui(configuration)
 
-    # Server type could be xmlrpc or none currently, if nothing is specified,
-    # default server would be none
+    # Server type can be xmlrpc, process or none currently, if nothing is specified,
+    # the default server is process
     if configuration.servertype:
         server_type = configuration.servertype
     else:
@@ -184,7 +184,7 @@ Default BBFILES are the .bb files in the current directory.""")
         server = getattr(module, server_type)
     except AttributeError:
         sys.exit("FATAL: Invalid server type '%s' specified.\n"
-                 "Valid interfaces: xmlrpc, process, none [default]." % servertype)
+                 "Valid interfaces: xmlrpc, process [default], none." % servertype)
 
     # Save a logfile for cooker into the current working directory. When the
     # server is daemonized this logfile will be truncated.
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/6 bitbake-layers: check for errors before parsing

In reply to Paul Eggleton

Don't always parse on initialisation - instead check for errors and then parse when we know we need to. Avoids keeping the user waiting.

---
 bitbake/bin/bitbake-layers |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
bitbake/bin/bitbake-layers +9 -1
index 1c48c8c..56253f5 100755
@@ -48,7 +48,7 @@ class Commands(cmd.Cmd):
                                          self.register_idle_function)
         self.config_data = self.cooker.configuration.data
         bb.providers.logger.setLevel(logging.ERROR)
-        self.prepare_cooker()
+        self.cooker_data = None
 
     def register_idle_function(self, function, data):
         pass
@@ -71,10 +71,16 @@ class Commands(cmd.Cmd):
         self.cooker_data = self.cooker.status
         self.cooker_data.appends = self.cooker.appendlist
 
+    def check_prepare_cooker(self):
+        if not self.cooker_data:
+            self.prepare_cooker()
+
     def do_show_layers(self, args):
+        self.check_prepare_cooker()
         logger.info(str(self.config_data.getVar('BBLAYERS', True)))
 
     def do_show_overlayed(self, args):
+        self.check_prepare_cooker()
         if self.cooker.overlayed:
             logger.info('Overlayed recipes:')
             for f in self.cooker.overlayed.iterkeys():
@@ -94,6 +100,7 @@ class Commands(cmd.Cmd):
             logger.error('Directory %s exists and is non-empty, please clear it out first' % arglist[0])
             return
 
+        self.check_prepare_cooker()
         layers = (self.config_data.getVar('BBLAYERS', True) or "").split()
         for layer in layers:
             overlayed = []
@@ -143,6 +150,7 @@ class Commands(cmd.Cmd):
         recipefile.writelines(appendfile.readlines())
 
     def do_show_appends(self, args):
+        self.check_prepare_cooker()
         if not self.cooker_data.appends:
             logger.info('No append files found')
             return
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 5/6 bitbake-layers: add command help

In reply to Paul Eggleton

If you run "bitbake-layers help commandname" it now provides some useful help text.

---
 bitbake/bin/bitbake-layers |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)
bitbake/bin/bitbake-layers +31 -1
index 56253f5..746d79d 100755
@@ -76,10 +76,18 @@ class Commands(cmd.Cmd):
             self.prepare_cooker()
 
     def do_show_layers(self, args):
+        """show_layers: shows current configured layers"""
         self.check_prepare_cooker()
         logger.info(str(self.config_data.getVar('BBLAYERS', True)))
 
     def do_show_overlayed(self, args):
+        """show_overlayed: list overlayed recipes (where there is a recipe in another
+layer that has a higher layer priority)
+
+syntax: show_overlayed
+
+Highest priority recipes are listed with the recipes they overlay as subitems.
+"""
         self.check_prepare_cooker()
         if self.cooker.overlayed:
             logger.info('Overlayed recipes:')
@@ -91,9 +99,25 @@ class Commands(cmd.Cmd):
             logger.info('No overlayed recipes found')
 
     def do_flatten(self, args):
+        """flatten: flattens layer configuration into a separate output directory.
+
+syntax: flatten <outputdir>
+
+Takes the current layer configuration and builds a "flattened" directory
+containing the contents of all layers, with any overlayed recipes removed
+and bbappends appended to the corresponding recipes. Note that some manual
+cleanup may still be necessary afterwards, in particular:
+
+* where non-recipe files (such as patches) are overwritten (the flatten
+  command will show a warning for these)
+* where anything beyond the normal layer setup has been added to
+  layer.conf (only the lowest priority layer's layer.conf is used)
+* overridden/appended items from bbappends will need to be tidied up
+"""
         arglist = args.split()
         if len(arglist) != 1:
-            logger.error('syntax: flatten <outputdir>')
+            logger.error('Please specify an output directory')
+            self.do_help('flatten')
             return
 
         if os.path.exists(arglist[0]) and os.listdir(arglist[0]):
@@ -150,6 +174,12 @@ class Commands(cmd.Cmd):
         recipefile.writelines(appendfile.readlines())
 
     def do_show_appends(self, args):
+        """show_appends: List bbappend files and recipe files they apply to
+
+syntax: show_appends
+
+Recipes are listed with the bbappends that apply to them as subitems.
+"""
         self.check_prepare_cooker()
         if not self.cooker_data.appends:
             logger.info('No append files found')
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH 6/6 bitbake-layers: remove unneeded do_EOF

In reply to Paul Eggleton

do_EOF is only needed when using the Python cmd class in line-oriented mode - we are just sending single commands to it.

---
 bitbake/bin/bitbake-layers |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
bitbake/bin/bitbake-layers +0 -3
index 746d79d..3d563b5 100755
@@ -240,9 +240,6 @@ Recipes are listed with the bbappends that apply to them as subitems.
                 notappended.append(basename)
         return appended, notappended
 
-    def do_EOF(self, line):
-        return True
-
 
 class Config(object):
     def __init__(self, **options):
Signature · 1 line
1.7.4.1
#7 lore raw
In reply to Paul Eggleton
Quoted 7 lines · Paul Eggleton

Some minor usability-related fixes for bitbake and bitbake-layers.

The changes (against poky, apply against bitbake master with -p2) are available in the git repository at:
git://git.pokylinux.org/poky-contrib paule/bitbake-tweaks
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=paule/bitbake-tweaks

Quoted 7 lines

Paul Eggleton (6):
bitbake: add note to -b option indicating no dependency handling bitbake/cooker: show a warning when -b is specified
bitbake: adjust comments/messages for default server change
bitbake-layers: check for errors before parsing
bitbake-layers: add command help
bitbake-layers: remove unneeded do_EOF

Merged to master, thanks.

Richard