Patchwork [bitbake-devel,0/1] Webhob: helper based on webservice

login
register
mail settings
Submitter Xiaotong lv
Date June 6, 2012, 9:58 a.m.
Message ID <cover.1338969711.git.xiaotongx.lv@intel.com>
Download mbox
Permalink /patch/29231/
State New
Headers show

Pull-request

git://git.yoctoproject.org/poky-contrib xtlv/webhob-webservice

Comments

Shane Wang - June 5, 2012, 12:42 p.m.
Xiaotong, I think you missed some patch.
When you say "clean up the code", what is your code base?

You should send out http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?h=xtlv/webhob-webservice&id=11eab3487db83bd1f4ca65de2767afbdc9958af0 first.


--
Shane

Xiaotong lv wrote on 2012-06-06:

> This helper is a bitbake ui, based on soaplib 1.0 lib to implement a
> webservice interface. I defined 2 webservice methods, they are
> runCommand(param) and getEvent(). Different languages can remotely call
> the 2 methods to communicate with bitbake. such as php, java, js, python
> and so on. 1. runCommand(param) method is responsible for sending
> commands to bitbake server.
>    the param format is:
>     {
>         'function'  : string            (required, function name)
>         'param_type': array(string)     (optional, params types, values
>         only are 'string', 'list' or 'bool') 'params'    : array(string)
>             (optional, string param
> corresponds to itself,
>                                                    list type corresponds
>                                                    to 'str1 str2 str3
>                                                    ....', bool type
> corresponds to  'true' or 'false'
>                                          )
>     }
>     
>     some examples:
>     1). to call bitbake server.runCommand(["initCooker"])
>         param style is:
> 	{
>            'function': 'initCokker'
> 	}
>     2). to call bitbake server.runCommand(["getVariable", "BBLAYERS"])
>         param style is:
>         {
>           'function'   : 'getVariable'
>           'param_type' : ['string']
>           'params'     : ['BBLASYERS']
>         }
>     3). to call bitbake server.runCommand(["buildTargets",
> list(recipe_queue), 'build'])
>         param style is:
>         {
>           'function'   : 'buildTargets'
>           'param_type' : ['list','string']
>           'params'     : ['recipe1 recipe2 recipe2 recipe4 ....', 'build']
>         }
> 2. getEvent() is respinsible for getting the event results generated by bitbake
> event objects, it returns a standard json format data.
>    some examples:
>    1)  to get some async configurations:
>       [{'event': 'ConfigFilesFound',
>        'values': 'poky-bleeding poky-lsb poky poky-tiny defaultsetup',
>        'variable': 'distro'},
>        {'event': 'CommandCompleted'}
>       ]
>       [{'event': 'ConfigFilesFound',
>         'values': 'atom-pc routerstationpro mpc8315e-rdb beagleboard
>         qemumips qemuarm qemux86-64 qemux86 qemuppc', 'variable':
>         'machine'}, {'event': 'CommandCompleted'} 'values': 'i586 x86_64
>         i686', 'variable': 'machine-sdk'},
>        {'event': 'CommandCompleted'}
>       ]
>       [{'event': 'FilesMatchingFound',
>         'matches': 'rootfs_rpm.bbclass rootfs_deb.bbclass
>         rootfs_ipk.bbclass', 'pattern': 'rootfs_'},
>        {'event': 'CommandCompleted'}
>       ]
>     2) some recipe progress values
>          [{'current': 24,
>           'event': 'TreeDataPreparationProgress', 'msg': 'Preparing tree
>           data: 24/1105', 'total': 1105}, {'current': 25, 'event':
>           'TreeDataPreparationProgress', 'msg': 'Preparing tree data:
>           25/1105', 'total': 1105}, {'current': 26, 'event':
>           'TreeDataPreparationProgress', 'msg': 'Preparing tree data:
>           26/1105', 'total': 1105}, {'current': 27, 'event':
>           'TreeDataPreparationProgress', 'msg': 'Preparing tree data:
>           27/1105', 'total': 1105}, {'current': 28, 'event':
>           'TreeDataPreparationProgress', 'msg': 'Preparing tree data:
>           28/1105', 'total': 1105}, {'current': 29, 'event':
>           'TreeDataPreparationProgress', 'msg': 'Preparing tree data:
>           29/1105', 'total': 1105}]
>     3) some task building values
>          [{'event': 'TaskSucceeded',
>           'message': 'package libpcre-native-8.21-r1: task
>           do_populate_sysroot: Succeeded', 'package':
>           'libpcre-native-8.21-r1', 'pid': 30382, 'task':
>           'do_populate_sysroot'}, {'event': 'runQueueTaskCompleted',
>           'pid': 0, 'taskid': 753, 'taskstring':
> 'virtual:native:/home/xiaotong/workspace/python/poky-contrib/meta/recipes
> -support/libpcre/libpcre_8.21.bb, do_populate_sysroot'},
>          {'event': 'runQueueTaskStarted',
>           'noexec': False,
>           'pid': 0,
>           'stats': {'active': 0, 'completed': 324, 'failed': 0},
>           'taskid': 709,
>           'taskstring':
> 'virtual:native:/home/xiaotong/workspace/python/poky-contrib/meta/recipes
> -support/db/db_5.1.19.bb, do_populate_sysroot'},
>          {'event': 'TaskStarted',
>           'message': 'package db-native-5.1.19-r4: task
>           do_populate_sysroot: Started', 'package':
>           'db-native-5.1.19-r4', 'pid': 30447,
> 
> The following changes since commit
> 11eab3487db83bd1f4ca65de2767afbdc9958af0:
> 
>   Webhob: a general helper interface based on webservice (2012-06-02
> 06:00:10 -0400)
> 
> are available in the git repository at:
>   git://git.yoctoproject.org/poky-contrib xtlv/webhob-webservice
> http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=xtlv/webhob-webs
> erv ice
> 
> Xiaotong lv (1):
>   Webhob: Clean up the code and	 modify some errors
>  bitbake/lib/bb/ui/crumbs/webserviceeventhandler.py |   20 ++++---
>  bitbake/lib/bb/ui/webhob_webservice.py             |   53
>  ++++++++----------- 2 files changed, 33 insertions(+), 40 deletions(-)
Xiaotong lv - June 6, 2012, 9:58 a.m.
This helper is a bitbake ui, based on soaplib 1.0 lib to implement a webservice interface.
I defined 2 webservice methods, they are runCommand(param) and getEvent().
Different languages can remotely call the 2 methods to communicate with bitbake. such as php, java, js, python and so on.
1. runCommand(param) method is responsible for sending commands to bitbake server.
   the param format is:
    {
        'function'  : string            (required, function name)
        'param_type': array(string)     (optional, params types, values only are 'string', 'list' or 'bool')
        'params'    : array(string)     (optional, string param corresponds to itself,
                                                   list type corresponds to 'str1 str2 str3 ....',
                                                   bool type corresponds to  'true' or 'false'
                                         )
    }

    some examples:
    1). to call bitbake server.runCommand(["initCooker"])
        param style is:
	{
           'function': 'initCokker'
	}
    2). to call bitbake server.runCommand(["getVariable", "BBLAYERS"])
        param style is:
        {
          'function'   : 'getVariable'
          'param_type' : ['string']
          'params'     : ['BBLASYERS']
        }
    3). to call bitbake server.runCommand(["buildTargets", list(recipe_queue), 'build'])
        param style is:
        {
          'function'   : 'buildTargets'
          'param_type' : ['list','string']
          'params'     : ['recipe1 recipe2 recipe2 recipe4 ....', 'build']
        }

2. getEvent() is respinsible for getting the event results generated by bitbake event objects, it returns a standard json format data.
   some examples:
   1)  to get some async configurations:
      [{'event': 'ConfigFilesFound',
       'values': 'poky-bleeding poky-lsb poky poky-tiny defaultsetup',
       'variable': 'distro'},
       {'event': 'CommandCompleted'}
      ]
      [{'event': 'ConfigFilesFound',
        'values': 'atom-pc routerstationpro mpc8315e-rdb beagleboard qemumips qemuarm qemux86-64 qemux86 qemuppc',
        'variable': 'machine'},
       {'event': 'CommandCompleted'}
        'values': 'i586 x86_64 i686',
        'variable': 'machine-sdk'},
       {'event': 'CommandCompleted'}
      ]
      [{'event': 'FilesMatchingFound',
        'matches': 'rootfs_rpm.bbclass rootfs_deb.bbclass rootfs_ipk.bbclass',
        'pattern': 'rootfs_'},
       {'event': 'CommandCompleted'}
      ]

    2) some recipe progress values
         [{'current': 24,
          'event': 'TreeDataPreparationProgress',
          'msg': 'Preparing tree data: 24/1105',
          'total': 1105},
         {'current': 25,
          'event': 'TreeDataPreparationProgress',
          'msg': 'Preparing tree data: 25/1105',
          'total': 1105},
         {'current': 26,
          'event': 'TreeDataPreparationProgress',
          'msg': 'Preparing tree data: 26/1105',
          'total': 1105},
         {'current': 27,
          'event': 'TreeDataPreparationProgress',
          'msg': 'Preparing tree data: 27/1105',
          'total': 1105},
         {'current': 28,
          'event': 'TreeDataPreparationProgress',
          'msg': 'Preparing tree data: 28/1105',
          'total': 1105},
         {'current': 29,
          'event': 'TreeDataPreparationProgress',
          'msg': 'Preparing tree data: 29/1105',
          'total': 1105}]

    3) some task building values
         [{'event': 'TaskSucceeded',
          'message': 'package libpcre-native-8.21-r1: task do_populate_sysroot: Succeeded',
          'package': 'libpcre-native-8.21-r1',
          'pid': 30382,
          'task': 'do_populate_sysroot'},
         {'event': 'runQueueTaskCompleted',
          'pid': 0,
          'taskid': 753,
          'taskstring': 'virtual:native:/home/xiaotong/workspace/python/poky-contrib/meta/recipes-support/libpcre/libpcre_8.21.bb, do_populate_sysroot'},
         {'event': 'runQueueTaskStarted',
          'noexec': False,
          'pid': 0,
          'stats': {'active': 0, 'completed': 324, 'failed': 0},
          'taskid': 709,
          'taskstring': 'virtual:native:/home/xiaotong/workspace/python/poky-contrib/meta/recipes-support/db/db_5.1.19.bb, do_populate_sysroot'},
         {'event': 'TaskStarted',
          'message': 'package db-native-5.1.19-r4: task do_populate_sysroot: Started',
          'package': 'db-native-5.1.19-r4',
          'pid': 30447,


The following changes since commit 11eab3487db83bd1f4ca65de2767afbdc9958af0:

  Webhob: a general helper interface based on webservice (2012-06-02 06:00:10 -0400)

are available in the git repository at:
  git://git.yoctoproject.org/poky-contrib xtlv/webhob-webservice
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=xtlv/webhob-webservice

Xiaotong lv (1):
  Webhob: Clean up the code and	 modify some errors

 bitbake/lib/bb/ui/crumbs/webserviceeventhandler.py |   20 ++++---
 bitbake/lib/bb/ui/webhob_webservice.py             |   53 ++++++++-----------
 2 files changed, 33 insertions(+), 40 deletions(-)