From c6938aad87ce4b9ce25ecd020ecddfe62b319bcf Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 1 Sep 2007 22:17:06 +0000 Subject: 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 --- meta/classes/meta.bbclass | 4 ++++ meta/classes/package_ipk.bbclass | 44 ++++++++++++++++++++++++++++++++++++++++ meta/classes/rootfs_ipk.bbclass | 35 +++++--------------------------- meta/classes/task.bbclass | 27 ++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 30 deletions(-) create mode 100644 meta/classes/meta.bbclass create mode 100644 meta/classes/task.bbclass (limited to 'meta/classes') diff --git a/meta/classes/meta.bbclass b/meta/classes/meta.bbclass new file mode 100644 index 000000000..d35c40bcc --- /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 d88d11b99..1175d1e75 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 3709f8974..3c9d03f9d 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 000000000..4edd70482 --- /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) +} + -- cgit v1.2.3