summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-09-01 16:04:45 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-03 09:44:56 +0100
commit2f68de1e88fb196c301039ad994782b1a0c6ac94 (patch)
treeebf03840ec8de390a81bce16b0ae04a48ae1101f /meta
parent84e1f5a68962e35f796fbfddacddd6d16a4532b6 (diff)
downloadpoky-2f68de1e88fb196c301039ad994782b1a0c6ac94.tar.gz
roots_rpm: Enable installation of recommended packages
Within RPM there is a field called "Suggests". This filed behaves like "Recommends" does in ipk. So we write out the packages using the Suggests field with the Poky 'Recommends' values... and then use the arbitrary tags to capture the Poky 'Suggests' within a new "Recommends" tag. Slightly confusing, but the end result is a functioning install. Also some performance enhancements were add at the same time. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package_rpm.bbclass12
-rw-r--r--meta/classes/rootfs_rpm.bbclass124
2 files changed, 104 insertions, 32 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index a5225dd809..3967ae294e 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -270,8 +270,10 @@ python write_specfile () {
270 splitrobsoletes = dep 270 splitrobsoletes = dep
271 271
272 print_deps(splitrdepends, "Requires", spec_preamble_bottom, d) 272 print_deps(splitrdepends, "Requires", spec_preamble_bottom, d)
273 print_deps(splitrrecommends, "Recommends", spec_preamble_bottom, d) 273 # Suggests in RPM are like recommends in Poky!
274 print_deps(splitrsuggests, "Suggests", spec_preamble_bottom, d) 274 print_deps(splitrrecommends, "Suggests", spec_preamble_bottom, d)
275 # While there is no analog for suggests... (So call them recommends for now)
276 print_deps(splitrsuggests, "Recommends", spec_preamble_bottom, d)
275 print_deps(splitrprovides, "Provides", spec_preamble_bottom, d) 277 print_deps(splitrprovides, "Provides", spec_preamble_bottom, d)
276 print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d) 278 print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d)
277 279
@@ -352,8 +354,10 @@ python write_specfile () {
352 354
353 print_deps(srcdepends, "BuildRequires", spec_preamble_top, d) 355 print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
354 print_deps(srcrdepends, "Requires", spec_preamble_top, d) 356 print_deps(srcrdepends, "Requires", spec_preamble_top, d)
355 print_deps(srcrrecommends, "Recommends", spec_preamble_top, d) 357 # Suggests in RPM are like recommends in Poky!
356 print_deps(srcrsuggests, "Suggests", spec_preamble_top, d) 358 print_deps(srcrrecommends, "Suggests", spec_preamble_top, d)
359 # While there is no analog for suggests... (So call them recommends for now)
360 print_deps(srcrsuggests, "Recommends", spec_preamble_top, d)
357 print_deps(srcrprovides, "Provides", spec_preamble_top, d) 361 print_deps(srcrprovides, "Provides", spec_preamble_top, d)
358 print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d) 362 print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
359 363
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index f56acada7c..ace9677f06 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -5,9 +5,6 @@
5ROOTFS_PKGMANAGE = "rpm" 5ROOTFS_PKGMANAGE = "rpm"
6ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts" 6ROOTFS_PKGMANAGE_BOOTSTRAP = "run-postinsts"
7 7
8RPMOPTS="--dbpath /var/lib/rpm --define='_openall_before_chroot 1'"
9RPM="${BUILD_ARCH}-${BUILD_OS}-rpm ${RPMOPTS}"
10
11do_rootfs[depends] += "rpm-native:do_populate_sysroot" 8do_rootfs[depends] += "rpm-native:do_populate_sysroot"
12 9
13# Needed for update-alternatives 10# Needed for update-alternatives
@@ -20,8 +17,12 @@ AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk"
20RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf" 17RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf"
21RPM_POSTPROCESS_COMMANDS = "" 18RPM_POSTPROCESS_COMMANDS = ""
22 19
20rpmlibdir = "/var/lib/rpm"
23opkglibdir = "${localstatedir}/lib/opkg" 21opkglibdir = "${localstatedir}/lib/opkg"
24 22
23RPMOPTS="--dbpath ${rpmlibdir} --define='_openall_before_chroot 1'"
24RPM="${BUILD_ARCH}-${BUILD_OS}-rpm ${RPMOPTS}"
25
25fakeroot rootfs_rpm_do_rootfs () { 26fakeroot rootfs_rpm_do_rootfs () {
26 set +x 27 set +x
27 28
@@ -38,9 +39,14 @@ fakeroot rootfs_rpm_do_rootfs () {
38 # Uclibc builds don't provide this stuff... 39 # Uclibc builds don't provide this stuff...
39 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then 40 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
40 if [ ! -z "${LINGUAS_INSTALL}" ]; then 41 if [ ! -z "${LINGUAS_INSTALL}" ]; then
41 for i in ${LINGUAS_INSTALL}; do 42 for pkg in ${LINGUAS_INSTALL}; do
42 echo "LINGUAS: $i" 43 echo "Processing $pkg..."
43 : # Do not support locales yet 44 pkg_name=$(resolve_package $pkg)
45 if [ -z '$pkg_name' ]; then
46 echo "Unable to find package $pkg!"
47 exit 1
48 fi
49 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
44 done 50 done
45 fi 51 fi
46 fi 52 fi
@@ -48,44 +54,89 @@ fakeroot rootfs_rpm_do_rootfs () {
48 if [ ! -z "${PACKAGE_INSTALL}" ]; then 54 if [ ! -z "${PACKAGE_INSTALL}" ]; then
49 for pkg in ${PACKAGE_INSTALL} ; do 55 for pkg in ${PACKAGE_INSTALL} ; do
50 echo "Processing $pkg..." 56 echo "Processing $pkg..."
51 for solve in `cat ${DEPLOY_DIR_RPM}/solvedb.conf`; do 57 pkg_name=$(resolve_package $pkg)
52 pkg_name=$(${RPM} -D "_dbpath $solve" -D "_dbi_tags_3 Packages:Name:Basenames:Providename:Nvra" -D "__dbi_cdb create mp_mmapsize=128Mb mp_size=1Mb nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2) 58 if [ -z '$pkg_name' ]; then
53 if [ -n "$pkg_name" ]; then 59 echo "Unable to find package $pkg!"
54 break;
55 fi
56 done
57 if [ -z "$pkg_name" ]; then
58 echo "ERROR: Unable to find $pkg!"
59 exit 1 60 exit 1
60 fi 61 fi
61 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest 62 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
62 done 63 done
63 fi 64 fi
64 65
65 echo "Manifest: ${IMAGE_ROOTFS}/install/install.manifest"
66
67 # Generate an install solution by doing a --justdb install, then recreate it with 66 # Generate an install solution by doing a --justdb install, then recreate it with
68 # an actual package install! 67 # an actual package install!
69 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \ 68 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
69 -D "__dbi_cdb create mp_mmapsize=128Mb mp_size=1Mb nofsync" \
70 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos \ 70 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos \
71 ${IMAGE_ROOTFS}/install/install.manifest 71 ${IMAGE_ROOTFS}/install/install.manifest
72 72
73 if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
74 echo "Adding attempt only packages..."
75 for pkg in ${PACKAGE_INSTALL_ATTEMPTONLY} ; do
76 echo "Processing $pkg..."
77 pkg_name=$(resolve_package $pkg)
78 if [ -z '$pkg_name' ]; then
79 echo "Unable to find package $pkg!"
80 exit 1
81 fi
82 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}"
83 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
84 -D "__dbi_cdb create mp_mmapsize=128Mb mp_size=1Mb nofsync private" \
85 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos \
86 $pkg_name >> "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}" || true
87 done
88 fi
89
90#### Note: 'Recommends' is an arbitrary tag that means _SUGGESTS_ in Poky..
91 # Add any recommended packages to the image
92 # RPM does not solve for recommended packages because they are optional...
93 # So we query them and tree them like the ATTEMPTONLY packages above...
94 # Change the loop to "1" to run this code...
95 loop=0
96 if [ $loop -eq 1 ]; then
97 echo "Processing recommended packages..."
98 cat /dev/null > ${IMAGE_ROOTFS}/install/recommend.list
99 while [ $loop -eq 1 ]; do
100 # Dump the full set of recommends...
101 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
102 -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${IMAGE_ROOTFS}/install/recommend
103 # Did we add more to the list?
104 grep -v -x -F -f ${IMAGE_ROOTFS}/install/recommend.list ${IMAGE_ROOTFS}/install/recommend > ${IMAGE_ROOTFS}/install/recommend.new || true
105 # We don't want to loop unless there is a change to the list!
106 loop=0
107 cat ${IMAGE_ROOTFS}/install/recommend.new | \
108 while read pkg ; do
109 # Ohh there was a new one, we'll need to loop again...
110 loop=1
111 echo "Processing $pkg..."
112 pkg_name=$(resolve_package $pkg || true)
113 if [ -z "$pkg_name" ]; then
114 echo "Unable to find package $pkg." >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}"
115 continue
116 fi
117 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}"
118 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
119 -D "__dbi_cdb create mp_mmapsize=128Mb mp_size=1Mb nofsync private" \
120 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos \
121 $pkg_name >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}" 2>&1 || true
122 done
123 cat ${IMAGE_ROOTFS}/install/recommend.list ${IMAGE_ROOTFS}/install/recommend.new | sort -u > ${IMAGE_ROOTFS}/install/recommend.new.list
124 mv ${IMAGE_ROOTFS}/install/recommend.new.list ${IMAGE_ROOTFS}/install/recommend.list
125 rm ${IMAGE_ROOTFS}/install/recommend ${IMAGE_ROOTFS}/install/recommend.new
126 done
127 fi
128
129 # Now that we have a solution, pull out a list of what to install...
130 echo "Manifest: ${IMAGE_ROOTFS}/install/install.manifest"
73 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -qa --yaml \ 131 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -qa --yaml \
74 | grep -i 'Packageorigin' | cut -d : -f 2 > ${IMAGE_ROOTFS}/install/install_solution.manifest 132 | grep -i 'Packageorigin' | cut -d : -f 2 > ${IMAGE_ROOTFS}/install/install_solution.manifest
75 133
76 # Attempt install 134 # Attempt install
77 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath /var/lib/rpm" \ 135 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \
78 --noscripts --notriggers --noparentdirs --nolinktos \ 136 --noscripts --notriggers --noparentdirs --nolinktos \
137 -D "__dbi_cdb create mp_mmapsize=128Mb mp_size=1Mb nofsync private" \
79 -Uhv ${IMAGE_ROOTFS}/install/install_solution.manifest 138 -Uhv ${IMAGE_ROOTFS}/install/install_solution.manifest
80 139
81 if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
82: # fakechroot yum ${YUMARGS} -y install ${PACKAGE_INSTALL_ATTEMPTONLY} > ${WORKDIR}/temp/log.do_rootfs-attemptonly.${PID} || true
83 fi
84
85 # Add any recommended packages to the image
86 # (added as an extra script since yum itself doesn't support this)
87: # yum-install-recommends.py ${IMAGE_ROOTFS} "fakechroot yum ${YUMARGS} -y install"
88
89 export D=${IMAGE_ROOTFS} 140 export D=${IMAGE_ROOTFS}
90 export OFFLINE_ROOT=${IMAGE_ROOTFS} 141 export OFFLINE_ROOT=${IMAGE_ROOTFS}
91 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} 142 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
@@ -94,7 +145,7 @@ fakeroot rootfs_rpm_do_rootfs () {
94 ${ROOTFS_POSTINSTALL_COMMAND} 145 ${ROOTFS_POSTINSTALL_COMMAND}
95 146
96 mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/ 147 mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/
97 ${RPM} --root ${IMAGE_ROOTFS} -D '_dbpath /var/lib/rpm' -qa \ 148 ${RPM} --root ${IMAGE_ROOTFS} -D '_dbpath ${rpmlibdir}' -qa \
98 --qf 'Name: %{NAME}\n%|POSTIN?{postinstall scriptlet%|POSTINPROG?{ (using %{POSTINPROG})}|:\n%{POSTIN}\n}:{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|' \ 149 --qf 'Name: %{NAME}\n%|POSTIN?{postinstall scriptlet%|POSTINPROG?{ (using %{POSTINPROG})}|:\n%{POSTIN}\n}:{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|' \
99 > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined 150 > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
100 awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined 151 awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined
@@ -136,7 +187,7 @@ EOF
136 rm -rf ${IMAGE_ROOTFS}/var/log2/ 187 rm -rf ${IMAGE_ROOTFS}/var/log2/
137 188
138 # remove lock files 189 # remove lock files
139 rm -f ${IMAGE_ROOTFS}/var/lib/rpm/__db.* 190 rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.*
140 191
141 # remove resolver files and manifests 192 # remove resolver files and manifests
142 rm -f ${IMAGE_ROOTFS}/install/install.manifest 193 rm -f ${IMAGE_ROOTFS}/install/install.manifest
@@ -165,11 +216,28 @@ rootfs_rpm_log_check() {
165} 216}
166 217
167remove_packaging_data_files() { 218remove_packaging_data_files() {
168 exit 1 219 rm -rf ${IMAGE_ROOTFS}${rpmlibdir}
169 rm -rf ${IMAGE_ROOTFS}${opkglibdir} 220 rm -rf ${IMAGE_ROOTFS}${opkglibdir}
170} 221}
171 222
223# Resolve package names to filepaths
224resolve_package() {
225 pkg="$1"
226 for solve in `cat ${DEPLOY_DIR_RPM}/solvedb.conf`; do
227 pkg_name=$(${RPM} -D "_dbpath $solve" -D "_dbi_tags_3 Packages:Name:Basenames:Providename:Nvra" -D "__dbi_cdb create mp_mmapsize=128Mb mp_size=1Mb nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2)
228 if [ -n "$pkg_name" ]; then
229 break;
230 fi
231 done
232 if [ -z "$pkg_name" ]; then
233 return 1
234 fi
235 echo $pkg_name
236 return 0
237}
238
172install_all_locales() { 239install_all_locales() {
240 echo "install_all_locales: not yet implemented!"
173 exit 1 241 exit 1
174 242
175 PACKAGES_TO_INSTALL="" 243 PACKAGES_TO_INSTALL=""