21dcd88cee
* There would be race issue if we put the lock to the WORKDIR, for example: bitbake core-image-sato core-image-sato-sdk If the lock is in their own WORKDIR, the apt-rootfs.conf and Packages.gz maybe be written by two tasks at the same time, which would cause unexpected errors. * Create ${target_rootfs}/etc since the "tar -C" needs it. Note: * The rpm has put the lock to DEPLOY_DIR_RPM * The ipk doesn't need it since it has locks for each deploy directory and put the opkg.conf in his own WORKDIR, which doesn't like deb put the apt-rootfs.conf in ${STAGING_ETCDIR_NATIVE}/apt/. [YOCTO #2495] (From OE-Core rev: 23ac392f8b868296eb9e7cd840f9b28ed6917b27) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
125 lines
3.7 KiB
Text
125 lines
3.7 KiB
Text
#
|
|
# Copyright 2006-2007 Openedhand Ltd.
|
|
#
|
|
|
|
ROOTFS_PKGMANAGE = "run-postinsts dpkg apt"
|
|
ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts"
|
|
|
|
do_rootfs[depends] += "dpkg-native:do_populate_sysroot apt-native:do_populate_sysroot"
|
|
do_rootfs[recrdeptask] += "do_package_write_deb"
|
|
|
|
do_rootfs[lockfiles] += "${DEPLOY_DIR_DEB}/deb.lock"
|
|
|
|
DEB_POSTPROCESS_COMMANDS = ""
|
|
|
|
opkglibdir = "${localstatedir}/lib/opkg"
|
|
|
|
deb_package_setflag() {
|
|
sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/lib/dpkg/status
|
|
}
|
|
|
|
deb_package_getflag() {
|
|
cat ${IMAGE_ROOTFS}/var/lib/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}"
|
|
}
|
|
|
|
fakeroot rootfs_deb_do_rootfs () {
|
|
set +e
|
|
|
|
mkdir -p ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives
|
|
|
|
# update index
|
|
package_update_index_deb
|
|
|
|
#install packages
|
|
export INSTALL_ROOTFS_DEB="${IMAGE_ROOTFS}"
|
|
export INSTALL_BASEARCH_DEB="${DPKG_ARCH}"
|
|
export INSTALL_ARCHS_DEB="${PACKAGE_ARCHS}"
|
|
export INSTALL_PACKAGES_NORMAL_DEB="${PACKAGE_INSTALL}"
|
|
export INSTALL_PACKAGES_ATTEMPTONLY_DEB="${PACKAGE_INSTALL_ATTEMPTONLY}"
|
|
export INSTALL_PACKAGES_LINGUAS_DEB="${LINGUAS_INSTALL}"
|
|
export INSTALL_TASK_DEB="rootfs"
|
|
|
|
package_install_internal_deb
|
|
${DEB_POSTPROCESS_COMMANDS}
|
|
|
|
rootfs_install_complementary
|
|
|
|
export D=${IMAGE_ROOTFS}
|
|
export OFFLINE_ROOT=${IMAGE_ROOTFS}
|
|
export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
|
|
export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
|
|
|
|
# Attempt to run preinsts
|
|
# Mark packages with preinst failures as unpacked
|
|
for i in ${IMAGE_ROOTFS}/var/lib/dpkg/info/*.preinst; do
|
|
if [ -f $i ] && ! sh $i; then
|
|
deb_package_setflag unpacked `basename $i .preinst`
|
|
fi
|
|
done
|
|
|
|
# Attempt to run postinsts
|
|
# Mark packages with postinst failures as unpacked
|
|
for i in ${IMAGE_ROOTFS}/var/lib/dpkg/info/*.postinst; do
|
|
if [ -f $i ] && ! sh $i configure; then
|
|
deb_package_setflag unpacked `basename $i .postinst`
|
|
fi
|
|
done
|
|
|
|
set -e
|
|
|
|
install -d ${IMAGE_ROOTFS}/${sysconfdir}
|
|
echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
|
|
|
|
# Hacks to allow opkg's update-alternatives and opkg to coexist for now
|
|
mkdir -p ${IMAGE_ROOTFS}${opkglibdir}
|
|
if [ -e ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives ]; then
|
|
rmdir ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives
|
|
fi
|
|
ln -s ${opkglibdir}/alternatives ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives
|
|
ln -s /var/lib/dpkg/info ${IMAGE_ROOTFS}${opkglibdir}/info
|
|
ln -s /var/lib/dpkg/status ${IMAGE_ROOTFS}${opkglibdir}/status
|
|
|
|
${ROOTFS_POSTPROCESS_COMMAND}
|
|
|
|
log_check rootfs
|
|
}
|
|
|
|
remove_packaging_data_files() {
|
|
rm -rf ${IMAGE_ROOTFS}${opkglibdir}
|
|
rm -rf ${IMAGE_ROOTFS}/usr/dpkg/
|
|
}
|
|
|
|
# This will of course only work after rootfs_deb_do_rootfs has been called
|
|
DPKG_QUERY_COMMAND = "${STAGING_BINDIR_NATIVE}/dpkg-query --admindir=$INSTALL_ROOTFS_DEB/var/lib/dpkg"
|
|
|
|
list_installed_packages() {
|
|
if [ "$1" = "arch" ] ; then
|
|
# Here we want the PACKAGE_ARCH not the deb architecture
|
|
${DPKG_QUERY_COMMAND} -W -f='${Package} ${PackageArch}\n'
|
|
elif [ "$1" = "file" ] ; then
|
|
${DPKG_QUERY_COMMAND} -W -f='${Package} ${Package}_${Version}_${Architecture}.deb\n' | while read pkg pkgfile
|
|
do
|
|
fullpath=`find ${DEPLOY_DIR_DEB} -name "$pkgfile" || true`
|
|
if [ "$fullpath" = "" ] ; then
|
|
echo "$pkg $pkgfile"
|
|
else
|
|
echo "$pkg $fullpath"
|
|
fi
|
|
done
|
|
else
|
|
${DPKG_QUERY_COMMAND} -W -f='${Package}\n'
|
|
fi
|
|
}
|
|
|
|
rootfs_list_installed_depends() {
|
|
# Cheat here a little bit by using the opkg query helper util
|
|
${DPKG_QUERY_COMMAND} -W -f='Package: ${Package}\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n' | opkg-query-helper.py
|
|
}
|
|
|
|
rootfs_install_packages() {
|
|
${STAGING_BINDIR_NATIVE}/apt-get install `cat $1` --force-yes --allow-unauthenticated
|
|
|
|
# Mark all packages installed
|
|
sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" $INSTALL_ROOTFS_DEB/var/lib/dpkg/status
|
|
}
|