mirror of
https://git.yoctoproject.org/poky
synced 2026-04-25 15:32:13 +02:00
Activate the new python rootfs/image creation routines
This commit will: * remove old bash code common to all backends; * create a new do_rootfs() python function that will use the new rootfs/image creation routines; * allow creation of dpkg based images; * fail for rpm/opkg (not implemented yet); (From OE-Core rev: a83144bac8d67704ff66f5dc0fc56f5b63979694) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
85cc53a5a0
commit
7fc9bdaeed
@@ -14,38 +14,6 @@ APTCONF_TARGET = "${WORKDIR}"
|
||||
|
||||
APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}"
|
||||
|
||||
#
|
||||
# Update the Packages index files in ${DEPLOY_DIR_DEB}
|
||||
#
|
||||
package_update_index_deb () {
|
||||
|
||||
local debarchs=""
|
||||
|
||||
if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
for arch in ${PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}; do
|
||||
if [ -e ${DEPLOY_DIR_DEB}/$arch ]; then
|
||||
debarchs="$debarchs $arch"
|
||||
fi
|
||||
done
|
||||
|
||||
found=0
|
||||
for arch in $debarchs; do
|
||||
if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
|
||||
continue;
|
||||
fi
|
||||
cd ${DEPLOY_DIR_DEB}/$arch
|
||||
dpkg-scanpackages . | gzip > Packages.gz
|
||||
echo "Label: $arch" > Release
|
||||
found=1
|
||||
done
|
||||
if [ "$found" != "1" ]; then
|
||||
bbfatal "There are no packages in ${DEPLOY_DIR_DEB}!"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# install a bunch of packages using apt
|
||||
# the following shell variables needs to be set before calling this func:
|
||||
@@ -57,120 +25,6 @@ package_update_index_deb () {
|
||||
# INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc
|
||||
# INSTALL_TASK_DEB - task name
|
||||
|
||||
package_install_internal_deb () {
|
||||
|
||||
local target_rootfs="${INSTALL_ROOTFS_DEB}"
|
||||
local dpkg_arch="${INSTALL_BASEARCH_DEB}"
|
||||
local archs="${INSTALL_ARCHS_DEB}"
|
||||
local package_to_install="${INSTALL_PACKAGES_NORMAL_DEB}"
|
||||
local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_DEB}"
|
||||
local package_linguas="${INSTALL_PACKAGES_LINGUAS_DEB}"
|
||||
local task="${INSTALL_TASK_DEB}"
|
||||
|
||||
mkdir -p ${APTCONF_TARGET}/apt
|
||||
rm -f ${APTCONF_TARGET}/apt/sources.list.rev
|
||||
rm -f ${APTCONF_TARGET}/apt/preferences
|
||||
|
||||
priority=1
|
||||
for arch in $archs; do
|
||||
if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${APTCONF_TARGET}/apt/sources.list.rev
|
||||
(echo "Package: *"
|
||||
echo "Pin: release l=$arch"
|
||||
echo "Pin-Priority: $(expr 800 + $priority)"
|
||||
echo) >> ${APTCONF_TARGET}/apt/preferences
|
||||
priority=$(expr $priority + 5)
|
||||
done
|
||||
|
||||
for pkg in ${PACKAGE_EXCLUDE}; do
|
||||
(echo "Package: $pkg"
|
||||
echo "Pin: release *"
|
||||
echo "Pin-Priority: -1"
|
||||
echo) >> ${APTCONF_TARGET}/apt/preferences
|
||||
done
|
||||
|
||||
tac ${APTCONF_TARGET}/apt/sources.list.rev > ${APTCONF_TARGET}/apt/sources.list
|
||||
|
||||
# The params in deb package control don't allow character `_', so
|
||||
# change the arch's `_' to `-' in it.
|
||||
dpkg_arch=`echo ${dpkg_arch} | sed 's/_/-/g'`
|
||||
cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \
|
||||
| sed -e "s#Architecture \".*\";#Architecture \"${dpkg_arch}\";#" \
|
||||
| sed -e "s:#ROOTFS#:${target_rootfs}:g" \
|
||||
| sed -e "s:#APTCONF#:${APTCONF_TARGET}/apt:g" \
|
||||
> "${APTCONF_TARGET}/apt/apt.conf"
|
||||
|
||||
export APT_CONFIG="${APTCONF_TARGET}/apt/apt.conf"
|
||||
|
||||
mkdir -p ${target_rootfs}/var/lib/dpkg/info
|
||||
mkdir -p ${target_rootfs}/var/lib/dpkg/updates
|
||||
|
||||
> ${target_rootfs}/var/lib/dpkg/status
|
||||
> ${target_rootfs}/var/lib/dpkg/available
|
||||
|
||||
apt-get update
|
||||
|
||||
if [ ! -z "${package_linguas}" ]; then
|
||||
for i in ${package_linguas}; do
|
||||
apt-get ${APT_ARGS} install $i --force-yes --allow-unauthenticated
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# normal install
|
||||
if [ ! -z "${package_to_install}" ]; then
|
||||
apt-get ${APT_ARGS} install ${package_to_install} --force-yes --allow-unauthenticated
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Attempt to correct the probable broken dependencies in place.
|
||||
apt-get ${APT_ARGS} -f install
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f `dirname ${BB_LOGFILE}`/log.do_${task}-attemptonly.${PID}
|
||||
if [ ! -z "${package_attemptonly}" ]; then
|
||||
for i in ${package_attemptonly}; do
|
||||
apt-get ${APT_ARGS} install $i --force-yes --allow-unauthenticated >> `dirname ${BB_LOGFILE}`/log.do_${task}-attemptonly.${PID} 2>&1 || true
|
||||
done
|
||||
fi
|
||||
|
||||
find ${target_rootfs} -name \*.dpkg-new | for i in `cat`; do
|
||||
mv $i `echo $i | sed -e's,\.dpkg-new$,,'`
|
||||
done
|
||||
|
||||
# Mark all packages installed
|
||||
sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${target_rootfs}/var/lib/dpkg/status
|
||||
}
|
||||
|
||||
deb_log_check() {
|
||||
target="$1"
|
||||
lf_path="$2"
|
||||
|
||||
lf_txt="`cat $lf_path`"
|
||||
for keyword_die in "^E:"
|
||||
do
|
||||
if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
|
||||
then
|
||||
echo "log_check: There were error messages in the logfile"
|
||||
printf "log_check: Matched keyword: [$keyword_die]\n\n"
|
||||
echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die"
|
||||
echo ""
|
||||
do_exit=1
|
||||
fi
|
||||
done
|
||||
test "$do_exit" = 1 && exit 1
|
||||
true
|
||||
}
|
||||
|
||||
python do_package_deb () {
|
||||
import re, copy
|
||||
import textwrap
|
||||
|
||||
Reference in New Issue
Block a user