diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2011-01-30 12:26:14 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-01 23:59:37 +0000 |
commit | f23e67f172c4e5d39b91edd3c91a55bfcf346192 (patch) | |
tree | be8bfb26aa4c447ffa5e19b7d1f7a2d698d6ee0d /meta/classes/rootfs_deb.bbclass | |
parent | cc0b8f491f35c15f989a493b6ed7699b8e8152bf (diff) | |
download | poky-f23e67f172c4e5d39b91edd3c91a55bfcf346192.tar.gz |
rootfs_deb/package_deb.bbclass: move func from rootfs_deb to package_deb
package_deb.bbclass:
1. Added new function package_update_index_deb() to generate package
index files.
2. Added new function package_install_internal_deb() to install a list
deb packages to a specified root directory, with the specified package
architecutre information.
rootfs_deb.bbclass:
Used the above new functions to install the rootfs.
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'meta/classes/rootfs_deb.bbclass')
-rw-r--r-- | meta/classes/rootfs_deb.bbclass | 91 |
1 files changed, 16 insertions, 75 deletions
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass index 1335e719f4..e03e80bdb0 100644 --- a/meta/classes/rootfs_deb.bbclass +++ b/meta/classes/rootfs_deb.bbclass | |||
@@ -12,50 +12,29 @@ opkglibdir = "${localstatedir}/lib/opkg" | |||
12 | 12 | ||
13 | fakeroot rootfs_deb_do_rootfs () { | 13 | fakeroot rootfs_deb_do_rootfs () { |
14 | set +e | 14 | set +e |
15 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/info | ||
16 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/updates | ||
17 | 15 | ||
18 | rm -f ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev | ||
19 | rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences | ||
20 | > ${IMAGE_ROOTFS}/var/dpkg/status | ||
21 | > ${IMAGE_ROOTFS}/var/dpkg/available | ||
22 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/alternatives | 16 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/alternatives |
23 | 17 | ||
24 | priority=1 | 18 | # update index |
25 | for arch in ${PACKAGE_ARCHS}; do | 19 | package_update_index_deb |
26 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | 20 | |
27 | continue; | 21 | #install packages |
28 | fi | 22 | export INSTALL_ROOTFS_DEB="${IMAGE_ROOTFS}" |
29 | cd ${DEPLOY_DIR_DEB}/$arch | 23 | export INSTALL_BASEARCH_DEB="${DPKG_ARCH}" |
30 | # if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then | 24 | export INSTALL_ARCHS_DEB="${PACKAGE_ARCHS}" |
31 | rm -f Packages.gz Packages Packages.bz2 | 25 | export INSTALL_PACKAGES_NORMAL_DEB="${PACKAGE_INSTALL}" |
32 | # fi | 26 | export INSTALL_PACKAGES_ATTEMPTONLY_DEB="${PACKAGE_INSTALL_ATTEMPTONLY}" |
33 | dpkg-scanpackages . | bzip2 > Packages.bz2 | 27 | export INSTALL_PACKAGES_LINGUAS_DEB="${LINGUAS_INSTALL}" |
34 | echo "Label: $arch" > Release | 28 | export INSTALL_TASK_DEB="rootfs" |
35 | |||
36 | echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev | ||
37 | (echo "Package: *" | ||
38 | echo "Pin: release l=$arch" | ||
39 | echo "Pin-Priority: $(expr 800 + $priority)" | ||
40 | echo) >> ${STAGING_ETCDIR_NATIVE}/apt/preferences | ||
41 | priority=$(expr $priority + 5) | ||
42 | done | ||
43 | 29 | ||
44 | tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list | 30 | package_install_internal_deb |
45 | 31 | ||
46 | cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \ | ||
47 | | sed -e 's#Architecture ".*";#Architecture "${DPKG_ARCH}";#' \ | ||
48 | | sed -e 's:#ROOTFS#:${IMAGE_ROOTFS}:g' \ | ||
49 | > "${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" | ||
50 | 32 | ||
51 | export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" | ||
52 | export D=${IMAGE_ROOTFS} | 33 | export D=${IMAGE_ROOTFS} |
53 | export OFFLINE_ROOT=${IMAGE_ROOTFS} | 34 | export OFFLINE_ROOT=${IMAGE_ROOTFS} |
54 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | 35 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} |
55 | export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | 36 | export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} |
56 | 37 | ||
57 | apt-get update | ||
58 | |||
59 | _flag () { | 38 | _flag () { |
60 | sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/dpkg/status | 39 | sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/dpkg/status |
61 | } | 40 | } |
@@ -63,47 +42,6 @@ fakeroot rootfs_deb_do_rootfs () { | |||
63 | cat ${IMAGE_ROOTFS}/var/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" | 42 | cat ${IMAGE_ROOTFS}/var/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" |
64 | } | 43 | } |
65 | 44 | ||
66 | if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then | ||
67 | if [ ! -z "${LINGUAS_INSTALL}" ]; then | ||
68 | apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated | ||
69 | if [ $? -ne 0 ]; then | ||
70 | exit 1 | ||
71 | fi | ||
72 | for i in ${LINGUAS_INSTALL}; do | ||
73 | apt-get install $i --force-yes --allow-unauthenticated | ||
74 | if [ $? -ne 0 ]; then | ||
75 | exit 1 | ||
76 | fi | ||
77 | done | ||
78 | fi | ||
79 | fi | ||
80 | |||
81 | if [ ! -z "${PACKAGE_INSTALL}" ]; then | ||
82 | for i in ${PACKAGE_INSTALL}; do | ||
83 | apt-get install $i --force-yes --allow-unauthenticated | ||
84 | if [ $? -ne 0 ]; then | ||
85 | exit 1 | ||
86 | fi | ||
87 | done | ||
88 | fi | ||
89 | |||
90 | rm ${WORKDIR}/temp/log.do_$target-attemptonly.${PID} | ||
91 | if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then | ||
92 | for i in ${PACKAGE_INSTALL_ATTEMPTONLY}; do | ||
93 | apt-get install $i --force-yes --allow-unauthenticated >> ${WORKDIR}/temp/log.do_rootfs-attemptonly.${PID} || true | ||
94 | done | ||
95 | fi | ||
96 | |||
97 | find ${IMAGE_ROOTFS} -name \*.dpkg-new | for i in `cat`; do | ||
98 | mv $i `echo $i | sed -e's,\.dpkg-new$,,'` | ||
99 | done | ||
100 | |||
101 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
102 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
103 | |||
104 | # Mark all packages installed | ||
105 | sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${IMAGE_ROOTFS}/var/dpkg/status | ||
106 | |||
107 | # Attempt to run preinsts | 45 | # Attempt to run preinsts |
108 | # Mark packages with preinst failures as unpacked | 46 | # Mark packages with preinst failures as unpacked |
109 | for i in ${IMAGE_ROOTFS}/var/dpkg/info/*.preinst; do | 47 | for i in ${IMAGE_ROOTFS}/var/dpkg/info/*.preinst; do |
@@ -122,6 +60,9 @@ fakeroot rootfs_deb_do_rootfs () { | |||
122 | 60 | ||
123 | set -e | 61 | set -e |
124 | 62 | ||
63 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
64 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
65 | |||
125 | # Hacks to allow opkg's update-alternatives and opkg to coexist for now | 66 | # Hacks to allow opkg's update-alternatives and opkg to coexist for now |
126 | mkdir -p ${IMAGE_ROOTFS}${opkglibdir} | 67 | mkdir -p ${IMAGE_ROOTFS}${opkglibdir} |
127 | if [ -e ${IMAGE_ROOTFS}/var/dpkg/alternatives ]; then | 68 | if [ -e ${IMAGE_ROOTFS}/var/dpkg/alternatives ]; then |
@@ -133,7 +74,7 @@ fakeroot rootfs_deb_do_rootfs () { | |||
133 | 74 | ||
134 | ${ROOTFS_POSTPROCESS_COMMAND} | 75 | ${ROOTFS_POSTPROCESS_COMMAND} |
135 | 76 | ||
136 | log_check rootfs | 77 | log_check rootfs |
137 | } | 78 | } |
138 | 79 | ||
139 | remove_packaging_data_files() { | 80 | remove_packaging_data_files() { |