summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-08-28 17:11:57 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2009-08-28 17:11:57 +0100
commitd5341fb7968108615da58d127655c8238a3e19b0 (patch)
tree0c5f9463a34d378c3da3e40ed81baa66b0785997
parent1937c08705b2e9fb209b2d703fec63b8c4421083 (diff)
downloadpoky-d5341fb7968108615da58d127655c8238a3e19b0.tar.gz
Add poky-trim-schemas post install script to remove unneeded schema locale translations from images (credit to Ross Burton for the initial script)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--meta-moblin/classes/moblin-image.bbclass2
-rw-r--r--meta/classes/image.bbclass12
-rwxr-xr-xscripts/poky-trim-schemas49
3 files changed, 63 insertions, 0 deletions
diff --git a/meta-moblin/classes/moblin-image.bbclass b/meta-moblin/classes/moblin-image.bbclass
index f742777ace..f9bab011b0 100644
--- a/meta-moblin/classes/moblin-image.bbclass
+++ b/meta-moblin/classes/moblin-image.bbclass
@@ -95,3 +95,5 @@ inherit image
95 95
96# Create /etc/timestamp during image construction to give a reasonably sane default time setting 96# Create /etc/timestamp during image construction to give a reasonably sane default time setting
97ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; " 97ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
98
99ROOTFS_POSTINSTALL_COMMAND += "rootfs_trim_schemas ; "
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 8225980f73..6b0a14d9ac 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -225,6 +225,18 @@ rootfs_no_x_startup () {
225 fi 225 fi
226} 226}
227 227
228rootfs_trim_schemas () {
229 for schema in ${IMAGE_ROOTFS}/etc/gconf/schemas/*.schemas
230 do
231 # Need this in case no files exist
232 if [ -e $schema ]; then
233 poky-trim-schemas $schema > $schema.new
234 mv $schema.new $schema
235 fi
236 done
237}
238
239
228# export the zap_root_password, create_etc_timestamp and remote_init_link 240# export the zap_root_password, create_etc_timestamp and remote_init_link
229EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup 241EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup
230 242
diff --git a/scripts/poky-trim-schemas b/scripts/poky-trim-schemas
new file mode 100755
index 0000000000..29fb3a1b67
--- /dev/null
+++ b/scripts/poky-trim-schemas
@@ -0,0 +1,49 @@
1#! /usr/bin/env python
2
3import sys
4try:
5 import xml.etree.cElementTree as etree
6except:
7 import xml.etree.ElementTree as etree
8
9def child (elem, name):
10 for e in elem.getchildren():
11 if e.tag == name:
12 return e
13 return None
14
15def children (elem, name=None):
16 l = elem.getchildren()
17 if name:
18 l = [e for e in l if e.tag == name]
19 return l
20
21xml = etree.parse(sys.argv[1])
22
23for schema in child(xml.getroot(), "schemalist").getchildren():
24 e = child(schema, "short")
25 if e is not None:
26 schema.remove(e)
27
28 e = child(schema, "long")
29 if e is not None:
30 schema.remove(e)
31
32 for locale in children(schema, "locale"):
33 # One locale must exist so leave C locale...
34 a = locale.attrib.get("name")
35 if a == 'C':
36 continue
37 e = child(locale, "default")
38 if e is None:
39 schema.remove(locale)
40 else:
41 e = child(locale, "short")
42 if e is not None:
43 locale.remove(e)
44 e = child(locale, "long")
45 if e is not None:
46 locale.remove(e)
47
48xml.write(sys.stdout, "UTF-8")
49