summaryrefslogtreecommitdiffstats
path: root/meta/classes/rootfs_rpm.bbclass
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/rootfs_rpm.bbclass
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>
Diffstat (limited to 'meta/classes/rootfs_rpm.bbclass')
-rw-r--r--meta/classes/rootfs_rpm.bbclass103
1 files changed, 42 insertions, 61 deletions
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}