diff options
-rw-r--r-- | meta/classes/image.bbclass | 38 | ||||
-rw-r--r-- | meta/classes/package_ipk.bbclass | 197 | ||||
-rw-r--r-- | meta/classes/rootfs_ipk.bbclass | 109 |
3 files changed, 4 insertions, 340 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 0b35c719fd..ffe05c9040 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -287,44 +287,6 @@ MULTILIBRE_ALLOW_REP =. "${base_bindir}|${base_sbindir}|${bindir}|${sbindir}|${l MULTILIB_CHECK_FILE = "${WORKDIR}/multilib_check.py" MULTILIB_TEMP_ROOTFS = "${WORKDIR}/multilib" -multilib_generate_python_file() { - cat >${MULTILIB_CHECK_FILE} <<EOF -import sys, os, os.path -import re,filecmp - -allow_rep=re.compile(re.sub("\|$","","${MULTILIBRE_ALLOW_REP}")) -error_prompt="Multilib check error:" - -files={} -dirs=raw_input() -for dir in dirs.split(): - for root, subfolders, subfiles in os.walk(dir): - for file in subfiles: - item=os.path.join(root,file) - key=str(os.path.join("/",os.path.relpath(item,dir))) - - valid=True; - if key in files: - #check whether the file is allow to replace - if allow_rep.match(key): - valid=True - else: - if not filecmp.cmp(files[key],item): - valid=False - print("%s duplicate files %s %s is not the same\n" % (error_prompt, item, files[key])) - sys.exit(1) - - #pass the check, add to list - if valid: - files[key]=item -EOF -} - -multilib_sanity_check() { - multilib_generate_python_file - echo $@ | python ${MULTILIB_CHECK_FILE} -} - # 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/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 73446d6c59..68c8580761 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -10,207 +10,12 @@ PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks" # Program to be used to build opkg packages OPKGBUILDCMD ??= "opkg-build" -OPKG_ARGS = "-f $INSTALL_CONF_IPK -o $INSTALL_ROOTFS_IPK --force_postinstall --prefer-arch-to-version" +OPKG_ARGS = "--force_postinstall --prefer-arch-to-version" OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE', True) or "").split())][(d.getVar("PACKAGE_EXCLUDE", True) or "") != ""]}" OPKGLIBDIR = "${localstatedir}/lib" -package_tryout_install_multilib_ipk() { - #try install multilib - multilib_tryout_dirs="" - for item in ${MULTILIB_VARIANTS}; do - local target_rootfs="${MULTILIB_TEMP_ROOTFS}/${item}" - local ipkg_args="${OPKG_ARGS}" - local selected_pkg="" - local pkgname_prefix="${item}-" - local pkgname_len=${#pkgname_prefix} - for pkg in ${INSTALL_PACKAGES_MULTILIB_IPK}; do - local pkgname=$(echo $pkg | awk -v var=$pkgname_len '{ pkgname=substr($1, 1, var); print pkgname; }' ) - if [ ${pkgname} = ${pkgname_prefix} ]; then - selected_pkg="${selected_pkg} ${pkg}" - fi - done - if [ ! -z "${selected_pkg}" ]; then - rm -f ${target_rootfs} - mkdir -p ${target_rootfs}/${opkglibdir} - opkg-cl ${ipkg_args} update - opkg-cl ${ipkg_args} install ${selected_pkg} - multilib_tryout_dirs="${multilib_tryout_dirs} ${target_rootfs}" - fi - done -} - -split_multilib_packages() { - INSTALL_PACKAGES_NORMAL_IPK="" - INSTALL_PACKAGES_MULTILIB_IPK="" - for pkg in ${INSTALL_PACKAGES_IPK}; do - is_multilib=0 - for item in ${MULTILIB_VARIANTS}; do - local pkgname_prefix="${item}-" - local pkgname_len=${#pkgname_prefix} - local pkgname=$(echo $pkg | awk -v var=$pkgname_len '{ pkgname=substr($1, 1, var); print pkgname; }' ) - if [ ${pkgname} = ${pkgname_prefix} ]; then - is_multilib=1 - break - fi - done - - if [ ${is_multilib} = 0 ]; then - INSTALL_PACKAGES_NORMAL_IPK="${INSTALL_PACKAGES_NORMAL_IPK} ${pkg}" - else - INSTALL_PACKAGES_MULTILIB_IPK="${INSTALL_PACKAGES_MULTILIB_IPK} ${pkg}" - fi - done -} - -# -# install a bunch of packages using opkg -# the following shell variables needs to be set before calling this func: -# INSTALL_ROOTFS_IPK - install root dir -# INSTALL_CONF_IPK - configuration file -# INSTALL_PACKAGES_IPK - packages to be installed -# INSTALL_PACKAGES_ATTEMPTONLY_IPK - packages attemped to be installed only -# INSTALL_PACKAGES_LINGUAS_IPK - additional packages for uclibc -# INSTALL_TASK_IPK - task name - -package_install_internal_ipk() { - - local target_rootfs="${INSTALL_ROOTFS_IPK}" - local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}" - local package_linguas="${INSTALL_PACKAGES_LINGUAS_IPK}" - local task="${INSTALL_TASK_IPK}" - - split_multilib_packages - - local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}" - local package_multilib="${INSTALL_PACKAGES_MULTILIB_IPK}" - - mkdir -p ${target_rootfs}${OPKGLIBDIR}/opkg - touch ${target_rootfs}${OPKGLIBDIR}/opkg/status - - local ipkg_args="${OPKG_ARGS}" - - opkg-cl ${ipkg_args} update - - for i in ${package_linguas}; do - opkg-cl ${ipkg_args} install $i - done - - if [ ! -z "${package_to_install}" ]; then - opkg-cl ${ipkg_args} install ${package_to_install} - fi - - if [ ! -z "${package_attemptonly}" ]; then - opkg-cl ${ipkg_args} install ${package_attemptonly} > "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" || true - fi - - package_tryout_install_multilib_ipk - if [ ! -z "${MULTILIB_CHECK_FILE}" ]; then - #sanity check - multilib_sanity_check ${target_rootfs} ${multilib_tryout_dirs} || exit 1 - fi - - if [ ! -z "${package_multilib}" ]; then - opkg-cl ${ipkg_args} install ${package_multilib} - fi -} - -ipk_log_check() { - target="$1" - lf_path="$2" - - lf_txt="`cat $lf_path`" - for keyword_die in "exit 1" "Collected errors" ERR Fail - 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 "$keyword_die" - echo "" - do_exit=1 - fi - done - test "$do_exit" = 1 && exit 1 - true -} - -# -# Update the Packages index files in ${DEPLOY_DIR_IPK} -# -package_update_index_ipk () { - #set -x - - ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}" - - if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then - return - fi - - packagedirs="${DEPLOY_DIR_IPK}" - for arch in $ipkgarchs; do - packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch" - done - - multilib_archs="${MULTILIB_ARCHS}" - for arch in $multilib_archs; do - packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch" - done - - found=0 - for pkgdir in $packagedirs; do - if [ -e $pkgdir/ ]; then - found=1 - touch $pkgdir/Packages - flock $pkgdir/Packages.flock -c "opkg-make-index -r $pkgdir/Packages -p $pkgdir/Packages -m $pkgdir/" - fi - done - if [ "$found" != "1" ]; then - bbfatal "There are no packages in ${DEPLOY_DIR_IPK}!" - fi -} - -# -# 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 () { - package_generate_archlist - echo "src oe file:${DEPLOY_DIR_IPK}" >> ${IPKGCONF_SDK} - ipkgarchs="${SDK_PACKAGE_ARCHS}" - for arch in $ipkgarchs; do - if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then - echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${IPKGCONF_SDK} - fi - done - - echo "src oe file:${DEPLOY_DIR_IPK}" >> ${IPKGCONF_TARGET} - ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}" - for arch in $ipkgarchs; do - if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then - echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${IPKGCONF_TARGET} - fi - done -} - -package_generate_archlist () { - ipkgarchs="${SDK_PACKAGE_ARCHS}" - priority=1 - for arch in $ipkgarchs; do - echo "arch $arch $priority" >> ${IPKGCONF_SDK} - priority=$(expr $priority + 5) - done - - ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}" - priority=1 - for arch in $ipkgarchs; do - echo "arch $arch $priority" >> ${IPKGCONF_TARGET} - priority=$(expr $priority + 5) - done -} - python do_package_ipk () { import re, copy import textwrap diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass index f97f027804..9d63450dd1 100644 --- a/meta/classes/rootfs_ipk.bbclass +++ b/meta/classes/rootfs_ipk.bbclass @@ -15,117 +15,14 @@ rootfs_ipk_do_rootfs[vardepsexclude] += "BUILDNAME" do_rootfs[lockfiles] += "${WORKDIR}/ipk.lock" -OPKG_PREPROCESS_COMMANDS = "package_update_index_ipk; package_generate_ipkg_conf" +OPKG_PREPROCESS_COMMANDS = "" -OPKG_POSTPROCESS_COMMANDS = "ipk_insert_feed_uris; " +OPKG_POSTPROCESS_COMMANDS = "" OPKGLIBDIR = "${localstatedir}/lib" MULTILIBRE_ALLOW_REP = "${OPKGLIBDIR}/opkg" -fakeroot rootfs_ipk_do_rootfs () { - #set -x - - rm -f ${IPKGCONF_TARGET} - touch ${IPKGCONF_TARGET} - - ${OPKG_PREPROCESS_COMMANDS} - - mkdir -p ${T}/ - - export INSTALL_CONF_IPK="${IPKGCONF_TARGET}" - export INSTALL_ROOTFS_IPK="${IMAGE_ROOTFS}" - STATUS=${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/status - mkdir -p ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg - - opkg-cl ${OPKG_ARGS} update - - # prime the status file with bits that we don't want - for i in ${BAD_RECOMMENDATIONS}; do - pkginfo="`opkg-cl ${OPKG_ARGS} info $i`" - if [ ! -z "$pkginfo" ]; then - echo "$pkginfo" | awk "/^Status:/ { print \"Status: deinstall hold not-installed\n\" }" - >> $STATUS - else - echo "Requested ignored recommendation $i is not a package" - fi - done - - #install - export INSTALL_PACKAGES_ATTEMPTONLY_IPK="${PACKAGE_INSTALL_ATTEMPTONLY}" - export INSTALL_PACKAGES_LINGUAS_IPK="${LINGUAS_INSTALL}" - export INSTALL_TASK_IPK="rootfs" - - - export INSTALL_PACKAGES_IPK="${PACKAGE_INSTALL}" - - #post install - export D=${IMAGE_ROOTFS} - export OFFLINE_ROOT=${IMAGE_ROOTFS} - export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} - export OPKG_OFFLINE_ROOT=${IPKG_OFFLINE_ROOT} - export INTERCEPT_DIR=${WORKDIR}/intercept_scripts - export NATIVE_ROOT=${STAGING_DIR_NATIVE} - - package_install_internal_ipk - - # Distro specific packages should create this - #mkdir -p ${IMAGE_ROOTFS}/etc/opkg/ - #grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/opkg/arch.conf - - rootfs_install_complementary - - ${OPKG_POSTPROCESS_COMMANDS} - ${ROOTFS_POSTINSTALL_COMMAND} - - install -d ${IMAGE_ROOTFS}/${sysconfdir} - echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version - - ${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 - - rm -f ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/lists/* - log_check rootfs -} - -rootfs_ipk_do_rootfs[vardeps] += "delayed_postinsts" - -delayed_postinsts () { - cat ${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}/ipk-postinsts - cp ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg/info/$p.postinst ${IMAGE_ROOTFS}${sysconfdir}/ipk-postinsts/$num-$p - num=`echo \$((num+1))` - done -} - -remove_packaging_data_files() { - rm -rf ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg - # We need the directory for the package manager lock - mkdir ${IMAGE_ROOTFS}${OPKGLIBDIR}/opkg -} - -rootfs_install_packages() { - opkg-cl ${OPKG_ARGS} install `cat $1` -} - -rootfs_uninstall_packages() { - opkg-cl ${OPKG_ARGS} --force-depends remove $@ -} - ipk_insert_feed_uris () { echo "Building from feeds activated!" @@ -163,7 +60,7 @@ python () { flags = flags.replace("do_deploy", "") flags = flags.replace("do_populate_sysroot", "") d.setVarFlag('do_rootfs', 'recrdeptask', flags) - d.setVar('OPKG_PREPROCESS_COMMANDS', "package_generate_archlist\nipk_insert_feed_uris") + d.setVar('OPKG_PREPROCESS_COMMANDS', "ipk_insert_feed_uris") d.setVar('OPKG_POSTPROCESS_COMMANDS', '') } |