summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-07-18 15:55:28 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-27 16:25:35 +0100
commit44b3590509d7af2fe5a6c52a8bd2d1d7fb29ef7c (patch)
tree25e397f9a1e997e4217713ef9e90f8c349090061
parentfae195515f5bb1beaff9bc2fde9135ff573facc4 (diff)
downloadpoky-44b3590509d7af2fe5a6c52a8bd2d1d7fb29ef7c.tar.gz
package/rootfs_rpm: Implement RPM multilib package handling
This is a first pass at adding multilib support to the RPM package and image handling code. (From OE-Core rev: 1939a4395997098862912e013a2b13ed2f385f9f) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package_rpm.bbclass229
-rw-r--r--meta/classes/rootfs_rpm.bbclass17
2 files changed, 160 insertions, 86 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 2cc57424c7..05f3929062 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -21,67 +21,71 @@ RPMCONF_HOST_BASE = "${DEPLOY_DIR_RPM}/solvedb-sdk"
21# Update the Packages depsolver db in ${DEPLOY_DIR_RPM} 21# Update the Packages depsolver db in ${DEPLOY_DIR_RPM}
22# 22#
23package_update_index_rpm () { 23package_update_index_rpm () {
24 rpmarchs="${PACKAGE_ARCHS}"
25
26 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then 24 if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
27 return 25 return
28 fi 26 fi
29 27
30 packagedirs="" 28 base_package_archs="${PACKAGE_ARCHS}"
31 packagedirs_sdk="" 29 ml_package_archs="${MULTILIB_PACKAGE_ARCHS}"
32 for arch in $rpmarchs ; do 30
33 sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'` 31 for archvar in base_package_archs ml_package_archs; do
34 extension="-nativesdk" 32 eval archs=\${${archvar}}
35 if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then 33 packagedirs=""
36 extension="" 34 packagedirs_sdk=""
37 fi 35 for arch in $archs; do
38 packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs" 36 sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'`
39 packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk" 37 extension="-nativesdk"
38 if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then
39 extension=""
40 fi
41 packagedirs="${DEPLOY_DIR_RPM}/$arch $packagedirs"
42 packagedirs_sdk="${DEPLOY_DIR_RPM}/$sdkarch$extension $packagedirs_sdk"
40 43
41 rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb 44 rm -rf ${DEPLOY_DIR_RPM}/$arch/solvedb
42 rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb 45 rm -rf ${DEPLOY_DIR_RPM}/$sdkarch$extension/solvedb
43 done 46 done
44 47
45 cat /dev/null > ${RPMCONF_TARGET_BASE}.conf 48 cat /dev/null > ${RPMCONF_TARGET_BASE}-${archvar}.conf
46 for pkgdir in $packagedirs; do 49 for pkgdir in $packagedirs; do
47 if [ -e $pkgdir/ ]; then 50 if [ -e $pkgdir/ ]; then
48 echo "Generating solve db for $pkgdir..." 51 echo "Generating solve db for $pkgdir..."
49 echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}.conf 52 echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}-${archvar}.conf
50 if [ -d $pkgdir/solvedb ]; then 53 if [ -d $pkgdir/solvedb ]; then
51 # We've already processed this and it's a duplicate 54 # We've already processed this and it's a duplicate
52 continue 55 continue
56 fi
57 mkdir -p $pkgdir/solvedb
58 echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
59 find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
60 ${RPM} -i --replacepkgs --replacefiles --oldpackage \
61 -D "_dbpath $pkgdir/solvedb" --justdb \
62 --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
63 --ignoresize --nosignature --nodigest \
64 -D "__dbi_txn create nofsync" \
65 $pkgdir/solvedb/manifest
53 fi 66 fi
54 mkdir -p $pkgdir/solvedb 67 done
55 echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
56 find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
57 ${RPM} -i --replacepkgs --replacefiles --oldpackage \
58 -D "_dbpath $pkgdir/solvedb" --justdb \
59 --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
60 --ignoresize --nosignature --nodigest \
61 -D "__dbi_txn create nofsync" \
62 $pkgdir/solvedb/manifest
63 fi
64 done
65 68
66 cat /dev/null > ${RPMCONF_HOST_BASE}.conf 69 cat /dev/null > ${RPMCONF_HOST_BASE}.conf
67 for pkgdir in $packagedirs_sdk; do 70 for pkgdir in $packagedirs_sdk; do
68 if [ -e $pkgdir/ ]; then 71 if [ -e $pkgdir/ ]; then
69 echo "Generating solve db for $pkgdir..." 72 echo "Generating solve db for $pkgdir..."
70 echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}.conf 73 echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}-${archvar}.conf
71 if [ -d $pkgdir/solvedb ]; then 74 if [ -d $pkgdir/solvedb ]; then
72 # We've already processed this and it's a duplicate 75 # We've already processed this and it's a duplicate
73 continue 76 continue
74 fi 77 fi
75 mkdir -p $pkgdir/solvedb 78 mkdir -p $pkgdir/solvedb
76 echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest 79 echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest
77 find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest 80 find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest
78 ${RPM} -i --replacepkgs --replacefiles --oldpackage \ 81 ${RPM} -i --replacepkgs --replacefiles --oldpackage \
79 -D "_dbpath $pkgdir/solvedb" --justdb \ 82 -D "_dbpath $pkgdir/solvedb" --justdb \
80 --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \ 83 --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \
81 --ignoresize --nosignature --nodigest \ 84 --ignoresize --nosignature --nodigest \
82 -D "__dbi_txn create nofsync" \ 85 -D "__dbi_txn create nofsync" \
83 $pkgdir/solvedb/manifest 86 $pkgdir/solvedb/manifest
84 fi 87 fi
88 done
85 done 89 done
86} 90}
87 91
@@ -91,25 +95,43 @@ package_update_index_rpm () {
91# 95#
92package_generate_rpm_conf () { 96package_generate_rpm_conf () {
93 printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro 97 printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro
94 colon=false 98 o_colon_t=false
95 for each in `cat ${RPMCONF_TARGET_BASE}.conf` ; do 99 o_colon_h=false
96 if [ "$colon" == true ]; then 100
97 printf ":" >> ${RPMCONF_TARGET_BASE}.macro 101 for archvar in base_package_archs ml_package_archs; do
98 fi 102 printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}-${archvar}.macro
99 printf "%s" $each >> ${RPMCONF_TARGET_BASE}.macro 103 colon=false
100 colon=true 104 for each in `cat ${RPMCONF_TARGET_BASE}-${archvar}.conf` ; do
101 done 105 if [ "$o_colon_t" == true ]; then
102 printf "\n" >> ${RPMCONF_TARGET_BASE}.macro 106 printf ":" >> ${RPMCONF_TARGET_BASE}.macro
107 fi
108 if [ "$colon" == true ]; then
109 printf ":" >> ${RPMCONF_TARGET_BASE}-${archvar}.macro
110 fi
111 printf "%s" $each >> ${RPMCONF_TARGET_BASE}.macro
112 o_colon_t=true
113 printf "%s" $each >> ${RPMCONF_TARGET_BASE}-${archvar}.macro
114 colon=true
115 done
116 printf "\n" >> ${RPMCONF_TARGET_BASE}-${archvar}.macro
103 117
104 printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro 118 printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}-${archvar}.macro
105 colon=false 119 colon=false
106 for each in `cat ${RPMCONF_HOST_BASE}.conf` ; do 120 for each in `cat ${RPMCONF_HOST_BASE}-${archvar}.conf` ; do
107 if [ "$colon" == true ]; then 121 if [ "$o_colon_h" == true ]; then
108 printf ":" >> ${RPMCONF_HOST_BASE}.macro 122 printf ":" >> ${RPMCONF_HOST_BASE}.macro
109 fi 123 fi
110 printf "%s" $each >> ${RPMCONF_HOST_BASE}.macro 124 if [ "$colon" == true ]; then
111 colon=true 125 printf ":" >> ${RPMCONF_HOST_BASE}-${archvar}.macro
126 fi
127 printf "%s" $each >> ${RPMCONF_HOST_BASE}.macro
128 o_colon_h=true
129 printf "%s" $each >> ${RPMCONF_HOST_BASE}-${archvar}.macro
130 colon=true
131 done
132 printf "\n" >> ${RPMCONF_HOST_BASE}-${archvar}.macro
112 done 133 done
134 printf "\n" >> ${RPMCONF_TARGET_BASE}.macro
113 printf "\n" >> ${RPMCONF_HOST_BASE}.macro 135 printf "\n" >> ${RPMCONF_HOST_BASE}.macro
114} 136}
115 137
@@ -139,11 +161,11 @@ rpm_log_check() {
139# resolve_pacakge <pkgname> <solvdb conffile> 161# resolve_pacakge <pkgname> <solvdb conffile>
140# 162#
141resolve_package_rpm () { 163resolve_package_rpm () {
142 local pkg="$1" 164 local conffile="$1"
143 local conffile="$2" 165 shift
144 local pkg_name="" 166 local pkg_name=""
145 for solve in `cat ${conffile}`; do 167 for solve in `cat ${conffile}`; do
146 pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2) 168 pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $@ | grep -i 'Packageorigin' | cut -d : -f 2)
147 if [ -n "$pkg_name" ]; then 169 if [ -n "$pkg_name" ]; then
148 break; 170 break;
149 fi 171 fi
@@ -178,10 +200,10 @@ package_install_internal_rpm () {
178 200
179 # Setup base system configuration 201 # Setup base system configuration
180 mkdir -p ${target_rootfs}/etc/rpm/ 202 mkdir -p ${target_rootfs}/etc/rpm/
181 echo "${platform}-poky-linux-gnu" > ${target_rootfs}/etc/rpm/platform 203 echo "${platform}${TARGET_VENDOR}-${TARGET_OS}" > ${target_rootfs}/etc/rpm/platform
182 if [ ! -z "$platform_extra" ]; then 204 if [ ! -z "$platform_extra" ]; then
183 for pt in $platform_extra ; do 205 for pt in $platform_extra ; do
184 echo "$pt-.*-linux.*" >> ${target_rootfs}/etc/rpm/platform 206 echo "$pt-.*-${TARGET_OS}" >> ${target_rootfs}/etc/rpm/platform
185 done 207 done
186 fi 208 fi
187 209
@@ -204,9 +226,16 @@ package_install_internal_rpm () {
204 if [ ! -z "${package_lingusa}" ]; then 226 if [ ! -z "${package_lingusa}" ]; then
205 for pkg in ${package_lingusa}; do 227 for pkg in ${package_lingusa}; do
206 echo "Processing $pkg..." 228 echo "Processing $pkg..."
207 pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf) 229
230 archvar=base_package_archs
231 ml_pkg=$(echo ${pkg} | sed "s,^${MLPREFIX}\(.*\),\1,")
232 if [ "${ml_pkg}" != "${pkg}" ]; then
233 archvar=ml_package_archs
234 fi
235
236 pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
208 if [ -z "$pkg_name" ]; then 237 if [ -z "$pkg_name" ]; then
209 echo "Unable to find package $pkg!" 238 echo "Unable to find package $pkg ($ml_pkg)!"
210 exit 1 239 exit 1
211 fi 240 fi
212 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest 241 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
@@ -217,12 +246,19 @@ package_install_internal_rpm () {
217 if [ ! -z "${package_to_install}" ]; then 246 if [ ! -z "${package_to_install}" ]; then
218 for pkg in ${package_to_install} ; do 247 for pkg in ${package_to_install} ; do
219 echo "Processing $pkg..." 248 echo "Processing $pkg..."
220 pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf) 249
250 archvar=base_package_archs
251 ml_pkg=$(echo ${pkg} | sed "s,$^{MLPREFIX}\(.*\),\1,")
252 if [ "${ml_pkg}" != "${pkg}" ]; then
253 archvar=ml_package_archs
254 fi
255
256 pkg_name=$(resolve_package_rpm ${confbase}-${archvar}.conf ${ml_pkg})
221 if [ -z "$pkg_name" ]; then 257 if [ -z "$pkg_name" ]; then
222 echo "Unable to find package $pkg!" 258 echo "Unable to find package $pkg ($ml_pkg)!"
223 exit 1 259 exit 1
224 fi 260 fi
225 echo $pkg_name >> ${target_rootfs}/install/install.manifest 261 echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest
226 done 262 done
227 fi 263 fi
228 264
@@ -318,6 +354,21 @@ python write_specfile () {
318 import textwrap 354 import textwrap
319 import oe.packagedata 355 import oe.packagedata
320 356
357 # We need a simple way to remove the MLPREFIX from the package name,
358 # and dependency information...
359 def strip_multilib(name, d):
360 multilibs = d.getVar('MULTILIBS', True) or ""
361 for ext in multilibs.split():
362 eext = ext.split(':')
363 if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') == 0:
364 name = (eext[1] + '-').join(name.split(eext[1] + '-', 1)[1:])
365 return name
366
367# ml = bb.data.getVar("MLPREFIX", d, True)
368# if ml and name and len(ml) != 0 and name.find(ml) == 0:
369# return ml.join(name.split(ml, 1)[1:])
370# return name
371
321 # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release 372 # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
322 # This format is similar to OE, however there are restrictions on the 373 # This format is similar to OE, however there are restrictions on the
323 # characters that can be in a field. In the Version field, "-" 374 # characters that can be in a field. In the Version field, "-"
@@ -346,7 +397,7 @@ python write_specfile () {
346 pv = subd['PKGV'] 397 pv = subd['PKGV']
347 reppv = pv.replace('-', '+') 398 reppv = pv.replace('-', '+')
348 ver = ver.replace(pv, reppv) 399 ver = ver.replace(pv, reppv)
349 newdeps_dict[dep] = ver 400 newdeps_dict[strip_multilib(dep, d)] = ver
350 depends = bb.utils.join_deps(newdeps_dict) 401 depends = bb.utils.join_deps(newdeps_dict)
351 bb.data.setVar(varname, depends.strip(), d) 402 bb.data.setVar(varname, depends.strip(), d)
352 403
@@ -394,7 +445,7 @@ python write_specfile () {
394 return 445 return
395 446
396 # Construct the SPEC file... 447 # Construct the SPEC file...
397 srcname = bb.data.getVar('PN', d, True) 448 srcname = strip_multilib(bb.data.getVar('PN', d, True), d)
398 srcsummary = (bb.data.getVar('SUMMARY', d, True) or bb.data.getVar('DESCRIPTION', d, True) or ".") 449 srcsummary = (bb.data.getVar('SUMMARY', d, True) or bb.data.getVar('DESCRIPTION', d, True) or ".")
399 srcversion = bb.data.getVar('PKGV', d, True).replace('-', '+') 450 srcversion = bb.data.getVar('PKGV', d, True).replace('-', '+')
400 srcrelease = bb.data.getVar('PKGR', d, True) 451 srcrelease = bb.data.getVar('PKGR', d, True)
@@ -405,7 +456,7 @@ python write_specfile () {
405 srchomepage = bb.data.getVar('HOMEPAGE', d, True) 456 srchomepage = bb.data.getVar('HOMEPAGE', d, True)
406 srcdescription = bb.data.getVar('DESCRIPTION', d, True) or "." 457 srcdescription = bb.data.getVar('DESCRIPTION', d, True) or "."
407 458
408 srcdepends = bb.data.getVar('DEPENDS', d, True) 459 srcdepends = strip_multilib(bb.data.getVar('DEPENDS', d, True), d)
409 srcrdepends = [] 460 srcrdepends = []
410 srcrrecommends = [] 461 srcrrecommends = []
411 srcrsuggests = [] 462 srcrsuggests = []
@@ -448,7 +499,7 @@ python write_specfile () {
448 499
449 conffiles = (bb.data.getVar('CONFFILES', localdata, True) or "").split() 500 conffiles = (bb.data.getVar('CONFFILES', localdata, True) or "").split()
450 501
451 splitname = pkgname 502 splitname = strip_multilib(pkgname, d)
452 503
453 splitsummary = (bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or ".") 504 splitsummary = (bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or ".")
454 splitversion = (bb.data.getVar('PKGV', localdata, True) or "").replace('-', '+') 505 splitversion = (bb.data.getVar('PKGV', localdata, True) or "").replace('-', '+')
@@ -699,6 +750,14 @@ python write_specfile () {
699python do_package_rpm () { 750python do_package_rpm () {
700 import os 751 import os
701 752
753 # We need a simple way to remove the MLPREFIX from the package name,
754 # and dependency information...
755 def strip_multilib(name, d):
756 ml = bb.data.getVar("MLPREFIX", d, True)
757 if ml and name and len(ml) != 0 and name.find(ml) == 0:
758 return ml.join(name.split(ml, 1)[1:])
759 return name
760
702 workdir = bb.data.getVar('WORKDIR', d, True) 761 workdir = bb.data.getVar('WORKDIR', d, True)
703 outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, True) 762 outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, True)
704 tmpdir = bb.data.getVar('TMPDIR', d, True) 763 tmpdir = bb.data.getVar('TMPDIR', d, True)
@@ -714,7 +773,7 @@ python do_package_rpm () {
714 return 773 return
715 774
716 # Construct the spec file... 775 # Construct the spec file...
717 srcname = bb.data.getVar('PN', d, True) 776 srcname = strip_multilib(bb.data.getVar('PN', d, True), d)
718 outspecfile = workdir + "/" + srcname + ".spec" 777 outspecfile = workdir + "/" + srcname + ".spec"
719 bb.data.setVar('OUTSPECFILE', outspecfile, d) 778 bb.data.setVar('OUTSPECFILE', outspecfile, d)
720 bb.build.exec_func('write_specfile', d) 779 bb.build.exec_func('write_specfile', d)
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index b554bae34e..04c0483a2d 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -93,7 +93,7 @@ EOF
93 93
94 # List must be prefered to least preferred order 94 # List must be prefered to least preferred order
95 INSTALL_PLATFORM_EXTRA_RPM="" 95 INSTALL_PLATFORM_EXTRA_RPM=""
96 for each_arch in ${PACKAGE_ARCHS} ; do 96 for each_arch in ${MULTILIB_PACKAGE_ARCHS} ${PACKAGE_ARCHS}; do
97 INSTALL_PLATFORM_EXTRA_RPM="$each_arch $INSTALL_PLATFORM_EXTRA_RPM" 97 INSTALL_PLATFORM_EXTRA_RPM="$each_arch $INSTALL_PLATFORM_EXTRA_RPM"
98 done 98 done
99 export INSTALL_PLATFORM_RPM 99 export INSTALL_PLATFORM_RPM
@@ -207,4 +207,19 @@ python () {
207 bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d) 207 bb.data.setVarFlag('do_rootfs', 'recrdeptask', flags, d)
208 bb.data.setVar('RPM_PREPROCESS_COMMANDS', '', d) 208 bb.data.setVar('RPM_PREPROCESS_COMMANDS', '', d)
209 bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d) 209 bb.data.setVar('RPM_POSTPROCESS_COMMANDS', '', d)
210
211 ml_package_archs = ""
212 multilibs = d.getVar('MULTILIBS', True) or ""
213 for ext in multilibs.split():
214 eext = ext.split(':')
215 if len(eext) > 1 and eext[0] == 'multilib':
216 localdata = bb.data.createCopy(d)
217 overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + eext[1]
218 localdata.setVar("OVERRIDES", overrides)
219 # TEMP: OVERRIDES isn't working right
220 localdata.setVar("TUNENAME", localdata.getVar("TUNENAME_virtclass-multilib-" + eext[1], False) or "")
221 ml_package_archs += localdata.getVar("PACKAGE_ARCHS", True) or ""
222 bb.note("ML_PACKAGE_ARCHS %s %s %s" % (eext[1], localdata.getVar("PACKAGE_ARCHS", True) or "(none)", overrides))
223 bb.data.setVar('MULTILIB_PACKAGE_ARCHS', ml_package_archs, d)
224
210} 225}