summaryrefslogtreecommitdiff
path: root/classes/nylon-helpers.bbclass
diff options
context:
space:
mode:
authorMartin Dietze <di@fh-wedel.de>2006-09-14 09:56:03 +0000
committerMartin Dietze <di@fh-wedel.de>2006-09-14 09:56:03 +0000
commit1d58db695441ef0d9de2e89b7b40df1ee83c3eb9 (patch)
treed403181e3a49a5ef6603910e5d0d997102f8bba8 /classes/nylon-helpers.bbclass
parent5f1bcd6c3fb39d1e3f64ba17958855d77bdb50bf (diff)
nylon: added nylon-helpers.bbclass (helper functions for working on the svn trunk), updated preferred providers in nylon.conf.
Diffstat (limited to 'classes/nylon-helpers.bbclass')
-rw-r--r--classes/nylon-helpers.bbclass35
1 files changed, 35 insertions, 0 deletions
diff --git a/classes/nylon-helpers.bbclass b/classes/nylon-helpers.bbclass
new file mode 100644
index 0000000000..1755d91d23
--- /dev/null
+++ b/classes/nylon-helpers.bbclass
@@ -0,0 +1,35 @@
+# ############################################################################
+# Helper functions for building packages from the trunk or branches. To use
+# this .bbclass simply inherit from it in your conf/local.conf.
+#
+# - get_branch() helps to construct the package name when fetching by
+# extracting the directory name above the "build" directory containing the
+# oe environment and bitbake. That directory name is usually the branch in
+# which the package is located in the svn with one exception: "unstable"
+# is synonymous for "trunk". In the package you can then use the ${BRANCH}
+# variable within the svn (or cvs) url for the package.
+#
+# - get_tomorrow() makes sure the latest version of a package is fetched. To
+# use it, set the SRCDATE to ${TOMORROW}.
+# ############################################################################
+
+def get_branch():
+ import commands, re
+ build = re.sub(r'/sources$', '', commands.getoutput('pwd'))
+ build = re.sub(r'/tmp/work.*$', '', build)
+ build = re.sub(r'/packages\.4g.*$', '', build)
+ if re.search(r'/trunk/[^/]+/?$', build):
+ return 'trunk'
+ if re.search(r'/unstable$', build):
+ return 'trunk'
+ if re.search(r'/testing$', build):
+ return 'testing'
+ return re.sub(r'^.*/([^/]+/[^/]+)/[^/]+/?$', r'\1', build)
+
+# end of get_branch
+
+def get_tomorrow():
+ import time
+ return time.strftime('%Y%m%d', time.gmtime(time.time() + 3600*24))
+
+# end of get_tomorrow