Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Leandro Dorileo <ldorileo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Leandro Dorileo <ldorileo@gmail.com>
Subject: [PATCH v2] scripts/combo-layer: a simple way to script the combo-layer conf
Date: Wed, 10 Aug 2011 01:09:05 -0400	[thread overview]
Message-ID: <1312952945-3415-1-git-send-email-ldorileo@gmail.com> (raw)

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)
-- 
1.7.4.4




             reply	other threads:[~2011-08-10  5:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10  5:09 Leandro Dorileo [this message]
2011-08-10  8:29 ` [PATCH v2] scripts/combo-layer: a simple way to script the combo-layer conf Yu Ke
2011-08-11 21:29 ` Saul Wold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312952945-3415-1-git-send-email-ldorileo@gmail.com \
    --to=ldorileo@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox