Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2010-09-07 16:16:11 (GMT)
committer Daniel Drake <dsd@laptop.org>2010-09-07 19:48:40 (GMT)
commit313587c084f35b38a460380ee1bf945ef7303c12 (patch)
treeac1d161677f45901491560a4191888126283eec8 /lib
parent8f93409657503957e3e41b091430fbf657dbc706 (diff)
Support customization of image name
In Nicaragua I realised that we'd like to retain the old naming scheme of having e.g. nic802-2 Allow a template to be specified in the build config that allows for this.
Diffstat (limited to 'lib')
-rw-r--r--lib/ooblib.py10
-rw-r--r--lib/shlib.sh5
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/ooblib.py b/lib/ooblib.py
index 076f371..69e0ddc 100644
--- a/lib/ooblib.py
+++ b/lib/ooblib.py
@@ -25,6 +25,16 @@ def read_config_bool(module, option):
return None
return bool(int(os.environ[vname]))
+def read_buildnr():
+ buildnr_path = os.path.join(intermediatesdir, 'buildnr')
+ if not os.path.isfile(buildnr_path):
+ return "0"
+ return open(buildnr_path, "r").readline().strip()
+
+def image_name():
+ name_tmpl = read_config('global', 'image_name')
+ return name_tmpl % int(read_buildnr())
+
def add_packages_from_xml(fd, pkglist):
et = ElementTree(file=fd)
root = et.getroot()
diff --git a/lib/shlib.sh b/lib/shlib.sh
index 1a605ed..0d23985 100644
--- a/lib/shlib.sh
+++ b/lib/shlib.sh
@@ -26,3 +26,8 @@ read_buildnr() {
fi
}
+image_name() {
+ local name_tmpl=$(read_config global image_name)
+ printf $name_tmpl $(read_buildnr)
+}
+