diff options
author | Richard Purdie <richard@openedhand.com> | 2007-09-01 22:17:06 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-09-01 22:17:06 +0000 |
commit | c6938aad87ce4b9ce25ecd020ecddfe62b319bcf (patch) | |
tree | bf38fd54cc10deb22025853094b3e33c4043d1b2 | |
parent | a7c63ec4828e08e0812f69a5be04422e5dd7b30a (diff) | |
download | openembedded-core-c6938aad87ce4b9ce25ecd020ecddfe62b319bcf.tar.gz openembedded-core-c6938aad87ce4b9ce25ecd020ecddfe62b319bcf.tar.bz2 openembedded-core-c6938aad87ce4b9ce25ecd020ecddfe62b319bcf.zip |
Factor ipkg index and conf file creation into package_ipk.bbclass
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2637 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r-- | meta/classes/meta.bbclass | 4 | ||||
-rw-r--r-- | meta/classes/package_ipk.bbclass | 44 | ||||
-rw-r--r-- | meta/classes/rootfs_ipk.bbclass | 35 | ||||
-rw-r--r-- | meta/classes/task.bbclass | 27 | ||||
-rw-r--r-- | meta/conf/bitbake.conf | 1 | ||||
-rw-r--r-- | meta/packages/meta/meta-toolchain.bb | 29 |
6 files changed, 88 insertions, 52 deletions
diff --git a/meta/classes/meta.bbclass b/meta/classes/meta.bbclass new file mode 100644 index 0000000000..d35c40bccd --- /dev/null +++ b/meta/classes/meta.bbclass @@ -0,0 +1,4 @@ + +PACKAGES = "" + +do_build[recrdeptask] = "do_build"
\ No newline at end of file diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index d88d11b994..1175d1e751 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -4,6 +4,9 @@ BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg ipkg-link" DISTRO_EXTRA_RDEPENDS += "ipkg-collateral ipkg ipkg-link" IMAGE_PKGTYPE ?= "ipk" +IPKGCONF_TARGET = "${STAGING_ETCDIR_NATIVE}/ipkg.conf" +IPKGCONF_SDK = "${STAGING_ETCDIR_NATIVE}/ipkg-sdk.conf" + python package_ipk_fn () { from bb import data bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) @@ -60,6 +63,47 @@ python package_ipk_install () { raise bb.build.FuncFailed } +# +# Update the Packages index files in ${DEPLOY_DIR_IPK} +# +package_update_index_ipk () { + set -x + + ipkgarchs="${PACKAGE_ARCHS}" + + if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then + return + fi + + touch ${DEPLOY_DIR_IPK}/Packages + ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK} + + for arch in $ipkgarchs; do + if [ -e ${DEPLOY_DIR_IPK}/$arch/ ] ; then + touch ${DEPLOY_DIR_IPK}/$arch/Packages + ipkg-make-index -r ${DEPLOY_DIR_IPK}/$arch/Packages -p ${DEPLOY_DIR_IPK}/$arch/Packages -l ${DEPLOY_DIR_IPK}/$arch/Packages.filelist -m ${DEPLOY_DIR_IPK}/$arch/ + fi + done +} + +# +# Generate an ipkg conf file ${IPKGCONF_TARGET} suitable for use against +# the target system and an ipkg conf file ${IPKGCONF_SDK} suitable for +# use against the host system in sdk builds +# +package_generate_ipkg_conf () { + mkdir -p ${STAGING_ETCDIR_NATIVE}/ + echo "src oe file:${DEPLOY_DIR_IPK}" > ${IPKGCONF_TARGET} + echo "src oe file:${DEPLOY_DIR_IPK}" > ${IPKGCONF_SDK} + ipkgarchs="${PACKAGE_ARCHS}" + priority=1 + for arch in $ipkgarchs; do + echo "arch $arch $priority" >> ${IPKGCONF_TARGET} + echo "arch ${BUILD_ARCH}-$arch-sdk $priority" >> ${IPKGCONF_SDK} + priority=$(expr $priority + 5) + done +} + python do_package_ipk () { import sys, re, fcntl, copy diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass index 3709f89743..3c9d03f9dd 100644 --- a/meta/classes/rootfs_ipk.bbclass +++ b/meta/classes/rootfs_ipk.bbclass @@ -8,41 +8,16 @@ do_rootfs[depends] += "ipkg-native:do_populate_staging ipkg-utils-native:do_populate_staging" do_rootfs[recrdeptask] += "do_package_write_ipk" -IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}" - -rootfs_ipk_do_indexes () { - set -x - - ipkgarchs="${PACKAGE_ARCHS}" - - if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then - touch ${DEPLOY_DIR_IPK}/Packages - ipkg-make-index -r ${DEPLOY_DIR_IPK}/Packages -p ${DEPLOY_DIR_IPK}/Packages -l ${DEPLOY_DIR_IPK}/Packages.filelist -m ${DEPLOY_DIR_IPK} - fi - - for arch in $ipkgarchs; do - if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then - if [ -e ${DEPLOY_DIR_IPK}/$arch/ ] ; then - touch ${DEPLOY_DIR_IPK}/$arch/Packages - ipkg-make-index -r ${DEPLOY_DIR_IPK}/$arch/Packages -p ${DEPLOY_DIR_IPK}/$arch/Packages -l ${DEPLOY_DIR_IPK}/$arch/Packages.filelist -m ${DEPLOY_DIR_IPK}/$arch/ - fi - fi - done -} +IPKG_ARGS = "-f ${IPKGCONF_TARGET} -o ${IMAGE_ROOTFS}" fakeroot rootfs_ipk_do_rootfs () { set -x - rootfs_ipk_do_indexes + package_update_index_ipk + package_generate_ipkg_conf mkdir -p ${T} - echo "src oe file:${DEPLOY_DIR_IPK}" > ${T}/ipkg.conf - ipkgarchs="${PACKAGE_ARCHS}" - priority=1 - for arch in $ipkgarchs; do - echo "arch $arch $priority" >> ${T}/ipkg.conf - priority=$(expr $priority + 5) - done + ipkg-cl ${IPKG_ARGS} update if [ ! -z "${LINGUAS_INSTALL}" ]; then ipkg-cl ${IPKG_ARGS} install glibc-localedata-i18n @@ -58,7 +33,7 @@ fakeroot rootfs_ipk_do_rootfs () { export OFFLINE_ROOT=${IMAGE_ROOTFS} export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/ - grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf + grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/ipkg/arch.conf for i in ${IMAGE_ROOTFS}${libdir}/ipkg/info/*.preinst; do if [ -f $i ] && ! sh $i; then diff --git a/meta/classes/task.bbclass b/meta/classes/task.bbclass new file mode 100644 index 0000000000..4edd704829 --- /dev/null +++ b/meta/classes/task.bbclass @@ -0,0 +1,27 @@ +# Task packages are only used to pull in other packages +# via their dependencies. They are empty. +ALLOW_EMPTY = "1" + +# By default, only the task package itself is in PACKAGES. +# -dbg and -dev flavours are handled by the anonfunc below. +# This means that task recipes used to build multiple task +# packages have to modify PACKAGES after inheriting task.bbclass. +PACKAGES = "${PN}" + +# By default, task packages do not depend on a certain architecture. +# Only if dependencies are modified by MACHINE_FEATURES, packages +# need to be set to MACHINE_ARCH after inheriting task.bbclass +PACKAGE_ARCH = "all" + +# This automatically adds -dbg and -dev flavours of all PACKAGES +# to the list. Their dependencies (RRECOMMENDS) are handled as usual +# by package_depchains in a following step. +python () { + packages = bb.data.getVar('PACKAGES', d, 1).split() + genpackages = [] + for pkg in packages: + for postfix in ['-dbg', '-dev']: + genpackages.append(pkg+postfix) + bb.data.setVar('PACKAGES', ' '.join(packages+genpackages), d) +} + diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 7adc8ee9dc..24c3aa1c72 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -171,6 +171,7 @@ STAGING_BINDIR_CROSS = "${STAGING_DIR}/${BUILD_SYS}/bin/${HOST_SYS}" STAGING_BINDIR_NATIVE = "${STAGING_DIR}/${BUILD_SYS}/bin" STAGING_LIBDIR = "${STAGING_DIR}/${HOST_SYS}/lib" STAGING_LIBDIR_NATIVE = "${STAGING_DIR}/${BUILD_SYS}/lib" +STAGING_ETCDIR_NATIVE = "${STAGING_DIR}/${BUILD_SYS}/etc" STAGING_INCDIR = "${STAGING_DIR}/${HOST_SYS}/include" STAGING_DATADIR = "${STAGING_DIR}/${HOST_SYS}/share" STAGING_LOADER_DIR = "${STAGING_DIR}/${HOST_SYS}/loader" diff --git a/meta/packages/meta/meta-toolchain.bb b/meta/packages/meta/meta-toolchain.bb index 1a1bde46c0..a0f38404b0 100644 --- a/meta/packages/meta/meta-toolchain.bb +++ b/meta/packages/meta/meta-toolchain.bb @@ -1,21 +1,15 @@ DESCRIPTION = "Meta package for building a installable toolchain" LICENSE = "MIT" DEPENDS = "ipkg-native ipkg-utils-native fakeroot-native sed-native" -PR = "r3" -inherit sdk - -PACKAGES = "" - -BUILD_ALL_DEPS = "1" -do_build[recrdeptask] = "do_build" +inherit sdk meta SDK_DIR = "${WORKDIR}/sdk" SDK_OUTPUT = "${SDK_DIR}/image" SDK_DEPLOY = "${TMPDIR}/deploy/sdk" -IPKG_HOST = "ipkg-cl -f ${SDK_DIR}/ipkg-host.conf -o ${SDK_OUTPUT}" -IPKG_TARGET = "ipkg-cl -f ${SDK_DIR}/ipkg-target.conf -o ${SDK_OUTPUT}/${prefix}" +IPKG_HOST = "ipkg-cl -f ${IPKGCONF_SDK} -o ${SDK_OUTPUT}" +IPKG_TARGET = "ipkg-cl -f ${IPKGCONF_TARGET} -o ${SDK_OUTPUT}/${prefix}" HOST_INSTALL = "task-poky-standalone-sdk-host" @@ -30,20 +24,11 @@ do_populate_sdk() { rm -rf ${SDK_OUTPUT} mkdir -p ${SDK_OUTPUT} - cat <<EOF >${SDK_DIR}/ipkg-host.conf -src oe file:${DEPLOY_DIR_IPK} -EOF - cat <<EOF >${SDK_DIR}/ipkg-target.conf -src oe file:${DEPLOY_DIR_IPK} -EOF - ipkgarchs="${PACKAGE_ARCHS}" - priority=1 - for arch in $ipkgarchs; do - echo "arch $arch $priority" >> ${SDK_DIR}/ipkg-target.conf - echo "arch ${BUILD_ARCH}-$arch-sdk $priority" >> ${SDK_DIR}/ipkg-host.conf - priority=$(expr $priority + 5) + package_generate_ipkg_conf + + for arch in ${PACKAGE_ARCHS}; do revipkgarchs="$arch $revipkgarchs" - done + done rm -r ${SDK_OUTPUT} mkdir -p ${SDK_OUTPUT} |