Skip to contentSkip to conversation

scripts/combo-layer: a simple way to script the combo-layer conf

PATCH Applied Leandro Dorileo 3 participants 3 messages Aug 10, 2011 – Aug 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scripts/combo-layer: a simple way to script the combo-layer conf

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.

---
 scripts/combo-layer |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
scripts/combo-layer +12 -1
index d129175..07b3382 100755
@@ -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)
Signature · 1 line
1.7.4.4
Acked-by on v2 1/1
#1 lore raw
Quoted 52 lines · Leandro Dorileo

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.

---
  scripts/combo-layer |   13 ++++++++++++-
  1 files changed, 12 insertions(+), 1 deletions(-)
scripts/combo-layer +12 -1
index d129175..07b3382 100755
@@ -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)
Applied
#2 lore raw
In reply to Leandro Dorileo
Quoted 42 lines · Leandro Dorileo

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.

---
  scripts/combo-layer |   13 ++++++++++++-
  1 files changed, 12 insertions(+), 1 deletions(-)
scripts/combo-layer +8 -0
index d129175..07b3382 100755
@@ -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():

scripts/combo-layer last_revision = · line 108

Quoted 10 lines
scripts/combo-layer +4 -1
              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!