2008-08-25 20:53:13 +00:00
|
|
|
#
|
|
|
|
# Creates a root filesystem out of rpm packages
|
|
|
|
#
|
|
|
|
|
2011-01-28 17:57:23 +00:00
|
|
|
ROOTFS_PKGMANAGE = "rpm zypper"
|
2011-07-07 16:39:32 +00:00
|
|
|
|
|
|
|
# Add 50Meg of extra space for zypper database space
|
|
|
|
IMAGE_ROOTFS_EXTRA_SPACE_append = "${@base_contains("PACKAGE_INSTALL", "zypper", " + 51200", "" ,d)}"
|
|
|
|
|
2011-01-28 17:57:23 +00:00
|
|
|
# Postinstalls on device are handled within this class at present
|
|
|
|
ROOTFS_PKGMANAGE_BOOTSTRAP = ""
|
2008-08-25 20:53:13 +00:00
|
|
|
|
2010-07-20 19:57:19 +00:00
|
|
|
do_rootfs[depends] += "rpm-native:do_populate_sysroot"
|
2012-07-23 09:43:22 +00:00
|
|
|
do_rootfs[depends] += "rpmresolve-native:do_populate_sysroot"
|
2008-10-31 16:23:11 +00:00
|
|
|
|
|
|
|
# Needed for update-alternatives
|
2009-11-10 14:55:23 +00:00
|
|
|
do_rootfs[depends] += "opkg-native:do_populate_sysroot"
|
2008-10-31 16:23:11 +00:00
|
|
|
|
2011-01-18 10:00:29 +00:00
|
|
|
# Creating the repo info in do_rootfs
|
2011-02-03 11:24:19 +00:00
|
|
|
#do_rootfs[depends] += "createrepo-native:do_populate_sysroot"
|
2011-01-18 10:00:29 +00:00
|
|
|
|
2008-08-25 20:53:13 +00:00
|
|
|
do_rootfs[recrdeptask] += "do_package_write_rpm"
|
|
|
|
|
2010-09-02 18:28:37 +00:00
|
|
|
RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf; "
|
2011-12-22 14:46:32 +00:00
|
|
|
RPM_POSTPROCESS_COMMANDS = "rootfs_install_all_locales; "
|
2010-09-02 18:28:37 +00:00
|
|
|
|
2011-04-18 14:23:27 +00:00
|
|
|
#
|
|
|
|
# Allow distributions to alter when [postponed] package install scripts are run
|
|
|
|
#
|
|
|
|
POSTINSTALL_INITPOSITION ?= "98"
|
|
|
|
|
2010-09-01 21:04:45 +00:00
|
|
|
rpmlibdir = "/var/lib/rpm"
|
2010-08-26 04:39:07 +00:00
|
|
|
opkglibdir = "${localstatedir}/lib/opkg"
|
|
|
|
|
2010-09-01 21:04:45 +00:00
|
|
|
RPMOPTS="--dbpath ${rpmlibdir} --define='_openall_before_chroot 1'"
|
2010-09-03 17:43:41 +00:00
|
|
|
RPM="rpm ${RPMOPTS}"
|
2010-09-01 21:04:45 +00:00
|
|
|
|
2010-10-07 14:41:17 +00:00
|
|
|
# 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"
|
|
|
|
|
2008-08-25 20:53:13 +00:00
|
|
|
fakeroot rootfs_rpm_do_rootfs () {
|
2011-11-10 17:43:02 +00:00
|
|
|
set +x
|
2010-08-22 05:44:21 +00:00
|
|
|
|
2008-10-07 16:47:22 +00:00
|
|
|
${RPM_PREPROCESS_COMMANDS}
|
2008-08-25 20:53:13 +00:00
|
|
|
|
2011-02-03 11:24:19 +00:00
|
|
|
#createrepo "${DEPLOY_DIR_RPM}"
|
2011-01-18 10:00:29 +00:00
|
|
|
|
2011-08-01 16:56:37 +00:00
|
|
|
# install packages
|
|
|
|
# This needs to work in the same way as populate_sdk_rpm.bbclass!
|
|
|
|
export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
|
2011-08-01 17:34:51 +00:00
|
|
|
export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
|
|
|
|
export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}"
|
2011-11-08 06:19:37 +00:00
|
|
|
export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
|
2011-08-01 17:34:51 +00:00
|
|
|
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"
|
2011-08-01 16:56:37 +00:00
|
|
|
|
2010-07-20 19:57:19 +00:00
|
|
|
# Setup base system configuration
|
2011-08-01 16:56:37 +00:00
|
|
|
mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
|
2011-01-28 01:13:01 +00:00
|
|
|
|
2011-02-16 04:56:13 +00:00
|
|
|
# List must be prefered to least preferred order
|
2011-02-25 23:31:50 +00:00
|
|
|
INSTALL_PLATFORM_EXTRA_RPM=""
|
2011-07-18 20:55:28 +00:00
|
|
|
for each_arch in ${MULTILIB_PACKAGE_ARCHS} ${PACKAGE_ARCHS}; do
|
2011-02-25 23:31:50 +00:00
|
|
|
INSTALL_PLATFORM_EXTRA_RPM="$each_arch $INSTALL_PLATFORM_EXTRA_RPM"
|
2011-02-16 04:56:13 +00:00
|
|
|
done
|
|
|
|
export INSTALL_PLATFORM_RPM
|
|
|
|
|
2011-01-30 06:07:50 +00:00
|
|
|
package_install_internal_rpm
|
2010-07-20 19:57:19 +00:00
|
|
|
|
2008-09-03 23:22:06 +00:00
|
|
|
export D=${IMAGE_ROOTFS}
|
|
|
|
export OFFLINE_ROOT=${IMAGE_ROOTFS}
|
|
|
|
export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
|
|
|
|
export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
|
2008-08-25 20:53:13 +00:00
|
|
|
|
|
|
|
${ROOTFS_POSTINSTALL_COMMAND}
|
2008-09-03 23:22:06 +00:00
|
|
|
|
2011-11-10 16:30:21 +00:00
|
|
|
# Report delayed package scriptlets
|
|
|
|
for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*; do
|
|
|
|
echo "Delayed package scriptlet: `head -n 3 $i | tail -n 1`"
|
2008-09-03 23:22:06 +00:00
|
|
|
done
|
2008-08-25 20:53:13 +00:00
|
|
|
|
2008-09-04 21:52:34 +00:00
|
|
|
install -d ${IMAGE_ROOTFS}/${sysconfdir}/rcS.d
|
|
|
|
# Stop $i getting expanded below...
|
|
|
|
i=\$i
|
2012-03-03 17:31:18 +00:00
|
|
|
cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF
|
2008-09-04 21:52:34 +00:00
|
|
|
#!/bin/sh
|
2011-11-10 16:30:21 +00:00
|
|
|
for i in /etc/rpm-postinsts/*; do
|
2008-09-04 21:52:34 +00:00
|
|
|
echo "Running postinst $i..."
|
2011-11-10 16:30:21 +00:00
|
|
|
if [ -f $i ] && $i; then
|
|
|
|
rm $i
|
2008-09-04 21:52:34 +00:00
|
|
|
else
|
|
|
|
echo "ERROR: postinst $i failed."
|
|
|
|
fi
|
|
|
|
done
|
2012-03-03 17:31:18 +00:00
|
|
|
rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
|
2008-09-04 21:52:34 +00:00
|
|
|
EOF
|
2012-03-03 17:31:18 +00:00
|
|
|
chmod 0755 ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
|
2008-09-04 21:52:34 +00:00
|
|
|
|
2008-08-25 20:53:13 +00:00
|
|
|
install -d ${IMAGE_ROOTFS}/${sysconfdir}
|
|
|
|
echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
|
|
|
|
|
2008-10-07 16:21:25 +00:00
|
|
|
${RPM_POSTPROCESS_COMMANDS}
|
2008-08-25 20:53:13 +00:00
|
|
|
${ROOTFS_POSTPROCESS_COMMAND}
|
|
|
|
|
|
|
|
rm -rf ${IMAGE_ROOTFS}/var/cache2/
|
|
|
|
rm -rf ${IMAGE_ROOTFS}/var/run2/
|
|
|
|
rm -rf ${IMAGE_ROOTFS}/var/log2/
|
|
|
|
|
2008-10-03 15:23:05 +00:00
|
|
|
# remove lock files
|
2010-09-01 21:04:45 +00:00
|
|
|
rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.*
|
2008-10-03 15:23:05 +00:00
|
|
|
|
2011-01-05 18:56:47 +00:00
|
|
|
# Move manifests into the directory with the logs
|
|
|
|
mv ${IMAGE_ROOTFS}/install/*.manifest ${T}/
|
|
|
|
|
|
|
|
# Remove all remaining resolver files
|
2011-01-06 00:45:56 +00:00
|
|
|
rm -rf ${IMAGE_ROOTFS}/install
|
2008-10-07 15:34:55 +00:00
|
|
|
|
2009-11-16 10:51:24 +00:00
|
|
|
log_check rootfs
|
2010-09-03 17:41:57 +00:00
|
|
|
|
|
|
|
# Workaround so the parser knows we need the resolve_package function!
|
2010-09-09 19:46:23 +00:00
|
|
|
if false ; then
|
2011-01-30 06:07:50 +00:00
|
|
|
resolve_package_rpm foo ${RPMCONF_TARGET_BASE}.conf || true
|
2010-09-09 19:46:23 +00:00
|
|
|
fi
|
2008-08-25 20:53:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
remove_packaging_data_files() {
|
2012-06-07 23:37:10 +00:00
|
|
|
# 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
|
2010-08-26 04:39:07 +00:00
|
|
|
rm -rf ${IMAGE_ROOTFS}${opkglibdir}
|
2008-08-25 20:53:13 +00:00
|
|
|
}
|
|
|
|
|
2011-11-30 16:48:47 +00:00
|
|
|
RPM_QUERY_CMD = '${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \
|
|
|
|
-D "__dbi_txn create nofsync private"'
|
|
|
|
|
|
|
|
list_installed_packages() {
|
|
|
|
${RPM_QUERY_CMD} -qa --qf "[%{NAME}\n]"
|
|
|
|
}
|
|
|
|
|
|
|
|
get_package_filename() {
|
|
|
|
resolve_package_rpm ${RPMCONF_TARGET_BASE}-base_archs.conf $1
|
|
|
|
}
|
|
|
|
|
|
|
|
list_package_depends() {
|
|
|
|
pkglist=`list_installed_packages`
|
|
|
|
|
2011-12-22 16:55:57 +00:00
|
|
|
# REQUIRE* lists "soft" requirements (which we know as recommends and RPM refers to
|
|
|
|
# as "suggests") so filter these out with the help of awk
|
|
|
|
for req in `${RPM_QUERY_CMD} -q --qf "[%{REQUIRENAME} %{REQUIREFLAGS}\n]" $1 | awk '{ if( and($2, 0x80000) == 0) print $1 }'`; do
|
2011-11-30 16:48:47 +00:00
|
|
|
if echo "$req" | grep -q "^rpmlib" ; then continue ; fi
|
|
|
|
|
|
|
|
realpkg=""
|
|
|
|
for dep in $pkglist; do
|
|
|
|
if [ "$dep" = "$req" ] ; then
|
|
|
|
realpkg="1"
|
|
|
|
echo $req
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "$realdep" = "" ] ; then
|
|
|
|
${RPM_QUERY_CMD} -q --whatprovides $req --qf "%{NAME}\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
list_package_recommends() {
|
2011-12-22 16:55:57 +00:00
|
|
|
${RPM_QUERY_CMD} -q --suggests $1
|
2011-11-30 16:48:47 +00:00
|
|
|
}
|
2010-09-01 21:04:45 +00:00
|
|
|
|
2011-12-22 14:46:32 +00:00
|
|
|
rootfs_check_package_exists() {
|
|
|
|
resolve_package_rpm ${RPMCONF_TARGET_BASE}-base_archs.conf $1
|
|
|
|
}
|
|
|
|
|
|
|
|
rootfs_install_packages() {
|
2011-12-28 09:16:11 +00:00
|
|
|
# The pkg to be installed here is not controlled by the
|
|
|
|
# package_install_internal_rpm, so it may have already been
|
|
|
|
# installed(e.g, installed in the first time when generate the
|
|
|
|
# rootfs), use '--replacepkgs' to always install them
|
2011-12-22 14:46:32 +00:00
|
|
|
for pkg in $@; do
|
|
|
|
${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \
|
|
|
|
-D "__dbi_txn create nofsync private" \
|
|
|
|
--noscripts --notriggers --noparentdirs --nolinktos \
|
2011-12-28 09:16:11 +00:00
|
|
|
--replacepkgs -Uhv $pkg || true
|
2010-09-02 18:28:37 +00:00
|
|
|
done
|
2008-08-25 20:53:13 +00:00
|
|
|
}
|
|
|
|
|
2008-10-07 16:47:22 +00:00
|
|
|
python () {
|
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
|
|
|
if d.getVar('BUILD_IMAGES_FROM_FEEDS', True):
|
|
|
|
flags = d.getVarFlag('do_rootfs', 'recrdeptask')
|
2008-10-07 16:47:22 +00:00
|
|
|
flags = flags.replace("do_package_write_rpm", "")
|
|
|
|
flags = flags.replace("do_deploy", "")
|
2009-11-10 14:55:23 +00:00
|
|
|
flags = flags.replace("do_populate_sysroot", "")
|
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
|
|
|
d.setVarFlag('do_rootfs', 'recrdeptask', flags)
|
|
|
|
d.setVar('RPM_PREPROCESS_COMMANDS', '')
|
|
|
|
d.setVar('RPM_POSTPROCESS_COMMANDS', '')
|
2011-07-18 20:55:28 +00:00
|
|
|
|
2012-07-06 19:13:59 +00:00
|
|
|
# The following code should be kept in sync w/ the populate_sdk_rpm version.
|
2011-07-18 20:55:28 +00:00
|
|
|
ml_package_archs = ""
|
2011-09-09 13:30:08 +00:00
|
|
|
ml_prefix_list = ""
|
2011-07-18 20:55:28 +00:00
|
|
|
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)
|
2011-09-02 03:38:43 +00:00
|
|
|
default_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + eext[1], False)
|
|
|
|
if default_tune:
|
|
|
|
localdata.setVar("DEFAULTTUNE", default_tune)
|
2011-09-08 13:35:37 +00:00
|
|
|
package_archs = localdata.getVar("PACKAGE_ARCHS", True) or ""
|
2011-09-28 11:44:28 +00:00
|
|
|
package_archs = " ".join([i in "all noarch any".split() and i or eext[1]+"_"+i for i in package_archs.split()])
|
2011-09-08 13:35:37 +00:00
|
|
|
ml_package_archs += " " + package_archs
|
2011-09-09 13:30:08 +00:00
|
|
|
ml_prefix_list += " " + eext[1]
|
2011-07-27 16:26:13 +00:00
|
|
|
#bb.note("ML_PACKAGE_ARCHS %s %s %s" % (eext[1], localdata.getVar("PACKAGE_ARCHS", True) or "(none)", overrides))
|
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
|
|
|
d.setVar('MULTILIB_PACKAGE_ARCHS', ml_package_archs)
|
|
|
|
d.setVar('MULTILIB_PREFIX_LIST', ml_prefix_list)
|
2008-10-07 16:47:22 +00:00
|
|
|
}
|