diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2012-11-30 16:11:37 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-12-17 17:24:51 +0000 |
commit | a6aa74817cce38799b447cd47ef6f77aee9fcc85 (patch) | |
tree | e02a6b60d8fb05386b67dd89848c48acec4709d7 /meta/classes/package_rpm.bbclass | |
parent | ba08a8ccbf11542867b7dd0474599fccb0585b97 (diff) | |
download | poky-a6aa74817cce38799b447cd47ef6f77aee9fcc85.tar.gz |
package_rpm: Update the way the multilib package names are translated
The variable MULTILIB_PACKAGE_ARCHS has been removed in favor of a
repurposed MULTILIB_PREFIX_LIST. The format of this item is now
<libid>:<arch>:<arch1>:...:<archN>. This ensures that we can correctly
translate the libid to one of the supported archs in a tri-lib system.
All of the users of MULTILIB_PREFIX_LIST and MULTILIB_PACKAGE_ARCHS have
been modified accordingly.
Also change the way attempted packages are installed, verify the package
exists in the translate functions, then perform the install in one single
operation. This results in a significantly faster install time.
(From OE-Core rev: ffe6cf3a1c57defdbe8531bdeb588e199177bb6c)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 188 |
1 files changed, 175 insertions, 13 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 4b81b68bf7..4f60daffb4 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
@@ -24,11 +24,24 @@ package_update_index_rpm () { | |||
24 | return | 24 | return |
25 | fi | 25 | fi |
26 | 26 | ||
27 | base_archs="`echo ${PACKAGE_ARCHS} | sed 's/-/_/g'`" | 27 | sdk_archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _` |
28 | ml_archs="`echo ${MULTILIB_PACKAGE_ARCHS} | sed 's/-/_/g'`" | 28 | |
29 | sdk_archs="`echo ${SDK_PACKAGE_ARCHS} | sed 's/-/_/g'`" | 29 | target_archs="" |
30 | for i in ${MULTILIB_PREFIX_LIST} ; do | ||
31 | old_IFS="$IFS" | ||
32 | IFS=":" | ||
33 | set $i | ||
34 | IFS="$old_IFS" | ||
35 | shift # remove mlib | ||
36 | while [ -n "$1" ]; do | ||
37 | target_archs="$target_archs $1" | ||
38 | shift | ||
39 | done | ||
40 | done | ||
30 | 41 | ||
31 | archs=`for arch in $base_archs $ml_archs $sdk_archs ; do | 42 | target_archs=`echo "$target_archs" | tr - _` |
43 | |||
44 | archs=`for arch in $target_archs $sdk_archs ; do | ||
32 | echo $arch | 45 | echo $arch |
33 | done | sort | uniq` | 46 | done | sort | uniq` |
34 | 47 | ||
@@ -59,6 +72,143 @@ rpm_log_check() { | |||
59 | true | 72 | true |
60 | } | 73 | } |
61 | 74 | ||
75 | # Translate the RPM/Smart format names to the OE multilib format names | ||
76 | # Input via stdin (only the first item per line is converted!) | ||
77 | # Output via stdout | ||
78 | translate_smart_to_oe() { | ||
79 | arg1="$1" | ||
80 | |||
81 | # Dump installed packages | ||
82 | while read pkg arch other ; do | ||
83 | if [ -z "$pkg" ]; then | ||
84 | continue | ||
85 | fi | ||
86 | new_pkg=$pkg | ||
87 | fixed_arch=`echo "$arch" | tr _ -` | ||
88 | for i in ${MULTILIB_PREFIX_LIST} ; do | ||
89 | old_IFS="$IFS" | ||
90 | IFS=":" | ||
91 | set $i | ||
92 | IFS="$old_IFS" | ||
93 | mlib="$1" | ||
94 | shift | ||
95 | while [ -n "$1" ]; do | ||
96 | cmp_arch=$1 | ||
97 | shift | ||
98 | if [ "$arch" = "$cmp_arch" -o "$fixed_arch" = "$cmp_arch" ]; then | ||
99 | if [ "$mlib" = "default" ]; then | ||
100 | new_pkg="$pkg" | ||
101 | else | ||
102 | new_pkg="$mlib-$pkg" | ||
103 | fi | ||
104 | break | ||
105 | fi | ||
106 | done | ||
107 | if [ "$arch" = "$cmp_arch" -o "$fixed_arch" = "$cmp_arch" ]; then | ||
108 | break | ||
109 | fi | ||
110 | done | ||
111 | |||
112 | #echo "$pkg -> $new_pkg" >&2 | ||
113 | if [ "$arg1" = "arch" ]; then | ||
114 | echo $new_pkg $cmp_arch $other | ||
115 | else | ||
116 | echo $new_pkg $other | ||
117 | fi | ||
118 | done | ||
119 | } | ||
120 | |||
121 | # Translate the OE multilib format names to the RPM/Smart format names | ||
122 | # Input via arguments | ||
123 | # Ouput via pkgs_to_install | ||
124 | translate_oe_to_smart() { | ||
125 | default_archs="" | ||
126 | sdk_mode="" | ||
127 | if [ "$1" = "--sdk" ]; then | ||
128 | shift | ||
129 | sdk_mode="true" | ||
130 | # Need to reverse the order of the SDK_ARCHS highest -> lowest priority | ||
131 | archs=`echo "${SDK_PACKAGE_ARCHS}" | tr - _` | ||
132 | for arch in $archs ; do | ||
133 | default_archs="$arch $default_archs" | ||
134 | done | ||
135 | fi | ||
136 | |||
137 | attemptonly="Error" | ||
138 | if [ "$1" = "--attemptonly" ]; then | ||
139 | attemptonly="Warning" | ||
140 | shift | ||
141 | fi | ||
142 | |||
143 | # Dump a list of all available packages | ||
144 | [ ! -e ${target_rootfs}/install/tmp/fullpkglist.query ] && smart --data-dir=${target_rootfs}/var/lib/smart query --output ${target_rootfs}/install/tmp/fullpkglist.query | ||
145 | |||
146 | pkgs_to_install="" | ||
147 | for pkg in "$@" ; do | ||
148 | new_pkg="$pkg" | ||
149 | if [ -z "$sdk_mode" ]; then | ||
150 | for i in ${MULTILIB_PREFIX_LIST} ; do | ||
151 | old_IFS="$IFS" | ||
152 | IFS=":" | ||
153 | set $i | ||
154 | IFS="$old_IFS" | ||
155 | mlib="$1" | ||
156 | shift | ||
157 | if [ "$mlib" = "default" ]; then | ||
158 | if [ -z "$default_archs" ]; then | ||
159 | default_archs=$@ | ||
160 | fi | ||
161 | continue | ||
162 | fi | ||
163 | subst=${pkg#${mlib}-} | ||
164 | if [ "$subst" != "$pkg" ]; then | ||
165 | feeds=$@ | ||
166 | while [ -n "$1" ]; do | ||
167 | arch="$1" | ||
168 | arch=`echo "$arch" | tr - _` | ||
169 | shift | ||
170 | if grep -q '^'$subst'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then | ||
171 | new_pkg="$subst@$arch" | ||
172 | # First found is best match | ||
173 | break | ||
174 | fi | ||
175 | done | ||
176 | if [ "$pkg" = "$new_pkg" ]; then | ||
177 | # Failed to translate, package not found! | ||
178 | echo "$attemptonly: $pkg not found in the $mlib feeds ($feeds)." >&2 | ||
179 | if [ "$attemptonly" = "Error" ]; then | ||
180 | exit 1 | ||
181 | fi | ||
182 | continue | ||
183 | fi | ||
184 | fi | ||
185 | done | ||
186 | fi | ||
187 | # Apparently not a multilib package... | ||
188 | if [ "$pkg" = "$new_pkg" ]; then | ||
189 | default_archs_fixed=`echo "$default_archs" | tr - _` | ||
190 | for arch in $default_archs_fixed ; do | ||
191 | if grep -q '^'$pkg'-[^-]*-[^-]*@'$arch'$' ${target_rootfs}/install/tmp/fullpkglist.query ; then | ||
192 | new_pkg="$pkg@$arch" | ||
193 | # First found is best match | ||
194 | break | ||
195 | fi | ||
196 | done | ||
197 | if [ "$pkg" = "$new_pkg" ]; then | ||
198 | # Failed to translate, package not found! | ||
199 | echo "$attemptonly: $pkg not found in the base feeds ($default_archs)." >&2 | ||
200 | if [ "$attemptonly" = "Error" ]; then | ||
201 | exit 1 | ||
202 | fi | ||
203 | continue | ||
204 | fi | ||
205 | fi | ||
206 | #echo "$pkg -> $new_pkg" >&2 | ||
207 | pkgs_to_install="${pkgs_to_install} ${new_pkg}" | ||
208 | done | ||
209 | export pkgs_to_install | ||
210 | } | ||
211 | |||
62 | 212 | ||
63 | # | 213 | # |
64 | # Install a bunch of packages using rpm. | 214 | # Install a bunch of packages using rpm. |
@@ -96,18 +246,26 @@ package_install_internal_rpm () { | |||
96 | local providename="$INSTALL_PROVIDENAME_RPM" | 246 | local providename="$INSTALL_PROVIDENAME_RPM" |
97 | local task="$INSTALL_TASK_RPM" | 247 | local task="$INSTALL_TASK_RPM" |
98 | 248 | ||
249 | local sdk_mode="" | ||
250 | if [ "$1" = "--sdk" ]; then | ||
251 | sdk_mode="--sdk" | ||
252 | fi | ||
253 | |||
99 | # Configure internal RPM environment when using Smart | 254 | # Configure internal RPM environment when using Smart |
100 | export RPM_ETCRPM=${target_rootfs}/etc/rpm | 255 | export RPM_ETCRPM=${target_rootfs}/etc/rpm |
101 | 256 | ||
102 | # Setup temporary directory -- install... | 257 | # Setup temporary directory -- install... |
103 | mkdir -p ${target_rootfs}/install | 258 | rm -rf ${target_rootfs}/install |
259 | mkdir -p ${target_rootfs}/install/tmp | ||
104 | 260 | ||
261 | channel_priority=5 | ||
105 | if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then | 262 | if [ "${INSTALL_COMPLEMENTARY_RPM}" != "1" ] ; then |
106 | # Setup base system configuration | 263 | # Setup base system configuration |
107 | mkdir -p ${target_rootfs}/etc/rpm/ | 264 | mkdir -p ${target_rootfs}/etc/rpm/ |
108 | echo "${platform}${TARGET_VENDOR}-${TARGET_OS}" > ${target_rootfs}/etc/rpm/platform | 265 | echo "${platform}${TARGET_VENDOR}-${TARGET_OS}" > ${target_rootfs}/etc/rpm/platform |
109 | if [ ! -z "$platform_extra" ]; then | 266 | if [ ! -z "$platform_extra" ]; then |
110 | for pt in $platform_extra ; do | 267 | for pt in $platform_extra ; do |
268 | channel_priority=$(expr $channel_priority + 5) | ||
111 | case $pt in | 269 | case $pt in |
112 | noarch | any | all) | 270 | noarch | any | all) |
113 | os="`echo ${TARGET_OS} | sed "s,-.*,,"`.*" | 271 | os="`echo ${TARGET_OS} | sed "s,-.*,,"`.*" |
@@ -178,11 +336,14 @@ EOF | |||
178 | smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp | 336 | smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._tmppath=/install/tmp |
179 | smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y | 337 | smart --data-dir=${target_rootfs}/var/lib/smart channel --add rpmsys type=rpm-sys -y |
180 | 338 | ||
181 | for arch in $platform_extra ; do | 339 | platform_extra_fixed=`echo "$platform_extra" | tr - _` |
340 | for arch in $platform_extra_fixed ; do | ||
182 | if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then | 341 | if [ -d ${DEPLOY_DIR_RPM}/$arch -a ! -e ${target_rootfs}/install/channel.$arch.stamp ] ; then |
183 | smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y | 342 | smart --data-dir=${target_rootfs}/var/lib/smart channel --add $arch type=rpm-md type=rpm-md baseurl=${DEPLOY_DIR_RPM}/$arch -y |
343 | smart --data-dir=${target_rootfs}/var/lib/smart channel --set $arch priority=$channel_priority | ||
184 | touch ${target_rootfs}/install/channel.$arch.stamp | 344 | touch ${target_rootfs}/install/channel.$arch.stamp |
185 | fi | 345 | fi |
346 | channel_priority=$(expr $channel_priority - 5) | ||
186 | done | 347 | done |
187 | fi | 348 | fi |
188 | 349 | ||
@@ -218,14 +379,15 @@ EOF | |||
218 | chmod 0755 ${WORKDIR}/scriptlet_wrapper | 379 | chmod 0755 ${WORKDIR}/scriptlet_wrapper |
219 | smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._cross_scriptlet_wrapper=${WORKDIR}/scriptlet_wrapper | 380 | smart --data-dir=${target_rootfs}/var/lib/smart config --set rpm-extra-macros._cross_scriptlet_wrapper=${WORKDIR}/scriptlet_wrapper |
220 | 381 | ||
221 | smart --data-dir=${target_rootfs}/var/lib/smart install -y ${package_to_install} ${package_linguas} | 382 | # Determine what to install |
383 | translate_oe_to_smart ${sdk_mode} ${package_to_install} ${package_linguas} | ||
222 | 384 | ||
223 | if [ ! -z "${package_attemptonly}" ]; then | 385 | [ -n "$pkgs_to_install" ] && smart --data-dir=${target_rootfs}/var/lib/smart install -y ${pkgs_to_install} |
224 | echo "Installing attempt only packages..." | 386 | |
225 | for pkg_name in ${package_attemptonly} ; do | 387 | if [ -n "${package_attemptonly}" ]; then |
226 | echo "Attempting $pkg_name..." >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" | 388 | translate_oe_to_smart ${sdk_mode} --attemptonly $package_attemptonly |
227 | smart --data-dir=${target_rootfs}/var/lib/smart install -y $pkg_name >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || true | 389 | echo "Attempting $pkgs_to_install" |
228 | done | 390 | smart --data-dir=${target_rootfs}/var/lib/smart install -y $pkgs_to_install >> "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" 2>&1 || true |
229 | fi | 391 | fi |
230 | } | 392 | } |
231 | 393 | ||