summaryrefslogtreecommitdiffstats
path: root/meta/classes/rootfs_rpm.bbclass
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2011-01-30 14:07:50 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-01 23:59:37 +0000
commit382075a9c2a5877d198a217161558da6ad2d5f89 (patch)
tree33b53b274eb1c921721f71cf87904e24851c7627 /meta/classes/rootfs_rpm.bbclass
parentb94f9ccd05a339a5e3e8ec4c7bd8c727ca575871 (diff)
downloadpoky-382075a9c2a5877d198a217161558da6ad2d5f89.tar.gz
rootfs_rpm/package_rpm.bbclass: Move func from rootfs_rpm to package_rpm
package_deb.bbclass: 1. Modified package_update_index_rpm() and package_generate_rpm_conf() to generate sperate depsolver db and rpm configuration, for target packages and host packages respectively. 2. Added new function package_install_internal_rpm() to install a list deb packages to a specified root directory, with the specified package architecutre information. 3. Added new function resolve_package_rpm() to resolve package names to filepaths. rootfs_deb.bbclass: Used the above new functions to install the rootfs. [sgw: merged changes for createrepo] Signed-off-by: Lianhao Lu <lianhao.lu@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/classes/rootfs_rpm.bbclass')
-rw-r--r--meta/classes/rootfs_rpm.bbclass145
1 files changed, 14 insertions, 131 deletions
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 26aaa1f8c3..d9a9c7d8a8 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -37,7 +37,7 @@ RPM="rpm ${RPMOPTS}"
37do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock" 37do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
38 38
39fakeroot rootfs_rpm_do_rootfs () { 39fakeroot rootfs_rpm_do_rootfs () {
40 set +x 40 #set +x
41 41
42 ${RPM_PREPROCESS_COMMANDS} 42 ${RPM_PREPROCESS_COMMANDS}
43 43
@@ -46,123 +46,18 @@ fakeroot rootfs_rpm_do_rootfs () {
46 # Setup base system configuration 46 # Setup base system configuration
47 mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ 47 mkdir -p ${IMAGE_ROOTFS}/etc/rpm/
48 48
49 # Default arch is the top.. 49 #install pacakges
50 echo "${TARGET_ARCH}-unknown-linux" >${IMAGE_ROOTFS}/etc/rpm/platform 50 export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
51 # Add the rest in sort order.. 51 export INSTALL_PLATFORM_RPM="${TARGET_ARCH}"
52 for each in ${PACKAGE_ARCHS} ; do 52 export INSTALL_PLATFORM_EXTRA_RPM="${PACKAGE_ARCHS}"
53 echo "$each""-unknown-linux" >>${IMAGE_ROOTFS}/etc/rpm/platform 53 export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}"
54 done 54 export INSTALL_PACKAGES_NORMAL_RPM="${PACKAGE_INSTALL}"
55 55 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
56 # Tell RPM that the "/" directory exist and is available 56 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
57 mkdir -p ${IMAGE_ROOTFS}/etc/rpm/sysinfo 57 export INSTALL_PROVIDENAME_RPM=""
58 echo "/" >${IMAGE_ROOTFS}/etc/rpm/sysinfo/Dirnames 58 export INSTALL_TASK_RPM="populate_sdk"
59
60 # Setup manifest of packages to install...
61 mkdir -p ${IMAGE_ROOTFS}/install
62 echo "# Install manifest" > ${IMAGE_ROOTFS}/install/install.manifest
63
64 # Uclibc builds don't provide this stuff...
65 if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then
66 if [ ! -z "${LINGUAS_INSTALL}" ]; then
67 for pkg in ${LINGUAS_INSTALL}; do
68 echo "Processing $pkg..."
69 pkg_name=$(resolve_package $pkg)
70 if [ -z "$pkg_name" ]; then
71 echo "Unable to find package $pkg!"
72 exit 1
73 fi
74 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
75 done
76 fi
77 fi
78 59
79 if [ ! -z "${PACKAGE_INSTALL}" ]; then 60 package_install_internal_rpm
80 for pkg in ${PACKAGE_INSTALL} ; do
81 echo "Processing $pkg..."
82 pkg_name=$(resolve_package $pkg)
83 if [ -z "$pkg_name" ]; then
84 echo "Unable to find package $pkg!"
85 exit 1
86 fi
87 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
88 done
89 fi
90
91 # Generate an install solution by doing a --justdb install, then recreate it with
92 # an actual package install!
93 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
94 -D "__dbi_txn create nofsync" \
95 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
96 ${IMAGE_ROOTFS}/install/install.manifest
97
98 if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then
99 echo "Adding attempt only packages..."
100 for pkg in ${PACKAGE_INSTALL_ATTEMPTONLY} ; do
101 echo "Processing $pkg..."
102 pkg_name=$(resolve_package $pkg)
103 if [ -z "$pkg_name" ]; then
104 echo "Unable to find package $pkg!"
105 exit 1
106 fi
107 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}"
108 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
109 -D "__dbi_txn create nofsync private" \
110 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
111 $pkg_name >> "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}" || true
112 done
113 fi
114
115#### Note: 'Recommends' is an arbitrary tag that means _SUGGESTS_ in Poky..
116 # Add any recommended packages to the image
117 # RPM does not solve for recommended packages because they are optional...
118 # So we query them and tree them like the ATTEMPTONLY packages above...
119 # Change the loop to "1" to run this code...
120 loop=0
121 if [ $loop -eq 1 ]; then
122 echo "Processing recommended packages..."
123 cat /dev/null > ${IMAGE_ROOTFS}/install/recommend.list
124 while [ $loop -eq 1 ]; do
125 # Dump the full set of recommends...
126 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
127 -D "__dbi_txn create nofsync private" \
128 -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${IMAGE_ROOTFS}/install/recommend
129 # Did we add more to the list?
130 grep -v -x -F -f ${IMAGE_ROOTFS}/install/recommend.list ${IMAGE_ROOTFS}/install/recommend > ${IMAGE_ROOTFS}/install/recommend.new || true
131 # We don't want to loop unless there is a change to the list!
132 loop=0
133 cat ${IMAGE_ROOTFS}/install/recommend.new | \
134 while read pkg ; do
135 # Ohh there was a new one, we'll need to loop again...
136 loop=1
137 echo "Processing $pkg..."
138 pkg_name=$(resolve_package $pkg)
139 if [ -z "$pkg_name" ]; then
140 echo "Unable to find package $pkg." >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}"
141 continue
142 fi
143 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}"
144 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \
145 -D "__dbi_txn create nofsync private" \
146 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
147 $pkg_name >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}" 2>&1 || true
148 done
149 cat ${IMAGE_ROOTFS}/install/recommend.list ${IMAGE_ROOTFS}/install/recommend.new | sort -u > ${IMAGE_ROOTFS}/install/recommend.new.list
150 mv ${IMAGE_ROOTFS}/install/recommend.new.list ${IMAGE_ROOTFS}/install/recommend.list
151 rm ${IMAGE_ROOTFS}/install/recommend ${IMAGE_ROOTFS}/install/recommend.new
152 done
153 fi
154
155 # Now that we have a solution, pull out a list of what to install...
156 echo "Manifest: ${IMAGE_ROOTFS}/install/install.manifest"
157 ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -qa --yaml \
158 -D "__dbi_txn create nofsync private" \
159 | grep -i 'Packageorigin' | cut -d : -f 2 > ${IMAGE_ROOTFS}/install/install_solution.manifest
160
161 # Attempt install
162 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \
163 --noscripts --notriggers --noparentdirs --nolinktos \
164 -D "__dbi_txn create nofsync private" \
165 -Uhv ${IMAGE_ROOTFS}/install/install_solution.manifest
166 61
167 export D=${IMAGE_ROOTFS} 62 export D=${IMAGE_ROOTFS}
168 export OFFLINE_ROOT=${IMAGE_ROOTFS} 63 export OFFLINE_ROOT=${IMAGE_ROOTFS}
@@ -227,7 +122,7 @@ EOF
227 122
228 # Workaround so the parser knows we need the resolve_package function! 123 # Workaround so the parser knows we need the resolve_package function!
229 if false ; then 124 if false ; then
230 resolve_package foo || true 125 resolve_package_rpm foo ${RPMCONF_TARGET_BASE}.conf || true
231 fi 126 fi
232} 127}
233 128
@@ -236,18 +131,6 @@ remove_packaging_data_files() {
236 rm -rf ${IMAGE_ROOTFS}${opkglibdir} 131 rm -rf ${IMAGE_ROOTFS}${opkglibdir}
237} 132}
238 133
239# Resolve package names to filepaths
240resolve_package() {
241 pkg="$1"
242 pkg_name=""
243 for solve in `cat ${DEPLOY_DIR_RPM}/solvedb.conf`; do
244 pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2)
245 if [ -n "$pkg_name" ]; then
246 break;
247 fi
248 done
249 echo $pkg_name
250}
251 134
252install_all_locales() { 135install_all_locales() {
253 PACKAGES_TO_INSTALL="" 136 PACKAGES_TO_INSTALL=""
@@ -263,7 +146,7 @@ install_all_locales() {
263 # but this should be good enough for the few users of this function... 146 # but this should be good enough for the few users of this function...
264 for pkg in $INSTALLED_PACKAGES; do 147 for pkg in $INSTALLED_PACKAGES; do
265 for lang in ${IMAGE_LOCALES}; do 148 for lang in ${IMAGE_LOCALES}; do
266 pkg_name=$(resolve_package $pkg-locale-$lang) 149 pkg_name=$(resolve_package_rpm $pkg-locale-$lang ${RPMCONF_TARGET_BASE}.conf)
267 if [ -n "$pkg_name" ]; then 150 if [ -n "$pkg_name" ]; then
268 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ 151 ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \
269 -D "__dbi_txn create nofsync private" \ 152 -D "__dbi_txn create nofsync private" \