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
This commit is contained in:
Richard Purdie 2007-09-01 22:17:06 +00:00
parent a7c63ec482
commit c6938aad87
6 changed files with 88 additions and 52 deletions

View File

@ -0,0 +1,4 @@
PACKAGES = ""
do_build[recrdeptask] = "do_build"

View File

@ -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

View File

@ -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

27
meta/classes/task.bbclass Normal file
View File

@ -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)
}

View File

@ -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"

View File

@ -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}