]> code.ossystems Code Review - openembedded-core.git/commitdiff
rootfs_ipk/package_ipk.bbclass: Move func from rootfs_ipk to package_ipk
authorLianhao Lu <lianhao.lu@intel.com>
Sun, 30 Jan 2011 04:56:40 +0000 (12:56 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Feb 2011 23:59:37 +0000 (23:59 +0000)
package_ipk.bbclass:
Added new function package_install_internal_ipk() to install a list of
ipk packages to a specified root directory, with the specified package
architecutre information.

rootfs_ipk.bbclass:
Used the above new functions to install rootfs.

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
meta/classes/package_ipk.bbclass
meta/classes/rootfs_ipk.bbclass

index ba768746ca065e4536a0f68ff6852095cb64045f..3c2472bc108b5e17eb8f7b0eba6f05aacb6df158 100644 (file)
@@ -61,6 +61,49 @@ python package_ipk_install () {
                raise bb.build.FuncFailed
 }
 
+#
+# install a bunch of packages using opkg
+# the following shell variables needs to be set before calling this func:
+# INSTALL_ROOTFS_IPK - install root dir
+# INSTALL_CONF_IPK - configuration file
+# INSTALL_PACKAGES_NORMAL_IPK - packages to be installed
+# INSTALL_PACKAGES_ATTEMPTONLY_IPK - packages attemped to be installed only
+# INSTALL_PACKAGES_LINGUAS_IPK - additional packages for uclibc
+# INSTALL_TASK_IPK - task name
+
+package_install_internal_ipk() {
+
+       local target_rootfs="${INSTALL_ROOTFS_IPK}"
+       local conffile="${INSTALL_CONF_IPK}"
+       local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}"
+       local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}"
+       local package_lingusa="${INSTALL_PACKAGES_LINGUAS_IPK}"
+       local task="${INSTALL_TASK_IPK}"
+
+       mkdir -p ${target_rootfs}${localstatedir}/lib/opkg/
+
+       local ipkg_args="-f ${conffile} -o ${target_rootfs} --force-overwrite"
+
+       opkg-cl ${ipkg_args} update
+
+       # Uclibc builds don't provide this stuff...
+       if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
+               if [ ! -z "${package_lingusa}" ]; then
+                       for i in ${package_lingusa}; do
+                               opkg-cl ${ipkg_args} install $i
+                       done
+               fi
+       fi
+
+       if [ ! -z "${package_to_install}" ]; then
+               opkg-cl ${ipkg_args} install ${package_to_install}
+       fi
+
+       if [ ! -z "${package_attemptonly}" ]; then
+               opkg-cl ${ipkg_args} install ${package_attemptonly} > "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true
+       fi
+}
+
 ipk_log_check() {
        target="$1"
        lf_path="$2"
index 07c114e3ab9afc4f6d17bbcd23f84c5df842f9b8..5727d1502bc7af89fcf4fb8e00868bba09213989 100644 (file)
@@ -29,26 +29,19 @@ fakeroot rootfs_ipk_do_rootfs () {
        ${OPKG_PREPROCESS_COMMANDS}
 
        mkdir -p ${T}/
-       mkdir -p ${IMAGE_ROOTFS}${opkglibdir}
 
-       opkg-cl ${IPKG_ARGS} update
+       #install
+       export INSTALL_PACKAGES_ATTEMPTONLY_IPK="${PACKAGE_INSTALL_ATTEMPTONLY}"
+       export INSTALL_PACKAGES_LINGUAS_IPK="${LINGUAS_INSTALL}"
+       export INSTALL_TASK_IPK="rootfs"
 
-       # Uclibc builds don't provide this stuff...
-       if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 
-               if [ ! -z "${LINGUAS_INSTALL}" ]; then
-                       for i in ${LINGUAS_INSTALL}; do
-                               opkg-cl ${IPKG_ARGS} install $i 
-                       done
-               fi
-       fi
-       if [ ! -z "${PACKAGE_INSTALL}" ]; then
-               opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL}
-       fi
+       export INSTALL_ROOTFS_IPK="${IMAGE_ROOTFS}"
+       export INSTALL_CONF_IPK="${IPKGCONF_TARGET}"
+       export INSTALL_PACKAGES_NORMAL_IPK="${PACKAGE_INSTALL}"
 
-       if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
-               opkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL_ATTEMPTONLY} > "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}" || true
-       fi
+       package_install_internal_ipk
 
+       #post install
        export D=${IMAGE_ROOTFS}
        export OFFLINE_ROOT=${IMAGE_ROOTFS}
        export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}