]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/classes/image_ipk.bbclass
bb99c12a1b1f3746b731e4ac11d9be706550e707
[familiar-h63xx-build.git] / org.handhelds.familiar / classes / image_ipk.bbclass
1 inherit rootfs_ipk
2
3 # Images are generally built explicitly, do not need to be part of world.
4 EXCLUDE_FROM_WORLD = "1"
5
6 USE_DEVFS ?= "0"
7
8 DEPENDS += "makedevs-native"
9
10 def get_image_deps(d):
11         import bb
12         str = ""
13         for type in (bb.data.getVar('IMAGE_FSTYPES', d, 1) or "").split():
14                 deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or ""
15                 if deps:
16                         str += " %s" % deps
17         return str
18
19 DEPENDS += "${@get_image_deps(d)}"
20
21 IMAGE_DEVICE_TABLE ?= "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-minimal.txt')}"
22 IMAGE_POSTPROCESS_COMMAND ?= ""
23
24 # Must call real_do_rootfs() from inside here, rather than as a separate
25 # task, so that we have a single fakeroot context for the whole process.
26 fakeroot do_rootfs () {
27         set -x
28         rm -rf ${IMAGE_ROOTFS}
29
30         if [ "${USE_DEVFS}" != "1" ]; then
31                 mkdir -p ${IMAGE_ROOTFS}/dev
32                 makedevs -r ${IMAGE_ROOTFS} -D ${IMAGE_DEVICE_TABLE}
33         fi
34
35         real_do_rootfs
36
37         insert_feed_uris        
38
39         rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/oe
40         
41         ${IMAGE_PREPROCESS_COMMAND}
42                 
43         export TOPDIR=${TOPDIR}
44
45         for type in ${IMAGE_FSTYPES}; do
46                 if test -z "$FAKEROOTKEY"; then
47                         fakeroot -i ${TMPDIR}/fakedb.image bbimage -t $type -e ${FILE}
48                 else
49                         bbimage -n "${IMAGE_NAME}" -t "$type" -e "${FILE}"
50                 fi
51         done
52
53         ${IMAGE_POSTPROCESS_COMMAND}
54 }
55
56 DISTRO_FEEDS_FILE_PATTERN = "${IMAGE_ROOTFS}/etc/ipkg/${DISTRO}-${DISTRO_VERSION}-%s.conf"
57
58 python __anonymous() {
59         m = bb.data.getVar("MACHINE", d, 1)
60         pattern = bb.data.getVar("DISTRO_FEEDS_FILE_PATTERN", d, 1)
61         pfx = bb.data.getVar("DISTRO_FEEDS_PREFIX", d, 1)
62         cs = bb.data.getVar("DISTRO_FEEDS_COLLECTIONS", d, 1).split()
63         
64         cmds = ""
65         for c in cs:
66                 file = pattern % c
67                 cmds += "cat > %s <<EOF\n" % file
68
69                 desc = bb.data.getVar("DISTRO_FEEDS_COLLECTION_DESC_%s" % c, d, 1)
70                 cmds += "# %s\n\n" % desc
71
72                 feeds = bb.data.getVar("DISTRO_FEEDS_IN_%s" % c, d, 1).split()
73                 for f in feeds:
74                         desc = bb.data.getVar("DISTRO_FEEDS_FEED_DESC_%s" % f, d, 1)
75                         cmds += "# %s - %s\n" % (f, desc)
76                         cmds += "src/gz %s %s/%s/%s\n" % (f, pfx, c, f)
77                         cmds += "src/gz %s-%s %s/%s/%s/machine/%s\n\n" % (f, m, pfx, c, f, m)
78
79                 # locale subfeeds
80
81                 # add template
82                 cmds += "\n# For each supported locale there is a subfeed in each of the feed folders.\n"
83                 cmds += "# You can use your webbrowser to check for valid locale codes.\n\n"
84                 cmds += "# To point ipkg at packages for your locale, replace <my_locale> with the\n"
85                 cmds += "# locale code in the template below and remove the leading '#' characters.\n\n"
86                 for f in feeds:
87                         cmds += "# src/gz %s-locale-<my_locale> %s/%s/%s/locale/<my_locale>\n" % (f, pfx, c, f)
88                 
89                 # add feed for each IMAGE_LINGUA
90                 linguas = bb.data.getVar("IMAGE_LINGUAS", d, 1).split()
91                 for l in linguas:
92                         fst = l.split('-')[0]
93                         cmds += "\n# %s locale feeds\n" % fst
94                         for f in feeds:
95                                 cmds += "src/gz %s-locale-%s %s/%s/%s/locale/%s\n" % (f, fst, pfx, c, f, fst)
96                 
97                 cmds += "\nEOF\n"
98
99         bb.data.setVar("DISTRO_FEEDS_COMMANDS", cmds, d)
100 }
101
102 insert_feed_uris () {
103         
104         echo "Building feeds for [${DISTRO}].."
105                 
106 ${DISTRO_FEEDS_COMMANDS}
107
108         mkdir -p ${DEPLOY_DIR}/ipkg_confs/${MACHINE}
109         cp -f ${IMAGE_ROOTFS}/etc/ipkg/*conf ${DEPLOY_DIR}/ipkg_confs/${MACHINE}
110 }