]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/classes/image_ipk.bbclass
familiar: rework feed handling. add config files for v0.8.4(-rc*).
[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_LOCALE_FEEDS_PREFIXES ?= ""
57 DISTRO_LOCALE_FEEDS_HEADER ?= ""
58
59 python __anonymous() {
60         prefixes = bb.data.getVar("DISTRO_LOCALE_FEEDS_PREFIXES", d, 1).split()
61         locale_feeds = bb.data.getVar("DISTRO_LOCALE_FEEDS_HEADER", d, 1)
62
63         # add template
64         locale_feeds += "# For each supported locale there is a subfeed in each of the feed folders.\n"
65         locale_feeds += "# You can use your webbrowser to check for valid locale codes.\n\n"
66         locale_feeds += "# To point ipkg at packages for your locale, replace <my_locale> with the\n"
67         locale_feeds += "# locale code in the template below and remove the leading '#' characters.\n\n"
68         for p in prefixes:
69                 locale_feeds += "# src/gz %s-locale-<my_locale> %s/locale/<my_locale>\n" % (p.split('/')[-1], p)
70         
71         # add feed for each IMAGE_LINGUA
72         linguas = bb.data.getVar("IMAGE_LINGUAS", d, 1).split()
73         for l in linguas:
74                 fst = l.split('-')[0]
75                 locale_feeds += "\n# %s locale feeds\n" % fst
76                 for p in prefixes:
77                         locale_feeds += "src/gz %s-locale-%s %s/locale/%s\n" % (p.split('/')[-1], fst, p, fst)
78         
79         bb.data.setVar("DISTRO_LOCALE_FEEDS", locale_feeds, d)
80 }
81
82 insert_feed_uris () {
83         
84         echo "Building feeds for [${DISTRO}].."
85                 
86         for line in ${FEED_URIS}
87         do
88                 # strip leading and trailing spaces/tabs, then split into name and uri
89                 line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`"
90                 feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`"
91                 feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`"                                        
92                 
93                 echo "Added $feed_name feed with URL $feed_uri"
94                 
95                 # insert new feed-sources
96                 echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf
97         done                    
98
99         if [ -z ${FEED_URIS} ]; then
100 cat > ${IMAGE_ROOTFS}/etc/ipkg/${DISTRO}-${DISTRO_VERSION}-feeds.conf <<EOF
101 ${DISTRO_FEEDS}
102 EOF
103
104 cat > ${IMAGE_ROOTFS}/etc/ipkg/${DISTRO}-${DISTRO_VERSION}-locale-feeds.conf <<EOF
105 ${DISTRO_LOCALE_FEEDS}
106 EOF
107         fi
108 }