summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorMark Hatle <mhatle@windriver.com>2010-08-21 22:44:21 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-23 20:56:47 +0100
commit59a3e98b044d3157e7472d35b1439a4a292c6693 (patch)
tree9562b2daac52cfea6b35a8733f067228b75f5ed2 /meta/classes
parent55a046bd4c4bf6e8ebb41a68205f46795f56fdbc (diff)
downloadopenembedded-core-59a3e98b044d3157e7472d35b1439a4a292c6693.tar.gz
openembedded-core-59a3e98b044d3157e7472d35b1439a4a292c6693.tar.bz2
openembedded-core-59a3e98b044d3157e7472d35b1439a4a292c6693.zip
rootfs_rpm: Enable multi dep solverdbs
Update package_rpm.bbclass to generate dep solver databases for each package arch. Following the example of the deb and ipk integration Revise the rootfs_rpm to solve the installation based on the multiple dep solvers. Note, recommends, locale and attemptonly pckages are still to be implemented. Signed-off-by: Mark Hatle <mhatle@windriver.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/package_rpm.bbclass51
-rw-r--r--meta/classes/rootfs_rpm.bbclass103
2 files changed, 93 insertions, 61 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 3334c9ae6a..f89fd94728 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -15,6 +15,57 @@ python package_rpm_install () {
bb.fatal("package_rpm_install not implemented!")
}
+#
+# Update the Packages depsolver db in ${DEPLOY_DIR_RPM}
+#
+package_update_index_rpm () {
+ rpmarchs="${PACKAGE_ARCHS}"
+
+ if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
+ return
+ fi
+
+ packagedirs=""
+ for arch in $rpmarchs ; do
+ sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
+ packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/$arch ${DEPLOY_DIR_RPM}/$sdkarch-nativesdk"
+ done
+
+ packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/${SDK_ARCH}-${TARGET_ARCH}-canadian"
+
+ cat /dev/null > ${DEPLOY_DIR_RPM}/solvedb.conf
+ for pkgdir in $packagedirs; do
+ if [ -e $pkgdir/ ]; then
+ rm -rf $pkgdir/solvedb
+ mkdir -p $pkgdir/solvedb
+ echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
+ find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
+ ${RPM} -i --replacepkgs --replacefiles --oldpackage \
+ -D "_dbpath $pkgdir/solvedb" --justdb \
+ --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
+ $pkgdir/solvedb/manifest
+ echo $pkgdir/solvedb >> ${DEPLOY_DIR_RPM}/solvedb.conf
+ fi
+ done
+}
+
+#
+# Generate an rpm configuration suitable for use against the
+# generated depsolver db's...
+#
+package_generate_rpm_conf () {
+ printf "_solve_dbpath " > ${DEPLOY_DIR_RPM}/solvedb.macro
+ colon=false
+ for each in `cat ${DEPLOY_DIR_RPM}/solvedb.conf` ; do
+ if [ "$colon" == true ]; then
+ printf ":" >> ${DEPLOY_DIR_RPM}/solvedb.macro
+ fi
+ printf "%s" $each >> ${DEPLOY_DIR_RPM}/solvedb.macro
+ colon=true
+ done
+ printf "\n" >> ${DEPLOY_DIR_RPM}/solvedb.macro
+}
+
python write_specfile () {
# We need to change '-' in a version field to '+'
# This needs to be done BEFORE the mapping_rename_hook
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 388387a52c..9c681f382b 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -17,80 +17,64 @@ do_rootfs[recrdeptask] += "do_package_write_rpm"
AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk"
-RPM_PREPROCESS_COMMANDS = ""
+RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf"
RPM_POSTPROCESS_COMMANDS = ""
fakeroot rootfs_rpm_do_rootfs () {
- set -x
-
+ set +x
+
${RPM_PREPROCESS_COMMANDS}
# Setup base system configuration
mkdir -p ${IMAGE_ROOTFS}/etc/rpm/
echo "${TARGET_ARCH}-linux" >${IMAGE_ROOTFS}/etc/rpm/platform
- # Instantiate the dep solver database
- mkdir -p ${IMAGE_ROOTFS}/var/lib/rpm_solver
-
- # Generate dep_solver manifest
- cat /dev/null > ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest
- echo "# Dynamically generated install manifest -- avoid small file bug" >> ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest
- for arch in ${PACKAGE_ARCHS}; do
- [ -d ${DEPLOY_DIR_RPM}/$arch ] && find ${DEPLOY_DIR_RPM}/$arch -type f >> ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest
- done
-
- ${RPM} --root ${IMAGE_ROOTFS} --dbpath /var/lib/rpm_solver --initdb
- ${RPM} --root ${IMAGE_ROOTFS} --dbpath /var/lib/rpm_solver -Uhv ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest --justdb --nodeps --noparentdirs --nolinktos
+ # Setup manifest of packages to install...
+ mkdir -p ${IMAGE_ROOTFS}/install
+ echo "# Install manifest" > ${IMAGE_ROOTFS}/install/install.manifest
- # Resolve Dependencies and Install
+ # Uclibc builds don't provide this stuff...
if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
if [ ! -z "${LINGUAS_INSTALL}" ]; then
for i in ${LINGUAS_INSTALL}; do
-: # Do not support locales yet
+ echo "LINGUAS: $i"
+ : # Do not support locales yet
done
fi
fi
if [ ! -z "${PACKAGE_INSTALL}" ]; then
- # Create the install manifest, starting with the PACKAGE_INSTALL packages
- touch ${IMAGE_ROOTFS}/install.manifest
- for each in ${PACKAGE_INSTALL} ; do
- # Map package name to filename
- pkg_name=$(${RPM} --root ${IMAGE_ROOTFS} --dbpath /var/lib/rpm_solver -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}" $each)
- echo Processing "$each $pkg_name"
- # Map filename to full path
- [ -n "$pkg_name" ] && grep "/"$pkg_name ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest >> ${IMAGE_ROOTFS}/install.manifest
+ for pkg in ${PACKAGE_INSTALL} ; do
+ echo "Processing $pkg..."
+ for solve in `cat ${DEPLOY_DIR_RPM}/solvedb.conf`; do
+ pkg_name=$(${RPM} -D "_dbpath $solve" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2)
+ if [ -n "$pkg_name" ]; then
+ break;
+ fi
+ done
+ if [ -z "$pkg_name" ]; then
+ echo "ERROR: Unable to find $pkg!"
+ exit 1
+ fi
+ echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
done
fi
- # Attempt to resolve dependencies and add missing packages to the install.manifest
- # Loop over the resolution until there is nothing else to resolve...
- # We log the solver.logs so we can track the dep solver process for debugging...
- resolver=1
- while [ $resolver -gt 0 ]; do
- (${RPM} --root ${IMAGE_ROOTFS} \
- --define '_solve_dbpath /var/lib/rpm_solver' --define '_solve_name_fmt add:%{___NVRA}.rpm' --aid \
- -Uhv --noparentdirs --nolinktos --test ${IMAGE_ROOTFS}/install.manifest > ${IMAGE_ROOTFS}/solver.log.$resolver 2>&1 || :)
-
- resolve_continue=false
- for each in `cat ${IMAGE_ROOTFS}/solver.log.$resolver | grep "add:" | cut -d : -f 2` ; do
- pkg_name=$each
- echo Processing "$each $pkg_name"
- # Map filename to full path
- [ -n "$pkg_name" ] && grep "/"$pkg_name ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest >> ${IMAGE_ROOTFS}/install.manifest
- resolve_continue=true
- done
- if [ "$resolve_continue" == "true" ]; then
- resolver=$(expr $resolver + 1)
- else
- resolver=0
- fi
- done
+ echo "Manifest: ${IMAGE_ROOTFS}/install/install.manifest"
+
+ # Generate an install solution by doing a --justdb install, then recreate it with
+ # an actual package install!
+ ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
+ -U --justdb --noscripts --notriggers --noparentdirs --nolinktos \
+ ${IMAGE_ROOTFS}/install/install.manifest
+
+ ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -qa --yaml \
+ | grep -i 'Packageorigin' | cut -d : -f 2 > ${IMAGE_ROOTFS}/install/install_solution.manifest
# Attempt install
- ${RPM} --root ${IMAGE_ROOTFS} \
- --define '_solve_dbpath /var/lib/rpm_solver' --define '_solve_name_fmt add:%{___NVRA}.rpm' --aid \
- -Uhv --noparentdirs --nolinktos --noscripts ${IMAGE_ROOTFS}/install.manifest
+ ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath /var/lib/rpm" \
+ --noscripts --notriggers --noparentdirs --nolinktos \
+ -Uhv ${IMAGE_ROOTFS}/install/install_solution.manifest
if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
: # fakechroot yum ${YUMARGS} -y install ${PACKAGE_INSTALL_ATTEMPTONLY} > ${WORKDIR}/temp/log.do_rootfs-attemptonly.${PID} || true
@@ -105,13 +89,12 @@ fakeroot rootfs_rpm_do_rootfs () {
export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
- #mkdir -p ${IMAGE_ROOTFS}/etc/opkg/
- #grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/opkg/arch.conf
-
${ROOTFS_POSTINSTALL_COMMAND}
mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/
- ${RPM} --root ${IMAGE_ROOTFS} -qa --queryformat 'Name: %{NAME}\n' --scripts > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
+ ${RPM} --root ${IMAGE_ROOTFS} -D '_dbpath /var/lib/rpm' -qa \
+ --qf 'Name: %{NAME}\n%|POSTIN?{postinstall scriptlet%|POSTINPROG?{ (using %{POSTINPROG})}|:\n%{POSTIN}\n}:{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|' \
+ > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
rm ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
@@ -154,11 +137,7 @@ EOF
rm -f ${IMAGE_ROOTFS}/var/lib/rpm/__db.*
# remove resolver files and manifests
- rm -f ${IMAGE_ROOTFS}/install.manifest
- rm -f ${IMAGE_ROOTFS}/solver.log.*
-
- # Remove resolver DB
- rm -rf ${IMAGE_ROOTFS}/var/lib/rpm_solver
+ rm -f ${IMAGE_ROOTFS}/install/install.manifest
log_check rootfs
}
@@ -184,10 +163,12 @@ rootfs_rpm_log_check() {
}
remove_packaging_data_files() {
+ exit 1
rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg/
}
install_all_locales() {
+ exit 1
PACKAGES_TO_INSTALL=""
@@ -216,6 +197,6 @@ python () {
flags = flags.replace("do_deploy", "")
flags = flags.replace("do_populate_sysroot", "")
bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d)
- bb.data.setVar('RPM_PREPROCESS_COMMANDS', "rpm_insert_feed_uris", d)
+ bb.data.setVar('RPM_PREPROCESS_COMMANDS', '', d)
bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d)
}