diff options
-rw-r--r-- | meta/classes/package_rpm.bbclass | 51 | ||||
-rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 103 |
2 files changed, 93 insertions, 61 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 3334c9ae6..f89fd9472 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 388387a52..9c681f382 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) } |