Cleanup rootfs_rpm,package_rpm bbclass files

This commit cleans up the functions that were ported to python.

(From OE-Core rev: a4fe5263a683b73d0318fe3c0c55382c084f25b5)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Hongxu Jia
2014-01-27 10:08:15 +08:00
committed by Richard Purdie
parent 4d8982a1c6
commit 62c625e3c1
2 changed files with 0 additions and 656 deletions

View File

@@ -12,478 +12,6 @@ PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm"
# packages. When set, this value merges them for efficiency.
MERGEPERFILEDEPS = "1"
#
# Update the packages indexes ${DEPLOY_DIR_RPM}
#
package_update_index_rpm () {
if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
return
fi
sdk_archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _`
target_archs=""
for i in ${MULTILIB_PREFIX_LIST} ; do
old_IFS="$IFS"
IFS=":"
set $i
IFS="$old_IFS"
shift # remove mlib
while [ -n "$1" ]; do
target_archs="$target_archs $1"
shift
done
done
# FIXME stopgap for broken "bitbake package-index" since MULTILIB_PREFIX_LIST isn't set for that
if [ "$target_archs" = "" ] ; then
target_archs="${ALL_MULTILIB_PACKAGE_ARCHS}"
fi
target_archs=`echo "$target_archs" | tr - _`
archs=`for arch in $target_archs $sdk_archs ; do
echo $arch
done | sort | uniq`
found=0
for arch in $archs; do
if [ -d ${DEPLOY_DIR_RPM}/$arch ] ; then
createrepo --update -q ${DEPLOY_DIR_RPM}/$arch
found=1
fi
done
if [ "$found" != "1" ]; then
bbfatal "There are no packages in ${DEPLOY_DIR_RPM}!"
fi
}
rpm_log_check() {
target="$1"
lf_path="$2"
lf_txt="`cat $lf_path`"
for keyword_die in "unpacking of archive failed" "Cannot find package" "exit 1" 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 -i "$keyword_die"
echo ""
do_exit=1
fi
done
test "$do_exit" = 1 && exit 1
true
}
# Translate the RPM/Smart format names to the OE multilib format names
# Input via stdin (only the first item per line is converted!)
# Output via stdout
translate_smart_to_oe() {
arg1="$1"
# Dump installed packages
while read pkg arch other ; do
found=0
if [ -z "$pkg" ]; then
continue
fi
new_pkg=$pkg
fixed_arch=`echo "$arch" | tr _ -`
for i in ${MULTILIB_PREFIX_LIST} ; do
old_IFS="$IFS"
IFS=":"
set $i
IFS="$old_IFS"
mlib="$1"
shift
while [ -n "$1" ]; do
cmp_arch=$1
shift
fixed_cmp_arch=`echo "$cmp_arch" | tr _ -`
if [ "$fixed_arch" = "$fixed_cmp_arch" ]; then
if [ "$mlib" = "default" ]; then
new_pkg="$pkg"
new_arch=$cmp_arch
else
new_pkg="$mlib-$pkg"
# We need to strip off the ${mlib}_ prefix on the arch
new_arch=${cmp_arch#${mlib}_}
fi
# Workaround for bug 3565
# Simply look to see if we know of a package with that name, if not try again!
filename=`ls ${PKGDATA_DIR}/runtime-reverse/$new_pkg 2>/dev/null | head -n 1`
if [ -n "$filename" ] ; then
found=1
break
fi
# 'real' code
# found=1
# break
fi
done
if [ "$found" = "1" ] && [ "$fixed_arch" = "$fixed_cmp_arch" ]; then
break
fi
done
#echo "$pkg -> $new_pkg" >&2
if [ "$arg1" = "arch" ]; then
echo $new_pkg $new_arch $other
elif [ "$arg1" = "file" ]; then
echo $new_pkg $other $new_arch
else
echo $new_pkg $other
fi
done
}
# Translate the OE multilib format names to the RPM/Smart format names
# Input via arguments
# Ouput via pkgs_to_install
translate_oe_to_smart() {
default_archs=""
sdk_mode=""
if [ "$1" = "--sdk" ]; then
shift
sdk_mode="true"
# Need to reverse the order of the SDK_ARCHS highest -> lowest priority
archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _`
for arch in $archs ; do
default_archs="$arch $default_archs"
done
fi
attemptonly="Error"
if [ "$1" = "--attemptonly" ]; then
attemptonly="Warning"
shift
fi
# Dump a list of all available packages
[ ! -e ${target_rootfs}/install/tmp/fullpkglist.query ] && smart --data-dir=${target_rootfs}/var/lib/smart query --output ${target_rootfs}/install/tmp/fullpkglist.query
pkgs_to_install=""
for pkg in "$@" ; do
new_pkg="$pkg"
if [ -z "$sdk_mode" ]; then
for i in ${MULTILIB_PREFIX_LIST} ; do
old_IFS="$IFS"
IFS=":"
set $i
IFS="$old_IFS"
mlib="$1"
shift
if [ "$mlib" = "default" ]; then
if [ -z "$default_archs" ]; then
default_archs=$@
fi
continue
fi
subst=${pkg#${mlib}-}
if [ "$subst" != "$pkg" ]; then
feeds=$@
while [ -n "$1" ]; do
arch="$1"
arch=`echo "$arch" | tr - _`
shift
if grep -q '^'$subst'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then
new_pkg="$subst@$arch"
# First found is best match
break
fi
done
if [ "$pkg" = "$new_pkg" ]; then
# Failed to translate, package not found!
echo "$attemptonly: $pkg not found in the $mlib feeds ($feeds)." >&2
if [ "$attemptonly" = "Error" ]; then
exit 1
fi
continue
fi
fi
done
fi
# Apparently not a multilib package...
if [ "$pkg" = "$new_pkg" ]; then
default_archs_fixed=`echo "$default_archs" | tr - _`
for arch in $default_archs_fixed ; do
if grep -q '^'$pkg'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then
new_pkg="$pkg@$arch"
# First found is best match
break
fi
done
if [ "$pkg" = "$new_pkg" ]; then
# Failed to translate, package not found!
echo "$attemptonly: $pkg not found in the base feeds ($default_archs)." >&2
if [ "$attemptonly" = "Error" ]; then
exit 1
fi
continue
fi
fi
#echo "$pkg -> $new_pkg" >&2
pkgs_to_install="${pkgs_to_install} ${new_pkg}"
done
export pkgs_to_install
}
package_write_smart_config() {
# Write common configuration for host and target usage
smart --data-dir=$1/var/lib/smart config --set rpm-nolinktos=1
smart --data-dir=$1/var/lib/smart config --set rpm-noparentdirs=1
for i in ${BAD_RECOMMENDATIONS}; do
smart --data-dir=$1/var/lib/smart flag --set ignore-recommends $i
done
}
#
# Install a bunch of packages using rpm.
# There are two solutions in an image's FRESH generation:
# 1) main package solution
# 2) complementary solution
#
# It is different when incremental image generation is enabled:
# 1) The incremental image generation takes action during the main package
# installation, the previous installed complementary packages would
# usually be removed here, and the new complementary ones would be
# installed in the next step.
# 2) The complementary would always be installed since it is
# generated based on the first step's image.
#
# the following shell variables needs to be set before calling this func:
# INSTALL_ROOTFS_RPM - install root dir
# INSTALL_PLATFORM_RPM - main platform
# INSTALL_PLATFORM_EXTRA_RPM - extra platform
# INSTALL_PACKAGES_RPM - packages to be installed
# INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only
# INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc
# INSTALL_PROVIDENAME_RPM - content for provide name
# INSTALL_TASK_RPM - task name
# INSTALL_COMPLEMENTARY_RPM - 1 to enable complementary package install mode
package_install_internal_rpm () {
local target_rootfs="$INSTALL_ROOTFS_RPM"
local package_to_install="$INSTALL_PACKAGES_RPM"
local package_attemptonly="$INSTALL_PACKAGES_ATTEMPTONLY_RPM"
local package_linguas="$INSTALL_PACKAGES_LINGUAS_RPM"
local providename="$INSTALL_PROVIDENAME_RPM"
local task="$INSTALL_TASK_RPM"
local sdk_mode=""
if [ "$1" = "--sdk" ]; then
sdk_mode="--sdk"
fi
# Configure internal RPM environment when using Smart
export RPM_ETCRPM=${target_rootfs}/etc/rpm
# Setup temporary directory -- install...
rm -rf ${target_rootfs}/install
mkdir -p ${target_rootfs}/install/tmp
channel_priority=5
if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then
# Setup base system configuration
echo "Note: configuring RPM platform settings"
mkdir -p ${target_rootfs}/etc/rpm/
echo "$INSTALL_PLATFORM_RPM" > ${target_rootfs}/etc/rpm/platform
if [ ! -z "$INSTALL_PLATFORM_EXTRA_RPM" ]; then
for pt in $INSTALL_PLATFORM_EXTRA_RPM ; do
channel_priority=$(expr $channel_priority + 5)
pt=$(echo $pt | sed "s,-linux.*$,-linux\.*,")
echo "$pt" >> ${target_rootfs}/etc/rpm/platform
done
fi
# Tell RPM that the "/" directory exist and is available
echo "Note: configuring RPM system provides"
mkdir -p ${target_rootfs}/etc/rpm/sysinfo
echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames
if [ ! -z "$providename" ]; then
cat /dev/null > ${target_rootfs}/etc/rpm/sysinfo/Providename
for provide in $providename ; do
echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename
done
fi
# Configure RPM... we enforce these settings!
echo "Note: configuring RPM DB settings"
mkdir -p ${target_rootfs}${rpmlibdir}
mkdir -p ${target_rootfs}${rpmlibdir}/log
# After change the __db.* cache size, log file will not be generated automatically,
# that will raise some warnings, so touch a bare log for rpm write into it.
touch ${target_rootfs}${rpmlibdir}/log/log.0000000001
if [ ! -e ${target_rootfs}${rpmlibdir}/DB_CONFIG ]; then
cat > ${target_rootfs}${rpmlibdir}/DB_CONFIG << EOF
# ================ Environment
set_data_dir .
set_create_dir .
set_lg_dir ./log
set_tmp_dir ./tmp
set_flags db_log_autoremove on
# -- thread_count must be >= 8
set_thread_count 64
# ================ Logging
# ================ Memory Pool
set_cachesize 0 1048576 0
set_mp_mmapsize 268435456
# ================ Locking
set_lk_max_locks 16384
set_lk_max_lockers 16384
set_lk_max_objects 16384
mutex_set_max 163840
# ================ Replication
EOF
fi
# Create database so that smart doesn't complain (lazy init)
rpm --root $target_rootfs --dbpath /var/lib/rpm -qa > /dev/null
# Configure smart
echo "Note: configuring Smart settings"
rm -rf ${target_rootfs}/var/lib/smart
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-root=${target_rootfs}
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-dbpath=${rpmlibdir}
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._var=${localstatedir}
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp
package_write_smart_config ${target_rootfs}
# Do the following configurations here, to avoid them being saved for field upgrade
if [ "x${NO_RECOMMENDATIONS}" = "x1" ]; then
smart --data-dir=${target_rootfs}/var/lib/smart config --set ignore-all-recommends=1
fi
for i in ${PACKAGE_EXCLUDE}; do
smart --data-dir=${target_rootfs}/var/lib/smart flag --set exclude-packages $i
done
# Optional debugging
#smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-level=debug
#smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-log-file=/tmp/smart-debug-logfile
# Delay this until later...
#smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
for canonical_arch in $INSTALL_PLATFORM_EXTRA_RPM; do
arch=$(echo $canonical_arch | sed "s,\([^-]*\)-.*,\1,")
if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then
echo "Note: adding Smart channel $arch ($channel_priority)"
smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y
smart --data-dir=${target_rootfs}/var/lib/smart channel --set $arch priority=$channel_priority
touch ${target_rootfs}/install/channel.$arch.stamp
fi
channel_priority=$(expr $channel_priority - 5)
done
fi
# Construct install scriptlet wrapper
# 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.
#
cat << EOF > ${WORKDIR}/scriptlet_wrapper
#!/bin/bash
export PATH="${PATH}"
export D="${target_rootfs}"
export OFFLINE_ROOT="\$D"
export IPKG_OFFLINE_ROOT="\$D"
export OPKG_OFFLINE_ROOT="\$D"
export INTERCEPT_DIR="${WORKDIR}/intercept_scripts"
export NATIVE_ROOT=${STAGING_DIR_NATIVE}
\$2 \$1/\$3 \$4
if [ \$? -ne 0 ]; then
if [ \$4 -eq 1 ]; then
mkdir -p \$1/etc/rpm-postinsts
num=100
while [ -e \$1/etc/rpm-postinsts/\${num}-* ]; do num=\$((num + 1)); done
name=\`head -1 \$1/\$3 | cut -d' ' -f 2\`
echo "#!\$2" > \$1/etc/rpm-postinsts/\${num}-\${name}
echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${num}-\${name}
cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${num}-\${name}
chmod +x \$1/etc/rpm-postinsts/\${num}-\${name}
else
echo "Error: pre/post remove scriptlet failed"
fi
fi
EOF
echo "Note: configuring RPM cross-install scriptlet_wrapper"
chmod 0755 ${WORKDIR}/scriptlet_wrapper
smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._cross_scriptlet_wrapper=${WORKDIR}/scriptlet_wrapper
# Determine what to install
translate_oe_to_smart ${sdk_mode} ${package_to_install} ${package_linguas}
# If incremental install, we need to determine what we've got,
# what we need to add, and what to remove...
if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
# Dump the new solution
echo "Note: creating install solution for incremental install"
smart --data-dir=${target_rootfs}/var/lib/smart install -y --dump ${pkgs_to_install} 2> ${target_rootfs}/../solution.manifest
fi
if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
echo "Note: adding Smart RPM DB channel"
smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y
fi
# If incremental install, we need to determine what we've got,
# what we need to add, and what to remove...
if [ "${INC_RPM_IMAGE_GEN}" = "1" -a "${INSTALL_COMPLEMENTARY_RPM}" != "1" ]; then
# First upgrade everything that was previously installed to the latest version
echo "Note: incremental update -- upgrade packages in place"
smart --data-dir=${target_rootfs}/var/lib/smart upgrade
# Dump what is already installed
echo "Note: dump installed packages for incremental update"
smart --data-dir=${target_rootfs}/var/lib/smart query --installed --output ${target_rootfs}/../installed.manifest
sort ${target_rootfs}/../installed.manifest > ${target_rootfs}/../installed.manifest.sorted
sort ${target_rootfs}/../solution.manifest > ${target_rootfs}/../solution.manifest.sorted
comm -1 -3 ${target_rootfs}/../solution.manifest.sorted ${target_rootfs}/../installed.manifest.sorted \
> ${target_rootfs}/../remove.list
comm -2 -3 ${target_rootfs}/../solution.manifest.sorted ${target_rootfs}/../installed.manifest.sorted \
> ${target_rootfs}/../install.list
pkgs_to_remove=`cat ${target_rootfs}/../remove.list | xargs echo`
pkgs_to_install=`cat ${target_rootfs}/../install.list | xargs echo`
echo "Note: to be removed: ${pkgs_to_remove}"
for pkg in ${pkgs_to_remove}; do
echo "Debug: What required: $pkg"
smart --data-dir=${target_rootfs}/var/lib/smart query $pkg --show-requiredby
done
[ -n "$pkgs_to_remove" ] && smart --data-dir=${target_rootfs}/var/lib/smart remove -y ${pkgs_to_remove}
fi
echo "Note: to be installed: ${pkgs_to_install}"
[ -n "$pkgs_to_install" ] && smart --data-dir=${target_rootfs}/var/lib/smart install -y ${pkgs_to_install}
if [ -n "${package_attemptonly}" ]; then
echo "Note: installing attempt only packages..."
echo "Attempting $pkgs_to_install"
echo "Note: see `dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
translate_oe_to_smart ${sdk_mode} --attemptonly $package_attemptonly
echo "Attempting $pkgs_to_install" >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}"
smart --data-dir=${target_rootfs}/var/lib/smart install --attempt -y ${pkgs_to_install} >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || :
fi
}
# Construct per file dependencies file
def write_rpm_perfiledata(srcname, d):
workdir = d.getVar('WORKDIR', True)

View File

@@ -24,170 +24,10 @@ do_rootfs[depends] += "createrepo-native:do_populate_sysroot"
do_rootfs[recrdeptask] += "do_package_write_rpm"
rootfs_rpm_do_rootfs[vardepsexclude] += "BUILDNAME"
RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; "
RPM_POSTPROCESS_COMMANDS = "rpm_setup_smart_target_config; "
rpmlibdir = "/var/lib/rpm"
opkglibdir = "${localstatedir}/lib/opkg"
RPMOPTS="--dbpath ${rpmlibdir}"
RPM="rpm ${RPMOPTS}"
# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files
# in ${DEPLOY_DIR_RPM}. This can be removed if package_update_index_rpm can be called concurrently
do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
fakeroot rootfs_rpm_do_rootfs () {
${RPM_PREPROCESS_COMMANDS}
# install packages
# This needs to work in the same way as populate_sdk_rpm.bbclass!
export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
export INSTALL_PLATFORM_RPM="$(echo ${TARGET_ARCH} | tr - _)${TARGET_VENDOR}-${TARGET_OS}"
export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
export INSTALL_PROVIDENAME_RPM=""
export INSTALL_TASK_RPM="rootfs_rpm_do_rootfs"
export INSTALL_COMPLEMENTARY_RPM=""
# Setup base system configuration
mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
# List must be prefered to least preferred order
default_extra_rpm=""
INSTALL_PLATFORM_EXTRA_RPM=""
for os in ${MULTILIB_OS_LIST} ; do
old_IFS="$IFS"
IFS=":"
set -- $os
IFS="$old_IFS"
mlib=$1
mlib_os=$2
for prefix in ${MULTILIB_PREFIX_LIST} ; do
old_IFS="$IFS"
IFS=":"
set -- $prefix
IFS="$old_IFS"
if [ "$mlib" != "$1" ]; then
continue
fi
shift #remove mlib
while [ -n "$1" ]; do
platform="$(echo $1 | tr - _)-.*-$mlib_os"
if [ "$mlib" = "${BBEXTENDVARIANT}" ]; then
default_extra_rpm="$default_extra_rpm $platform"
else
INSTALL_PLATFORM_EXTRA_RPM="$INSTALL_PLATFORM_EXTRA_RPM $platform"
fi
shift
done
done
done
if [ -n "$default_extra_rpm" ]; then
INSTALL_PLATFORM_EXTRA_RPM="$default_extra_rpm $INSTALL_PLATFORM_EXTRA_RPM"
fi
export INSTALL_PLATFORM_EXTRA_RPM
package_install_internal_rpm
rootfs_install_complementary
export D=${IMAGE_ROOTFS}
export OFFLINE_ROOT=${IMAGE_ROOTFS}
export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
${ROOTFS_POSTINSTALL_COMMAND}
# Report delayed package scriptlets
for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*; do
if [ -f $i ]; then
echo "Delayed package scriptlet: `head -n 3 $i | tail -n 1`"
fi
done
install -d ${IMAGE_ROOTFS}/${sysconfdir}
echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
${RPM_POSTPROCESS_COMMANDS}
${ROOTFS_POSTPROCESS_COMMAND}
if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ] ; then
failed_pkgs=$(ls -A ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts)
if [ -n "$failed_pkgs" ] ; then
bberror "The following post-install scripts could not be run offline and rootfs is read-only: $failed_pkgs"
exit 1
fi
fi
fi
rm -rf ${IMAGE_ROOTFS}/var/cache2/
rm -rf ${IMAGE_ROOTFS}/var/run2/
rm -rf ${IMAGE_ROOTFS}/var/log2/
# remove lock files
rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.*
# Remove all remaining resolver files
rm -rf ${IMAGE_ROOTFS}/install
log_check rootfs
}
rootfs_rpm_do_rootfs[vardeps] += "delayed_postinsts"
delayed_postinsts() {
if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ]; then
ls ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts
fi
}
save_postinsts() {
# this is just a stub. For RPM, the failed postinstalls are already saved in
# /etc/rpm-postinsts
true
}
remove_packaging_data_files() {
# Save the rpmlib for increment rpm image generation
t="${T}/saved_rpmlib/var/lib"
rm -fr $t
mkdir -p $t
mv ${IMAGE_ROOTFS}${rpmlibdir} $t
rm -rf ${IMAGE_ROOTFS}${opkglibdir}
rm -rf ${IMAGE_ROOTFS}/var/lib/smart
}
rpm_setup_smart_target_config() {
# Set up smart configuration for the target
rm -rf ${IMAGE_ROOTFS}/var/lib/smart
smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y
package_write_smart_config ${IMAGE_ROOTFS}
rm -f ${IMAGE_ROOTFS}/var/lib/smart/config.old
}
rootfs_install_packages() {
# Note - we expect the variables not set here to already have been set
export INSTALL_PACKAGES_RPM=""
export INSTALL_PACKAGES_ATTEMPTONLY_RPM="`cat $1`"
export INSTALL_PROVIDENAME_RPM=""
export INSTALL_TASK_RPM="rootfs_install_packages"
export INSTALL_COMPLEMENTARY_RPM="1"
package_install_internal_rpm
}
rootfs_uninstall_packages() {
rpm -e --nodeps --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm\
--define='_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper'\
--define='_tmppath /install/tmp' $@
# remove temp directory
rm -rf ${IMAGE_ROOTFS}/install
}
python () {
if d.getVar('BUILD_IMAGES_FROM_FEEDS', True):
flags = d.getVarFlag('do_rootfs', 'recrdeptask')
@@ -198,28 +38,4 @@ python () {
d.setVar('RPM_PREPROCESS_COMMANDS', '')
d.setVar('RPM_POSTPROCESS_COMMANDS', '')
# The following code should be kept in sync w/ the populate_sdk_rpm version.
# package_arch order is reversed. This ensures the -best- match is listed first!
package_archs = d.getVar("PACKAGE_ARCHS", True) or ""
package_archs = ":".join(package_archs.split()[::-1])
package_os = d.getVar("TARGET_OS", True) or ""
ml_prefix_list = "%s:%s" % ('default', package_archs)
ml_os_list = "%s:%s" % ('default', package_os)
multilibs = d.getVar('MULTILIBS', True) or ""
for ext in multilibs.split():
eext = ext.split(':')
if len(eext) > 1 and eext[0] == 'multilib':
localdata = bb.data.createCopy(d)
default_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + eext[1], False)
if default_tune:
localdata.setVar("DEFAULTTUNE", default_tune)
bb.data.update_data(localdata)
package_archs = localdata.getVar("PACKAGE_ARCHS", True) or ""
package_archs = ":".join([i in "all noarch any".split() and i or eext[1]+"_"+i for i in package_archs.split()][::-1])
package_os = localdata.getVar("TARGET_OS", True) or ""
ml_prefix_list += " %s:%s" % (eext[1], package_archs)
ml_os_list += " %s:%s" % (eext[1], package_os)
d.setVar('MULTILIB_PREFIX_LIST', ml_prefix_list)
d.setVar('MULTILIB_OS_LIST', ml_os_list)
}