summaryrefslogtreecommitdiffstats
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
parent55a046bd4c4bf6e8ebb41a68205f46795f56fdbc (diff)
downloadpoky-59a3e98b044d3157e7472d35b1439a4a292c6693.tar.gz
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>
-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 () {
15 bb.fatal("package_rpm_install not implemented!") 15 bb.fatal("package_rpm_install not implemented!")
16} 16}
17 17
18#
19# Update the Packages depsolver db in ${DEPLOY_DIR_RPM}
20#
21package_update_index_rpm () {
22 rpmarchs="${PACKAGE_ARCHS}"
23
24 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
25 return
26 fi
27
28 packagedirs=""
29 for arch in $rpmarchs ; do
30 sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
31 packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/$arch ${DEPLOY_DIR_RPM}/$sdkarch-nativesdk"
32 done
33
34 packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/${SDK_ARCH}-${TARGET_ARCH}-canadian"
35
36 cat /dev/null > ${DEPLOY_DIR_RPM}/solvedb.conf
37 for pkgdir in $packagedirs; do
38 if [ -e $pkgdir/ ]; then
39 rm -rf $pkgdir/solvedb
40 mkdir -p $pkgdir/solvedb
41 echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
42 find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
43 ${RPM} -i --replacepkgs --replacefiles --oldpackage \
44 -D "_dbpath $pkgdir/solvedb" --justdb \
45 --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
46 $pkgdir/solvedb/manifest
47 echo $pkgdir/solvedb >> ${DEPLOY_DIR_RPM}/solvedb.conf
48 fi
49 done
50}
51
52#
53# Generate an rpm configuration suitable for use against the
54# generated depsolver db's...
55#
56package_generate_rpm_conf () {
57 printf "_solve_dbpath " > ${DEPLOY_DIR_RPM}/solvedb.macro
58 colon=false
59 for each in `cat ${DEPLOY_DIR_RPM}/solvedb.conf` ; do
60 if [ "$colon" == true ]; then
61 printf ":" >> ${DEPLOY_DIR_RPM}/solvedb.macro
62 fi
63 printf "%s" $each >> ${DEPLOY_DIR_RPM}/solvedb.macro
64 colon=true
65 done
66 printf "\n" >> ${DEPLOY_DIR_RPM}/solvedb.macro
67}
68
18python write_specfile () { 69python write_specfile () {
19 # We need to change '-' in a version field to '+' 70 # We need to change '-' in a version field to '+'
20 # This needs to be done BEFORE the mapping_rename_hook 71 # 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"
17 17
18AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk" 18AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk"
19 19
20RPM_PREPROCESS_COMMANDS = "" 20RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf"
21RPM_POSTPROCESS_COMMANDS = "" 21RPM_POSTPROCESS_COMMANDS = ""
22 22
23fakeroot rootfs_rpm_do_rootfs () { 23fakeroot rootfs_rpm_do_rootfs () {
24 set -x 24 set +x
25 25
26 ${RPM_PREPROCESS_COMMANDS} 26 ${RPM_PREPROCESS_COMMANDS}
27 27
28 # Setup base system configuration 28 # Setup base system configuration
29 mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ 29 mkdir -p ${IMAGE_ROOTFS}/etc/rpm/
30 echo "${TARGET_ARCH}-linux" >${IMAGE_ROOTFS}/etc/rpm/platform 30 echo "${TARGET_ARCH}-linux" >${IMAGE_ROOTFS}/etc/rpm/platform
31 31
32 # Instantiate the dep solver database 32 # Setup manifest of packages to install...
33 mkdir -p ${IMAGE_ROOTFS}/var/lib/rpm_solver 33 mkdir -p ${IMAGE_ROOTFS}/install
34 34 echo "# Install manifest" > ${IMAGE_ROOTFS}/install/install.manifest
35 # Generate dep_solver manifest
36 cat /dev/null > ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest
37 echo "# Dynamically generated install manifest -- avoid small file bug" >> ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest
38 for arch in ${PACKAGE_ARCHS}; do
39 [ -d ${DEPLOY_DIR_RPM}/$arch ] && find ${DEPLOY_DIR_RPM}/$arch -type f >> ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest
40 done
41
42 ${RPM} --root ${IMAGE_ROOTFS} --dbpath /var/lib/rpm_solver --initdb
43 ${RPM} --root ${IMAGE_ROOTFS} --dbpath /var/lib/rpm_solver -Uhv ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest --justdb --nodeps --noparentdirs --nolinktos
44 35
45 # Resolve Dependencies and Install 36 # Uclibc builds don't provide this stuff...
46 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 37 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
47 if [ ! -z "${LINGUAS_INSTALL}" ]; then 38 if [ ! -z "${LINGUAS_INSTALL}" ]; then
48 for i in ${LINGUAS_INSTALL}; do 39 for i in ${LINGUAS_INSTALL}; do
49: # Do not support locales yet 40 echo "LINGUAS: $i"
41 : # Do not support locales yet
50 done 42 done
51 fi 43 fi
52 fi 44 fi
53 45
54 if [ ! -z "${PACKAGE_INSTALL}" ]; then 46 if [ ! -z "${PACKAGE_INSTALL}" ]; then
55 # Create the install manifest, starting with the PACKAGE_INSTALL packages 47 for pkg in ${PACKAGE_INSTALL} ; do
56 touch ${IMAGE_ROOTFS}/install.manifest 48 echo "Processing $pkg..."
57 for each in ${PACKAGE_INSTALL} ; do 49 for solve in `cat ${DEPLOY_DIR_RPM}/solvedb.conf`; do
58 # Map package name to filename 50 pkg_name=$(${RPM} -D "_dbpath $solve" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2)
59 pkg_name=$(${RPM} --root ${IMAGE_ROOTFS} --dbpath /var/lib/rpm_solver -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}" $each) 51 if [ -n "$pkg_name" ]; then
60 echo Processing "$each $pkg_name" 52 break;
61 # Map filename to full path 53 fi
62 [ -n "$pkg_name" ] && grep "/"$pkg_name ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest >> ${IMAGE_ROOTFS}/install.manifest 54 done
55 if [ -z "$pkg_name" ]; then
56 echo "ERROR: Unable to find $pkg!"
57 exit 1
58 fi
59 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
63 done 60 done
64 fi 61 fi
65 62
66 # Attempt to resolve dependencies and add missing packages to the install.manifest 63 echo "Manifest: ${IMAGE_ROOTFS}/install/install.manifest"
67 # Loop over the resolution until there is nothing else to resolve... 64
68 # We log the solver.logs so we can track the dep solver process for debugging... 65 # Generate an install solution by doing a --justdb install, then recreate it with
69 resolver=1 66 # an actual package install!
70 while [ $resolver -gt 0 ]; do 67 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
71 (${RPM} --root ${IMAGE_ROOTFS} \ 68 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos \
72 --define '_solve_dbpath /var/lib/rpm_solver' --define '_solve_name_fmt add:%{___NVRA}.rpm' --aid \ 69 ${IMAGE_ROOTFS}/install/install.manifest
73 -Uhv --noparentdirs --nolinktos --test ${IMAGE_ROOTFS}/install.manifest > ${IMAGE_ROOTFS}/solver.log.$resolver 2>&1 || :) 70
74 71 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -qa --yaml \
75 resolve_continue=false 72 | grep -i 'Packageorigin' | cut -d : -f 2 > ${IMAGE_ROOTFS}/install/install_solution.manifest
76 for each in `cat ${IMAGE_ROOTFS}/solver.log.$resolver | grep "add:" | cut -d : -f 2` ; do
77 pkg_name=$each
78 echo Processing "$each $pkg_name"
79 # Map filename to full path
80 [ -n "$pkg_name" ] && grep "/"$pkg_name ${IMAGE_ROOTFS}/var/lib/rpm_solver/dep_solver.manifest >> ${IMAGE_ROOTFS}/install.manifest
81 resolve_continue=true
82 done
83 if [ "$resolve_continue" == "true" ]; then
84 resolver=$(expr $resolver + 1)
85 else
86 resolver=0
87 fi
88 done
89 73
90 # Attempt install 74 # Attempt install
91 ${RPM} --root ${IMAGE_ROOTFS} \ 75 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath /var/lib/rpm" \
92 --define '_solve_dbpath /var/lib/rpm_solver' --define '_solve_name_fmt add:%{___NVRA}.rpm' --aid \ 76 --noscripts --notriggers --noparentdirs --nolinktos \
93 -Uhv --noparentdirs --nolinktos --noscripts ${IMAGE_ROOTFS}/install.manifest 77 -Uhv ${IMAGE_ROOTFS}/install/install_solution.manifest
94 78
95 if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then 79 if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
96: # fakechroot yum ${YUMARGS} -y install ${PACKAGE_INSTALL_ATTEMPTONLY} > ${WORKDIR}/temp/log.do_rootfs-attemptonly.${PID} || true 80: # 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 () {
105 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} 89 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
106 export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} 90 export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
107 91
108 #mkdir -p ${IMAGE_ROOTFS}/etc/opkg/
109 #grep "^arch" ${IPKGCONF_TARGET} >${IMAGE_ROOTFS}/etc/opkg/arch.conf
110
111 ${ROOTFS_POSTINSTALL_COMMAND} 92 ${ROOTFS_POSTINSTALL_COMMAND}
112 93
113 mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/ 94 mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/
114 ${RPM} --root ${IMAGE_ROOTFS} -qa --queryformat 'Name: %{NAME}\n' --scripts > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined 95 ${RPM} --root ${IMAGE_ROOTFS} -D '_dbpath /var/lib/rpm' -qa \
96 --qf 'Name: %{NAME}\n%|POSTIN?{postinstall scriptlet%|POSTINPROG?{ (using %{POSTINPROG})}|:\n%{POSTIN}\n}:{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|' \
97 > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
115 awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined 98 awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
116 rm ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined 99 rm ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
117 100
@@ -154,11 +137,7 @@ EOF
154 rm -f ${IMAGE_ROOTFS}/var/lib/rpm/__db.* 137 rm -f ${IMAGE_ROOTFS}/var/lib/rpm/__db.*
155 138
156 # remove resolver files and manifests 139 # remove resolver files and manifests
157 rm -f ${IMAGE_ROOTFS}/install.manifest 140 rm -f ${IMAGE_ROOTFS}/install/install.manifest
158 rm -f ${IMAGE_ROOTFS}/solver.log.*
159
160 # Remove resolver DB
161 rm -rf ${IMAGE_ROOTFS}/var/lib/rpm_solver
162 141
163 log_check rootfs 142 log_check rootfs
164} 143}
@@ -184,10 +163,12 @@ rootfs_rpm_log_check() {
184} 163}
185 164
186remove_packaging_data_files() { 165remove_packaging_data_files() {
166 exit 1
187 rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg/ 167 rm -rf ${IMAGE_ROOTFS}/usr/lib/opkg/
188} 168}
189 169
190install_all_locales() { 170install_all_locales() {
171 exit 1
191 172
192 PACKAGES_TO_INSTALL="" 173 PACKAGES_TO_INSTALL=""
193 174
@@ -216,6 +197,6 @@ python () {
216 flags = flags.replace("do_deploy", "") 197 flags = flags.replace("do_deploy", "")
217 flags = flags.replace("do_populate_sysroot", "") 198 flags = flags.replace("do_populate_sysroot", "")
218 bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d) 199 bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d)
219 bb.data.setVar('RPM_PREPROCESS_COMMANDS', "rpm_insert_feed_uris", d) 200 bb.data.setVar('RPM_PREPROCESS_COMMANDS', '', d)
220 bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d) 201 bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d)
221} 202}