diff options
author | Richard Purdie <richard@openedhand.com> | 2008-08-25 20:53:13 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-08-25 20:53:13 +0000 |
commit | 15af82a09f33360ba365c0da9ead24d15959f985 (patch) | |
tree | bbda03aeafed765a0b9fd35bfb6f7cff09ca9f83 /meta/classes/rootfs_rpm.bbclass | |
parent | 317a8473c9101e967fd1693dbc36b8d56aaddf34 (diff) | |
download | poky-15af82a09f33360ba365c0da9ead24d15959f985.tar.gz |
Add rootfs_rpm.bbclass, a start at image generation from rpms. Its not expected to be entirely functional yet.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5101 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/rootfs_rpm.bbclass')
-rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass new file mode 100644 index 0000000000..83ceccf4f5 --- /dev/null +++ b/meta/classes/rootfs_rpm.bbclass | |||
@@ -0,0 +1,148 @@ | |||
1 | # | ||
2 | # Creates a root filesystem out of rpm packages | ||
3 | # | ||
4 | |||
5 | ROOTFS_PKGMANAGE = "opkg" | ||
6 | # "rpm" "yum" | ||
7 | ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts" | ||
8 | |||
9 | do_rootfs[depends] += "rpm-native:do_populate_staging yum-native:do_populate_staging createrepo-native:do_populate_staging fakechroot-native:do_populate_staging" | ||
10 | do_rootfs[recrdeptask] += "do_package_write_rpm" | ||
11 | |||
12 | YUMCONF = "${IMAGE_ROOTFS}/etc/yum.conf" | ||
13 | YUMARGS = "-c ${YUMCONF} --installroot ${IMAGE_ROOTFS}" | ||
14 | |||
15 | fakeroot rootfs_rpm_do_rootfs () { | ||
16 | set -x | ||
17 | |||
18 | # Update the repository index | ||
19 | createrepo ${DEPLOY_DIR_RPM} | ||
20 | |||
21 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ | ||
22 | #echo "arm" > ${IMAGE_ROOTFS}/etc/rpm/platform | ||
23 | |||
24 | # Copy the packages into the target image | ||
25 | # Ugly ugly ugly but rpm is braindead and can't see outside the chroot | ||
26 | # when installing :( | ||
27 | mkdir -p ${IMAGE_ROOTFS}${DEPLOY_DIR_RPM} | ||
28 | cp -r ${DEPLOY_DIR_RPM}/* ${IMAGE_ROOTFS}${DEPLOY_DIR_RPM}/ | ||
29 | |||
30 | # Generate an apprpriate yum.conf | ||
31 | rm -rf ${YUMCONF} | ||
32 | cat > ${YUMCONF} << EOF | ||
33 | [main] | ||
34 | cachedir=/var/cache2/yum | ||
35 | keepcache=1 | ||
36 | debuglevel=10 | ||
37 | logfile=/var/log2/yum.log | ||
38 | exactarch=0 | ||
39 | obsoletes=1 | ||
40 | tolerant=1 | ||
41 | arch=arm | ||
42 | basearch=arm | ||
43 | |||
44 | [poky-feed] | ||
45 | name = Poky RPM Feed | ||
46 | baseurl=file://${DEPLOY_DIR_RPM} | ||
47 | gpgcheck=0 | ||
48 | |||
49 | EOF | ||
50 | #mkdir -p ${IMAGE_ROOTFS}/var/lib/rpm | ||
51 | #rpm --root ${IMAGE_ROOTFS} --initdb | ||
52 | #rpm --root ${IMAGE_ROOTFS} --dbpath ${IMAGE_ROOTFS}/var/lib/rpm -ihv --nodeps --ignoreos | ||
53 | #rpm -ihv --root ${IMAGE_ROOTFS} ${PACKAGE_INSTALL} | ||
54 | |||
55 | #package_update_index_rpm | ||
56 | #package_generate_ipkg_conf | ||
57 | |||
58 | # Uclibc builds don't provide this stuff... | ||
59 | if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then | ||
60 | if [ ! -z "${LINGUAS_INSTALL}" ]; then | ||
61 | for i in ${LINGUAS_INSTALL}; do | ||
62 | fakechroot yum ${YUMARGS} -y install $i | ||
63 | done | ||
64 | fi | ||
65 | fi | ||
66 | if [ ! -z "${PACKAGE_INSTALL}" ]; then | ||
67 | fakechroot yum ${YUMARGS} -y install ${PACKAGE_INSTALL} | ||
68 | fi | ||
69 | |||
70 | #export D=${IMAGE_ROOTFS} | ||
71 | #export OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
72 | #export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
73 | #export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT} | ||
74 | |||
75 | #mkdir -p ${IMAGE_ROOTFS}/etc/opkg/ | ||
76 | #grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/opkg/arch.conf | ||
77 | |||
78 | ${ROOTFS_POSTINSTALL_COMMAND} | ||
79 | |||
80 | #for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.preinst; do | ||
81 | # if [ -f $i ] && ! sh $i; then | ||
82 | # opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .preinst` | ||
83 | # fi | ||
84 | #done | ||
85 | #for i in ${IMAGE_ROOTFS}${libdir}/opkg/info/*.postinst; do | ||
86 | # if [ -f $i ] && ! sh $i configure; then | ||
87 | # opkg-cl ${IPKG_ARGS} flag unpacked `basename $i .postinst` | ||
88 | # fi | ||
89 | #done | ||
90 | |||
91 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
92 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
93 | |||
94 | ${ROOTFS_POSTPROCESS_COMMAND} | ||
95 | |||
96 | rm -rf ${IMAGE_ROOTFS}/var/cache2/ | ||
97 | rm -rf ${IMAGE_ROOTFS}/var/run2/ | ||
98 | rm -rf ${IMAGE_ROOTFS}/var/log2/ | ||
99 | |||
100 | log_check rootfs | ||
101 | } | ||
102 | |||
103 | rootfs_rpm_log_check() { | ||
104 | target="$1" | ||
105 | lf_path="$2" | ||
106 | |||
107 | lf_txt="`cat $lf_path`" | ||
108 | for keyword_die in "Cannot find package" "exit 1" ERR Fail | ||
109 | do | ||
110 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1 | ||
111 | then | ||
112 | echo "log_check: There were error messages in the logfile" | ||
113 | echo -e "log_check: Matched keyword: [$keyword_die]\n" | ||
114 | echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" | ||
115 | echo "" | ||
116 | do_exit=1 | ||
117 | fi | ||
118 | done | ||
119 | test "$do_exit" = 1 && exit 1 | ||
120 | true | ||
121 | } | ||
122 | |||
123 | remove_packaging_data_files() { | ||
124 | rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg/ | ||
125 | } | ||
126 | |||
127 | install_all_locales() { | ||
128 | |||
129 | PACKAGES_TO_INSTALL="" | ||
130 | |||
131 | INSTALLED_PACKAGES=`grep ^Package: ${IMAGE_ROOTFS}${libdir}/opkg/status |sed "s/^Package: //"|egrep -v -- "(-locale-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)"` | ||
132 | |||
133 | for pkg in $INSTALLED_PACKAGES | ||
134 | do | ||
135 | for lang in ${IMAGE_LOCALES} | ||
136 | do | ||
137 | if [ `opkg-cl ${IPKG_ARGS} info $pkg-locale-$lang | wc -l` -gt 2 ] | ||
138 | then | ||
139 | PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $pkg-locale-$lang" | ||
140 | fi | ||
141 | done | ||
142 | done | ||
143 | if [ "$PACKAGES_TO_INSTALL" != "" ] | ||
144 | then | ||
145 | opkg-cl ${IPKG_ARGS} install $PACKAGES_TO_INSTALL | ||
146 | fi | ||
147 | } | ||
148 | |||