summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_deb.bbclass
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2011-01-30 12:26:14 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-01 23:59:37 +0000
commitf23e67f172c4e5d39b91edd3c91a55bfcf346192 (patch)
treebe8bfb26aa4c447ffa5e19b7d1f7a2d698d6ee0d /meta/classes/package_deb.bbclass
parentcc0b8f491f35c15f989a493b6ed7699b8e8152bf (diff)
downloadpoky-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/package_deb.bbclass')
-rw-r--r--meta/classes/package_deb.bbclass125
1 files changed, 125 insertions, 0 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 2181ce7c22..52bd264ead 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -67,6 +67,131 @@ python do_package_deb_install () {
67 os.putenv('PATH', path) 67 os.putenv('PATH', path)
68} 68}
69 69
70#
71# Update the Packages index files in ${DEPLOY_DIR_DEB}
72#
73package_update_index_deb () {
74
75 local debarchs=""
76
77 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
78 return
79 fi
80
81 for arch in ${PACKAGE_ARCHS}; do
82 sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
83 if [ -e ${DEPLOY_DIR_DEB}/$arch ]; then
84 debarchs="$debarchs $arch"
85 fi
86 if [ -e ${DEPLOY_DIR_DEB}/$sdkarch-nativesdk ]; then
87 debarchs="$debarchs $sdkarch-nativesdk"
88 fi
89 done
90
91 for arch in $debarchs; do
92 if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
93 continue;
94 fi
95 cd ${DEPLOY_DIR_DEB}/$arch
96 dpkg-scanpackages . | bzip2 > Packages.bz2
97 echo "Label: $arch" > Release
98 done
99}
100
101#
102# install a bunch of packages using apt
103# the following shell variables needs to be set before calling this func:
104# INSTALL_ROOTFS_DEB - install root dir
105# INSTALL_BASEARCH_DEB - install base architecutre
106# INSTALL_ARCHS_DEB - list of available archs
107# INSTALL_PACKAGES_NORMAL_DEB - packages to be installed
108# INSTALL_PACKAGES_ATTEMPTONLY_DEB - packages attemped to be installed only
109# INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc
110# INSTALL_TASK_DEB - task name
111
112package_install_internal_deb () {
113
114 local target_rootfs="${INSTALL_ROOTFS_DEB}"
115 local dpkg_arch="${INSTALL_BASEARCH_DEB}"
116 local archs="${INSTALL_ARCHS_DEB}"
117 local package_to_install="${INSTALL_PACKAGES_NORMAL_DEB}"
118 local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_DEB}"
119 local package_lingusa="${INSTALL_PACKAGES_LINGUAS_DEB}"
120 local task="${INSTALL_TASK_DEB}"
121
122 rm -f ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev
123 rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences
124
125 priority=1
126 for arch in $archs; do
127 if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
128 continue;
129 fi
130
131 echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev
132 (echo "Package: *"
133 echo "Pin: release l=$arch"
134 echo "Pin-Priority: $(expr 800 + $priority)"
135 echo) >> ${STAGING_ETCDIR_NATIVE}/apt/preferences
136 priority=$(expr $priority + 5)
137 done
138
139 tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list
140
141 cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \
142 | sed -e "s#Architecture \".*\";#Architecture \"${dpkg_arch}\";#" \
143 | sed -e "s:#ROOTFS#:${target_rootfs}:g" \
144 > "${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf"
145
146 export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf"
147
148 mkdir -p ${target_rootfs}/var/dpkg/info
149 mkdir -p ${target_rootfs}/var/dpkg/updates
150
151 > ${target_rootfs}/var/dpkg/status
152 > ${target_rootfs}/var/dpkg/available
153
154 apt-get update
155
156 # Uclibc builds don't provide this stuff..
157 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
158 if [ ! -z "${package_lingusa}" ]; then
159 apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated
160 if [ $? -ne 0 ]; then
161 exit 1
162 fi
163 for i in ${package_lingusa}; do
164 apt-get install $i --force-yes --allow-unauthenticated
165 if [ $? -ne 0 ]; then
166 exit 1
167 fi
168 done
169 fi
170 fi
171
172 # normal install
173 for i in ${package_to_install}; do
174 apt-get install $i --force-yes --allow-unauthenticated
175 if [ $? -ne 0 ]; then
176 exit 1
177 fi
178 done
179
180 rm -f ${WORKDIR}/temp/log.do_${task}-attemptonly.${PID}
181 if [ ! -z "${package_attemptonly}" ]; then
182 for i in ${package_attemptonly}; do
183 apt-get install $i --force-yes --allow-unauthenticated >> ${WORKDIR}/temp/log.do_${task}-attemptonly.${PID} || true
184 done
185 fi
186
187 find ${target_rootfs} -name \*.dpkg-new | for i in `cat`; do
188 mv $i `echo $i | sed -e's,\.dpkg-new$,,'`
189 done
190
191 # Mark all packages installed
192 sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${target_rootfs}/var/dpkg/status
193}
194
70deb_log_check() { 195deb_log_check() {
71 target="$1" 196 target="$1"
72 lf_path="$2" 197 lf_path="$2"