summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2013-12-18 18:02:18 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:50:25 +0000
commita83144bac8d67704ff66f5dc0fc56f5b63979694 (patch)
tree5b11e346951517ca28f8c3ef5980100cfaf29a57
parent5ad8c21bc7f2213d1287cecf07d00a61d1456ff7 (diff)
downloadopenembedded-core-a83144bac8d67704ff66f5dc0fc56f5b63979694.tar.gz
openembedded-core-a83144bac8d67704ff66f5dc0fc56f5b63979694.tar.bz2
openembedded-core-a83144bac8d67704ff66f5dc0fc56f5b63979694.zip
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); Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
-rw-r--r--meta/classes/image.bbclass262
-rw-r--r--meta/classes/image_types.bbclass113
-rw-r--r--meta/classes/package_deb.bbclass146
-rw-r--r--meta/classes/rootfs_deb.bbclass115
4 files changed, 11 insertions, 625 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 37b761ba44..0b35c719fd 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -151,32 +151,11 @@ python () {
d.appendVarFlag('do_bundle_initramfs', 'depends', " %s:do_rootfs" % initramfs_image)
}
-#
-# Get a list of files containing device tables to create.
-# * IMAGE_DEVICE_TABLE is the old name to an absolute path to a device table file
-# * IMAGE_DEVICE_TABLES is a new name for a file, or list of files, seached
-# for in the BBPATH
-# If neither are specified then the default name of files/device_table-minimal.txt
-# is searched for in the BBPATH (same as the old version.)
-#
-def get_devtable_list(d):
- devtable = d.getVar('IMAGE_DEVICE_TABLE', True)
- if devtable != None:
- return devtable
- str = ""
- devtables = d.getVar('IMAGE_DEVICE_TABLES', True)
- if devtables == None:
- devtables = 'files/device_table-minimal.txt'
- for devtable in devtables.split():
- str += " %s" % bb.utils.which(d.getVar('BBPATH', True), devtable)
- return str
-
IMAGE_CLASSES ?= "image_types"
inherit ${IMAGE_CLASSES}
IMAGE_POSTPROCESS_COMMAND ?= ""
MACHINE_POSTPROCESS_COMMAND ?= ""
-ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; "
# Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks is enabled
ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}'
# Enable postinst logging if debug-tweaks is enabled
@@ -197,7 +176,7 @@ LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IM
PSEUDO_PASSWD = "${IMAGE_ROOTFS}"
-do_rootfs[dirs] = "${TOPDIR} ${WORKDIR}/intercept_scripts"
+do_rootfs[dirs] = "${TOPDIR}"
do_rootfs[lockfiles] += "${IMAGE_ROOTFS}.lock"
do_rootfs[cleandirs] += "${S} ${WORKDIR}/intercept_scripts"
@@ -205,63 +184,6 @@ do_rootfs[cleandirs] += "${S} ${WORKDIR}/intercept_scripts"
# task, so that we have a single fakeroot context for the whole process.
do_rootfs[umask] = "022"
-
-run_intercept_scriptlets () {
- if [ -d ${WORKDIR}/intercept_scripts ]; then
- cd ${WORKDIR}/intercept_scripts
- echo "Running intercept scripts:"
- for script in *; do
- [ "$script" = "*" ] && break
- [ "$script" = "postinst_intercept" ] || [ ! -x "$script" ] && continue
- echo "> Executing $script"
- ./$script && continue
- echo "WARNING: intercept script \"$script\" failed, falling back to running postinstalls at first boot"
- #
- # If we got here, than the intercept has failed. Next, we must
- # mark the postinstalls as "unpacked". For rpm is a little bit
- # different, we just have to save the package postinstalls in
- # /etc/rpm-postinsts
- #
- pkgs="$(cat ./$script|grep "^##PKGS"|cut -d':' -f2)" || continue
- case ${IMAGE_PKGTYPE} in
- "rpm")
- [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/ ] || mkdir ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/
- v_expr=$(echo ${MULTILIB_GLOBAL_VARIANTS}|tr ' ' '|')
- for p in $pkgs; do
- # remove any multilib prefix from the package name (RPM
- # does not use it like this)
- new_p=$(echo $p | sed -r "s/^($v_expr)-//")
-
- # extract the postinstall scriptlet from rpm package and
- # save it in /etc/rpm-postinsts
- echo " * postponing $new_p"
- rpm -q --scripts --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm $new_p |\
- sed -n -e '/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}' |\
- sed -e 's/postinstall scriptlet (using \(.*\)):$/#!\1/' -e '/^.* scriptlet (using .*):$/d'\
- > ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p
- chmod +x ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts/$new_p
- done
- # move to the next intercept script
- continue
- ;;
- "ipk")
- status_file="${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/status"
- ;;
- "deb")
- status_file="${IMAGE_ROOTFS}/var/lib/dpkg/status"
- ;;
- esac
- # the next piece of code is run only for ipk/dpkg
- sed_expr=""
- for p in $pkgs; do
- echo " * postponing $p"
- sed_expr="$sed_expr -e \"/^Package: ${p}$/,/^Status: install.* installed$/ {s/installed/unpacked/}\""
- done
- eval sed -i $sed_expr $status_file
- done
- fi
-}
-
# A hook function to support read-only-rootfs IMAGE_FEATURES
# Currently, it only supports sysvinit system.
read_only_rootfs_hook () {
@@ -328,72 +250,19 @@ python rootfs_runtime_mapping() {
}
do_rootfs[prefuncs] += "rootfs_runtime_mapping"
-fakeroot do_rootfs () {
- #set -x
- # When use the rpm incremental image generation, don't remove the rootfs
- if [ "${INC_RPM_IMAGE_GEN}" != "1" -o "${IMAGE_PKGTYPE}" != "rpm" ]; then
- rm -rf ${IMAGE_ROOTFS}
- elif [ -d ${T}/saved_rpmlib/var/lib/rpm ]; then
- # Move the rpmlib back
- if [ ! -d ${IMAGE_ROOTFS}/var/lib/rpm ]; then
- mkdir -p ${IMAGE_ROOTFS}/var/lib/
- mv ${T}/saved_rpmlib/var/lib/rpm ${IMAGE_ROOTFS}/var/lib/
- fi
- fi
- rm -rf ${MULTILIB_TEMP_ROOTFS}
- mkdir -p ${IMAGE_ROOTFS}
- mkdir -p ${DEPLOY_DIR_IMAGE}
-
- cp ${COREBASE}/meta/files/deploydir_readme.txt ${DEPLOY_DIR_IMAGE}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt || true
-
- # copy the intercept scripts
- cp ${COREBASE}/scripts/postinst-intercepts/* ${WORKDIR}/intercept_scripts/
-
- rootfs_${IMAGE_PKGTYPE}_do_rootfs
-
- if [ "${USE_DEVFS}" != "1" ]; then
- for devtable in ${@get_devtable_list(d)}; do
- # Always return ture since there maybe already one when use the
- # incremental image generation
- makedevs -r ${IMAGE_ROOTFS} -D $devtable
- done
- fi
-
- # remove unneeded packages/files from the final image
- rootfs_uninstall_unneeded
-
- insert_feed_uris
+fakeroot python do_rootfs () {
+ from oe.rootfs import create_rootfs
+ from oe.image import create_image
+ from oe.manifest import create_manifest
- if [ "x${LDCONFIGDEPEND}" != "x" ]; then
- # Run ldconfig on the image to create a valid cache
- # (new format for cross arch compatibility)
- echo executing: ldconfig -r ${IMAGE_ROOTFS} -c new -v
- ldconfig -r ${IMAGE_ROOTFS} -c new -v
- fi
-
- # (re)create kernel modules dependencies
- # This part is done by kernel-module-* postinstall scripts but if image do
- # not contains modules at all there are few moments in boot sequence with
- # "unable to open modules.dep" message.
- if [ -e ${STAGING_KERNEL_DIR}/kernel-abiversion ]; then
- KERNEL_VERSION=`cat ${STAGING_KERNEL_DIR}/kernel-abiversion`
+ # generate the initial manifest
+ create_manifest(d)
- mkdir -p ${IMAGE_ROOTFS}/lib/modules/$KERNEL_VERSION
- depmodwrapper -a -b ${IMAGE_ROOTFS} $KERNEL_VERSION
- fi
+ # generate rootfs
+ create_rootfs(d)
- ${IMAGE_PREPROCESS_COMMAND}
-
- ${@get_imagecmds(d)}
-
- ${IMAGE_POSTPROCESS_COMMAND}
-
- ${MACHINE_POSTPROCESS_COMMAND}
-
- if [ -n "${IMAGE_LINK_NAME}" -a -f "${IMAGE_MANIFEST}" ]; then
- rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest
- ln -s ${IMAGE_NAME}.rootfs.manifest ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.manifest
- fi
+ # generate final images
+ create_image(d)
}
insert_feed_uris () {
@@ -414,23 +283,6 @@ insert_feed_uris () {
done
}
-log_check() {
- for target in $*
- do
- lf_path="`dirname ${BB_LOGFILE}`/log.do_$target.${PID}"
-
- echo "log_check: Using $lf_path as logfile"
-
- if test -e "$lf_path"
- then
- ${IMAGE_PKGTYPE}_log_check $target $lf_path
- else
- echo "Cannot find logfile [$lf_path]"
- fi
- echo "Logfile is clean"
- done
-}
-
MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${libexecdir}|"
MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py"
MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib"
@@ -473,98 +325,6 @@ multilib_sanity_check() {
echo $@ | python ${MULTILIB_CHECK_FILE}
}
-get_split_linguas() {
- for translation in ${IMAGE_LINGUAS}; do
- translation_split=$(echo ${translation} | awk -F '-' '{print $1}')
- echo ${translation}
- echo ${translation_split}
- done | sort | uniq
-}
-
-rootfs_install_complementary() {
- # Install complementary packages based upon the list of currently installed packages
- # e.g. locales, *-dev, *-dbg, etc. This will only attempt to install these packages,
- # if they don't exist then no error will occur.
- # Note: every backend needs to call this function explicitly after the normal
- # package installation
-
- # Get list of installed packages
- list_installed_packages arch > ${WORKDIR}/installed_pkgs.txt
-
- # Apply the globs to all the packages currently installed
- if [ -n "$1" -a "$1" = "populate_sdk" ] ; then
- GLOBS="${SDKIMAGE_INSTALL_COMPLEMENTARY}"
- elif [ -n "$1" ]; then
- GLOBS="$@"
- else
- GLOBS="${IMAGE_INSTALL_COMPLEMENTARY}"
- # Add locales
- SPLIT_LINGUAS=`get_split_linguas`
- PACKAGES_TO_INSTALL=""
- for lang in $SPLIT_LINGUAS ; do
- GLOBS="$GLOBS *-locale-$lang"
- done
- fi
-
- if [ "$GLOBS" != "" ] ; then
- # Use the magic script to do all the work for us :)
- : > ${WORKDIR}/complementary_pkgs.txt
- oe-pkgdata-util glob ${PKGDATA_DIR} ${WORKDIR}/installed_pkgs.txt "$GLOBS" >> ${WORKDIR}/complementary_pkgs.txt
-
- # Install the packages, if any
- sed -i '/^$/d' ${WORKDIR}/complementary_pkgs.txt
- if [ -s ${WORKDIR}/complementary_pkgs.txt ]; then
- echo "Installing complementary packages"
- rootfs_install_packages ${WORKDIR}/complementary_pkgs.txt
- fi
- fi
-
- # Workaround for broken shell function dependencies
- if false ; then
- get_split_linguas
- fi
-}
-
-rootfs_uninstall_unneeded () {
- if ${@base_contains("IMAGE_FEATURES", "package-management", "false", "true", d)}; then
- if [ -z "$(delayed_postinsts)" ]; then
- # All packages were successfully configured.
- # update-rc.d, base-passwd, run-postinsts are no further use, remove them now
- remove_run_postinsts=false
- if [ -e ${IMAGE_ROOTFS}${sbindir}/run-postinsts ]; then
- remove_run_postinsts=true
- fi
-
- # Remove package only if it's installed
- pkgs_to_remove="update-rc.d base-passwd update-alternatives shadow ${ROOTFS_BOOTSTRAP_INSTALL}"
- for pkg in $pkgs_to_remove; do
- # regexp for pkg, to be used in grep and sed
- pkg_regexp="^`echo $pkg | sed 's/\./\\\./'` "
- if grep -q "$pkg_regexp" ${WORKDIR}/installed_pkgs.txt; then
- rootfs_uninstall_packages $pkg
- sed -i "/$pkg_regexp/d" ${WORKDIR}/installed_pkgs.txt
- fi
- done
-
- # Need to remove rc.d files for run-postinsts by hand since opkg won't
- # call postrm scripts in offline root mode.
- if $remove_run_postinsts; then
- update-rc.d -f -r ${IMAGE_ROOTFS} run-postinsts remove
- fi
- else
- # Some packages were not successfully configured, save them only
- # if we have run-postinsts script present. Otherwise, they're
- # useless
- if [ -e ${IMAGE_ROOTFS}${sbindir}/run-postinsts ]; then
- save_postinsts
- fi
- fi
-
- # Since no package manager is present in the image the metadata is not needed
- remove_packaging_data_files
- fi
-}
-
# This function is intended to disallow empty root password if 'debug-tweaks' is not in IMAGE_FEATURES.
zap_empty_root_password () {
if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 48675b8794..393bfa82eb 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -1,122 +1,9 @@
-def get_imagecmds(d):
- cmds = "\n"
- old_overrides = d.getVar('OVERRIDES', 0)
-
- alltypes = d.getVar('IMAGE_FSTYPES', True).split()
- types = []
- ctypes = d.getVar('COMPRESSIONTYPES', True).split()
- cimages = {}
-
- # Image type b depends on a having been generated first
- def addtypedepends(a, b):
- if a in alltypes:
- alltypes.remove(a)
- if b not in alltypes:
- alltypes.append(b)
- alltypes.append(a)
-
- # The elf image depends on the cpio.gz image already having
- # been created, so we add that explicit ordering here.
- addtypedepends("elf", "cpio.gz")
-
- # jffs2 sumtool'd images need jffs2
- addtypedepends("sum.jffs2", "jffs2")
-
- # Filter out all the compressed images from alltypes
- for type in alltypes:
- basetype = None
- for ctype in ctypes:
- if type.endswith("." + ctype):
- basetype = type[:-len("." + ctype)]
- if basetype not in types:
- types.append(basetype)
- if basetype not in cimages:
- cimages[basetype] = []
- if ctype not in cimages[basetype]:
- cimages[basetype].append(ctype)
- break
- if not basetype and type not in types:
- types.append(type)
-
- # Live and VMDK images will be processed via inheriting
- # bbclass and does not get processed here.
- # vmdk depend on live images also depend on ext3 so ensure its present
- # Note: we need to ensure ext3 is in alltypes, otherwise, subimages may
- # not contain ext3 and the .rootfs.ext3 file won't be created.
- if "vmdk" in types:
- if "ext3" not in types:
- types.append("ext3")
- if "ext3" not in alltypes:
- alltypes.append("ext3")
- types.remove("vmdk")
- if "live" in types or "iso" in types or "hddimg" in types:
- if "ext3" not in types:
- types.append("ext3")
- if "ext3" not in alltypes:
- alltypes.append("ext3")
- if "live" in types:
- types.remove("live")
- if "iso" in types:
- types.remove("iso")
- if "hddimg" in types:
- types.remove("hddimg")
-
- if d.getVar('IMAGE_LINK_NAME', True):
- if d.getVar('RM_OLD_IMAGE', True) == "1":
- # Remove the old image
- cmds += "\trm -f `find ${DEPLOY_DIR_IMAGE} -maxdepth 1 -type l -name ${IMAGE_LINK_NAME}'.*' -exec readlink -f {} \;`"
- # Remove the symlink
- cmds += "\n\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*"
-
- for type in types:
- ccmd = []
- subimages = []
- localdata = bb.data.createCopy(d)
- localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides))
- bb.data.update_data(localdata)
- localdata.setVar('type', type)
- if type in cimages:
- for ctype in cimages[type]:
- ccmd.append("\t" + localdata.getVar("COMPRESS_CMD_" + ctype, True))
- subimages.append(type + "." + ctype)
- if type not in alltypes:
- ccmd.append(localdata.expand("\trm ${IMAGE_NAME}.rootfs.${type}"))
- else:
- subimages.append(type)
- localdata.setVar('ccmd', "\n".join(ccmd))
- localdata.setVar('subimages', " ".join(subimages))
- cmd = localdata.getVar("IMAGE_CMD", True)
- localdata.setVar('cmd', cmd)
- cmds += "\n" + localdata.getVar("runimagecmd", True)
- return cmds
# The default aligment of the size of the rootfs is set to 1KiB. In case
# you're using the SD card emulation of a QEMU system simulator you may
# set this value to 2048 (2MiB alignment).
IMAGE_ROOTFS_ALIGNMENT ?= "1"
-runimagecmd () {
- # Image generation code for image type ${type}
- # The base_size gets calculated:
- # - initial size determined by `du -ks` of the IMAGE_ROOTFS
- # - then multiplied by the IMAGE_OVERHEAD_FACTOR
- # - tested against IMAGE_ROOTFS_SIZE
- # - round up ROOTFS_SIZE to IMAGE_ROOTFS_ALIGNMENT
- ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS} | awk '{base_size = $1 * ${IMAGE_OVERHEAD_FACTOR}; base_size = ((base_size > ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) + ${IMAGE_ROOTFS_EXTRA_SPACE}); if (base_size != int(base_size)) base_size = int(base_size + 1); base_size = base_size + ${IMAGE_ROOTFS_ALIGNMENT} - 1; base_size -= base_size % ${IMAGE_ROOTFS_ALIGNMENT}; print base_size }'`
- ${cmd}
- # Now create the needed compressed versions
- cd ${DEPLOY_DIR_IMAGE}/
- ${ccmd}
- # And create the symlinks
- if [ -n "${IMAGE_LINK_NAME}" ]; then
- for type in ${subimages}; do
- if [ -e ${IMAGE_NAME}.rootfs.$type ]; then
- ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
- fi
- done
- fi
-}
-
def imagetypes_getdepends(d):
def adddep(depstr, deps):
for i in (depstr or "").split():
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 5d316aa8b2..bf9739e099 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -15,38 +15,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:
# INSTALL_ROOTFS_DEB - install root dir
@@ -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
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass
index bcfa95003c..728ea0e2d1 100644
--- a/meta/classes/rootfs_deb.bbclass
+++ b/meta/classes/rootfs_deb.bbclass
@@ -21,118 +21,3 @@ 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}
- export INTERCEPT_DIR=${WORKDIR}/intercept_scripts
- export NATIVE_ROOT=${STAGING_DIR_NATIVE}
-
- # 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}
-
- if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
- delayed_postinsts="$(delayed_postinsts)"
- if [ -n "$delayed_postinsts" ]; then
- bberror "The following packages could not be configured offline and rootfs is read-only: $delayed_postinsts"
- exit 1
- fi
- fi
-
- log_check rootfs
-}
-
-rootfs_deb_do_rootfs[vardeps] += "delayed_postinsts"
-
-delayed_postinsts () {
- cat ${IMAGE_ROOTFS}/var/lib/dpkg/status|grep -e "^Package:" -e "^Status:"|sed -ne 'N;s/Package: \(.*\)\nStatus:.*unpacked/\1/p'
-}
-
-save_postinsts () {
- # Scripts need to be ordered when executed, this ensures numeric order
- # If we ever run into needing more the 899 scripts, we'll have to
- # change num to start with 1000.
- num=100
- for p in $(delayed_postinsts); do
- install -d ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts
- cp ${IMAGE_ROOTFS}/var/lib/dpkg/info/$p.postinst ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts/$num-$p
- num=`echo \$((num+1))`
- done
-}
-
-remove_packaging_data_files() {
- rm -rf ${IMAGE_ROOTFS}${opkglibdir}
- rm -rf ${IMAGE_ROOTFS}/var/lib/dpkg/
-}
-
-rootfs_install_packages() {
- ${STAGING_BINDIR_NATIVE}/apt-get ${APT_ARGS} 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
-}
-
-rootfs_uninstall_packages() {
- # for some reason, --root doesn't really work here... We use --admindir&--instdir instead.
- ${STAGING_BINDIR_NATIVE}/dpkg --admindir=${IMAGE_ROOTFS}/var/lib/dpkg --instdir=${IMAGE_ROOTFS} -r --force-depends $@
-}
-