[hipl-commit] Re: [tiny] Rev 3509: Applied modularization concept on tiny branch.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 09 Mar 2010 16:10:05 +0100

I know this comes very late, but oh well, it was lying in my drafts
folder, so I thought I might as well finish and send it...

On Fri, Jan 29, 2010 at 04:20:03PM +0200, Tim Just wrote:
> 
> Log:
>   Applied modularization concept on tiny branch.
>   
>   Added the python script process_modules.py for mdule configuration.
>   
>   Created example module 'update' with original update code.
> 
> Modified:
>   A  modules/
>   A  modules/update/
>   A  modules/update/Makefile.am
>   A  modules/update/hipd/
>   A  modules/update/module_info.xml
>   A  process_modules.py
>   A  project_info.xml

I have a distinct feeling of total overkill.
Employing XML here feels like using a chainsaw to cut a matchstick..

> --- Makefile.am       2010-01-25 17:00:29 +0000
> +++ Makefile.am       2010-01-29 14:17:30 +0000
> @@ -322,6 +320,8 @@
>  
> +include Makefile.modules
> +
> 
> --- autogen.sh        2010-01-03 15:54:35 +0000
> +++ autogen.sh        2010-01-29 14:17:30 +0000
> @@ -77,6 +77,9 @@
>  
> +# Create empty file needed by automake. 
> +touch Makefile.modules

You can instead prefix the 'include' directive in Makefile.am with '-'.
This will let Make ignore errors.

> --- modules/update/Makefile.am        1970-01-01 00:00:00 +0000
> +++ modules/update/Makefile.am        2010-01-29 14:17:30 +0000
> @@ -0,0 +1,3 @@
> +lib_LTLIBRARIES += modules/update/hipd/libhipupdate.la
> +modules_update_hipd_libhipupdate_la_SOURCES = modules/update/hipd/update.c \
> +                                              
> modules/update/hipd/update_legacy.c
> \ No newline at end of file

You should avoid files not ending in newlines, they are a nuisance.
I guess this may already have been fixed.

> --- modules/update/module_info.xml    1970-01-01 00:00:00 +0000
> +++ modules/update/module_info.xml    2010-01-29 14:17:30 +0000
> @@ -0,0 +1,18 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<!-- Mandatory: name, version -->
> +<module
> +    name="update"
> +    version="0.0.1"
> +    description="Update functionality for the hip daemon."
> +    developer=""
> +    bugaddress="hipl-users@xxxxxxxxxxxxx"
> +    webpage="http://infrahip.hiit.fi/";>
> +
> +    <!-- Mandatory: name, header_file, init_function, linkcommand -->
> +    <application
> +        name="hipd"
> +        header_file="modules/update/hipd/update.h"
> +        init_function="update_init"
> +        linkcommand="hipd_hipd_LDADD += modules/update/hipd/libhipupdate.la" 
> />
> +</module>
> \ No newline at end of file

ditto

> 
> === added file 'process_modules.py'
> --- process_modules.py        1970-01-01 00:00:00 +0000
> +++ process_modules.py        2010-01-29 14:17:30 +0000
> @@ -0,0 +1,303 @@
> +#!/usr/bin/python
> +import glob, os, sys, xml.dom.minidom
> +
> +        app_info['header_file'] = 
> str(current_app.attributes['header_file'].value)
> +        app_info['init_function'] = 
> str(current_app.attributes['init_function'].value)
> +        app_info['linkcommand'] = 
> str(current_app.attributes['linkcommand'].value)

This would be more readable with the = aligned vertically.

> +# Checks the module_info data structure for missing dependencies and 
> conflicts
> +# between modules. Returns a  

Returns a - what?

> +def process_module_info(module_info):
> +    
> +# Creates a C header file with the given filename an the needed includes,

and

> +# Creates a file at file_path and includes a Makefile.am from all given 
> modules
> +# sub directories.        

Why not include them from the top-level Makefile.am directly?

> --- project_info.xml  1970-01-01 00:00:00 +0000
> +++ project_info.xml  2010-01-29 14:17:30 +0000
> @@ -0,0 +1,15 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<hipl>
> +    <application name="hipd" path="hidp/hipd" />

typo

Either this is untested or the value is ignored in which case one has to
wonder why it is there in the first place...

> +    <application name="hipfw" path="firewall/hipfw" />
> +    
> +    <!-- compile all code or only enabled modules (values: all/enabled) -->
> +    <compile_type>all</compile_type>
> +    
> +    <!-- 
> +    <disabled_modules>
> +        <module name="update" />
> +    </disabled_modules>
> +     -->
> +</hipl>

How are modules disabled?  From configure?

Diego

Other related posts: