Patchwork [v2] scripts/combo-layer: a simple way to script the combo-layer conf

login
register
mail settings
Submitter Leandro Dorileo
Date Aug. 10, 2011, 5:09 a.m.
Message ID <1312952945-3415-1-git-send-email-ldorileo@gmail.com>
Download mbox | patch
Permalink /patch/9579/
State New, archived
Headers show

Comments

Leandro Dorileo - Aug. 10, 2011, 5:09 a.m.
This small patch introduces a a very simple and basic way to script
the combo-layer conf file. With that a combo can be shared with no
need to change its config - associated to the use of environment
variables for example.

*Similar* to bitbake it considers every value starting with @ to be
a python script. So local_repo could be easily configured as:

[bitbake]
local_repo = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"

or any more sophisticated python syntax.

This version updates the config file description so users can be
aware of.

Signed-off-by: Leandro Dorileo <ldorileo@gmail.com>
---
 scripts/combo-layer |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
Yu Ke - Aug. 10, 2011, 8:29 a.m.
Acked-by: Yu Ke <ke.yu@intel.com>

on 2011-8-10 13:09, Leandro Dorileo wrote:
> This small patch introduces a a very simple and basic way to script
> the combo-layer conf file. With that a combo can be shared with no
> need to change its config - associated to the use of environment
> variables for example.
>
> *Similar* to bitbake it considers every value starting with @ to be
> a python script. So local_repo could be easily configured as:
>
> [bitbake]
> local_repo = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"
>
> or any more sophisticated python syntax.
>
> This version updates the config file description so users can be
> aware of.
>
> Signed-off-by: Leandro Dorileo<ldorileo@gmail.com>
> ---
>   scripts/combo-layer |   13 ++++++++++++-
>   1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/combo-layer b/scripts/combo-layer
> index d129175..07b3382 100755
> --- a/scripts/combo-layer
> +++ b/scripts/combo-layer
> @@ -79,6 +79,14 @@ local_repo_dir = ~/src/oecore
>   dest_dir = .
>   last_revision =
>
> +# it's also possible to embed python code in the config values. Similar
> +# to bitbake it considers every value starting with @ to be a python script.
> +# So local_repo could be easily configured using an environment variable as:
> +#
> +# [bitbake]
> +# local_repo = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"
> +#
> +
>   # more components ...
>
>       """
> @@ -91,7 +99,10 @@ last_revision =
>           for repo in self.parser.sections():
>               self.repos[repo] = {}
>               for (name, value) in self.parser.items(repo):
> -                self.repos[repo][name] = value
> +                if value.startswith("@"):
> +                    self.repos[repo][name] = eval(value.strip("@"))
> +                else:
> +                    self.repos[repo][name] = value
>
>       def update(self, repo, option, value):
>           self.parser.set(repo, option, value)
Saul Wold - Aug. 11, 2011, 9:29 p.m.
On 08/09/2011 10:09 PM, Leandro Dorileo wrote:
> This small patch introduces a a very simple and basic way to script
> the combo-layer conf file. With that a combo can be shared with no
> need to change its config - associated to the use of environment
> variables for example.
>
> *Similar* to bitbake it considers every value starting with @ to be
> a python script. So local_repo could be easily configured as:
>
> [bitbake]
> local_repo = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"
>
> or any more sophisticated python syntax.
>
> This version updates the config file description so users can be
> aware of.
>
> Signed-off-by: Leandro Dorileo<ldorileo@gmail.com>
> ---
>   scripts/combo-layer |   13 ++++++++++++-
>   1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/combo-layer b/scripts/combo-layer
> index d129175..07b3382 100755
> --- a/scripts/combo-layer
> +++ b/scripts/combo-layer
> @@ -79,6 +79,14 @@ local_repo_dir = ~/src/oecore
>   dest_dir = .
>   last_revision =
>
> +# it's also possible to embed python code in the config values. Similar
> +# to bitbake it considers every value starting with @ to be a python script.
> +# So local_repo could be easily configured using an environment variable as:
> +#
> +# [bitbake]
> +# local_repo = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"
> +#
> +
>   # more components ...
>
>       """
> @@ -91,7 +99,10 @@ last_revision =
>           for repo in self.parser.sections():
>               self.repos[repo] = {}
>               for (name, value) in self.parser.items(repo):
> -                self.repos[repo][name] = value
> +                if value.startswith("@"):
> +                    self.repos[repo][name] = eval(value.strip("@"))
> +                else:
> +                    self.repos[repo][name] = value
>
>       def update(self, repo, option, value):
>           self.parser.set(repo, option, value)

Merged into OE-Core

Thanks
	Sau!

Patch

diff --git a/scripts/combo-layer b/scripts/combo-layer
index d129175..07b3382 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -79,6 +79,14 @@  local_repo_dir = ~/src/oecore
 dest_dir = .
 last_revision =
 
+# it's also possible to embed python code in the config values. Similar
+# to bitbake it considers every value starting with @ to be a python script. 
+# So local_repo could be easily configured using an environment variable as:
+#
+# [bitbake]
+# local_repo = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"
+#
+
 # more components ...
 
     """
@@ -91,7 +99,10 @@  last_revision =
         for repo in self.parser.sections():
             self.repos[repo] = {}
             for (name, value) in self.parser.items(repo):
-                self.repos[repo][name] = value
+                if value.startswith("@"):
+                    self.repos[repo][name] = eval(value.strip("@"))
+                else:
+                    self.repos[repo][name] = value
 
     def update(self, repo, option, value):
         self.parser.set(repo, option, value)