diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2014-01-13 10:16:43 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-11 11:53:39 +0000 |
commit | f52391a919ec4969d3a0254513d4e0c971dd611f (patch) | |
tree | d6ab2af1f45a39cd5056934a15f86feed612df2d /meta/classes/package_ipk.bbclass | |
parent | 31906d8e916f72da8493655672bd6731e46b20f5 (diff) | |
download | poky-f52391a919ec4969d3a0254513d4e0c971dd611f.tar.gz |
Cleanup image,rootfs_ipk,package_ipk bbclass files
This commit cleans up the functions that were ported to python.
(From OE-Core rev: d950ef40a3eae4b54cc62828e66d84a62d78c447)
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r-- | meta/classes/package_ipk.bbclass | 197 |
1 files changed, 1 insertions, 196 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 73446d6c59..68c8580761 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
@@ -10,207 +10,12 @@ PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks" | |||
10 | # Program to be used to build opkg packages | 10 | # Program to be used to build opkg packages |
11 | OPKGBUILDCMD ??= "opkg-build" | 11 | OPKGBUILDCMD ??= "opkg-build" |
12 | 12 | ||
13 | OPKG_ARGS = "-f $INSTALL_CONF_IPK -o $INSTALL_ROOTFS_IPK --force_postinstall --prefer-arch-to-version" | 13 | OPKG_ARGS = "--force_postinstall --prefer-arch-to-version" |
14 | OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" | 14 | OPKG_ARGS += "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" |
15 | OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE', True) or "").split())][(d.getVar("PACKAGE_EXCLUDE", True) or "") != ""]}" | 15 | OPKG_ARGS += "${@['', '--add-exclude ' + ' --add-exclude '.join((d.getVar('PACKAGE_EXCLUDE', True) or "").split())][(d.getVar("PACKAGE_EXCLUDE", True) or "") != ""]}" |
16 | 16 | ||
17 | OPKGLIBDIR = "${localstatedir}/lib" | 17 | OPKGLIBDIR = "${localstatedir}/lib" |
18 | 18 | ||
19 | package_tryout_install_multilib_ipk() { | ||
20 | #try install multilib | ||
21 | multilib_tryout_dirs="" | ||
22 | for item in ${MULTILIB_VARIANTS}; do | ||
23 | local target_rootfs="${MULTILIB_TEMP_ROOTFS}/${item}" | ||
24 | local ipkg_args="${OPKG_ARGS}" | ||
25 | local selected_pkg="" | ||
26 | local pkgname_prefix="${item}-" | ||
27 | local pkgname_len=${#pkgname_prefix} | ||
28 | for pkg in ${INSTALL_PACKAGES_MULTILIB_IPK}; do | ||
29 | local pkgname=$(echo $pkg | awk -v var=$pkgname_len '{ pkgname=substr($1, 1, var); print pkgname; }' ) | ||
30 | if [ ${pkgname} = ${pkgname_prefix} ]; then | ||
31 | selected_pkg="${selected_pkg} ${pkg}" | ||
32 | fi | ||
33 | done | ||
34 | if [ ! -z "${selected_pkg}" ]; then | ||
35 | rm -f ${target_rootfs} | ||
36 | mkdir -p ${target_rootfs}/${opkglibdir} | ||
37 | opkg-cl ${ipkg_args} update | ||
38 | opkg-cl ${ipkg_args} install ${selected_pkg} | ||
39 | multilib_tryout_dirs="${multilib_tryout_dirs} ${target_rootfs}" | ||
40 | fi | ||
41 | done | ||
42 | } | ||
43 | |||
44 | split_multilib_packages() { | ||
45 | INSTALL_PACKAGES_NORMAL_IPK="" | ||
46 | INSTALL_PACKAGES_MULTILIB_IPK="" | ||
47 | for pkg in ${INSTALL_PACKAGES_IPK}; do | ||
48 | is_multilib=0 | ||
49 | for item in ${MULTILIB_VARIANTS}; do | ||
50 | local pkgname_prefix="${item}-" | ||
51 | local pkgname_len=${#pkgname_prefix} | ||
52 | local pkgname=$(echo $pkg | awk -v var=$pkgname_len '{ pkgname=substr($1, 1, var); print pkgname; }' ) | ||
53 | if [ ${pkgname} = ${pkgname_prefix} ]; then | ||
54 | is_multilib=1 | ||
55 | break | ||
56 | fi | ||
57 | done | ||
58 | |||
59 | if [ ${is_multilib} = 0 ]; then | ||
60 | INSTALL_PACKAGES_NORMAL_IPK="${INSTALL_PACKAGES_NORMAL_IPK} ${pkg}" | ||
61 | else | ||
62 | INSTALL_PACKAGES_MULTILIB_IPK="${INSTALL_PACKAGES_MULTILIB_IPK} ${pkg}" | ||
63 | fi | ||
64 | done | ||
65 | } | ||
66 | |||
67 | # | ||
68 | # install a bunch of packages using opkg | ||
69 | # the following shell variables needs to be set before calling this func: | ||
70 | # INSTALL_ROOTFS_IPK - install root dir | ||
71 | # INSTALL_CONF_IPK - configuration file | ||
72 | # INSTALL_PACKAGES_IPK - packages to be installed | ||
73 | # INSTALL_PACKAGES_ATTEMPTONLY_IPK - packages attemped to be installed only | ||
74 | # INSTALL_PACKAGES_LINGUAS_IPK - additional packages for uclibc | ||
75 | # INSTALL_TASK_IPK - task name | ||
76 | |||
77 | package_install_internal_ipk() { | ||
78 | |||
79 | local target_rootfs="${INSTALL_ROOTFS_IPK}" | ||
80 | local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_IPK}" | ||
81 | local package_linguas="${INSTALL_PACKAGES_LINGUAS_IPK}" | ||
82 | local task="${INSTALL_TASK_IPK}" | ||
83 | |||
84 | split_multilib_packages | ||
85 | |||
86 | local package_to_install="${INSTALL_PACKAGES_NORMAL_IPK}" | ||
87 | local package_multilib="${INSTALL_PACKAGES_MULTILIB_IPK}" | ||
88 | |||
89 | mkdir -p ${target_rootfs}${OPKGLIBDIR}/opkg | ||
90 | touch ${target_rootfs}${OPKGLIBDIR}/opkg/status | ||
91 | |||
92 | local ipkg_args="${OPKG_ARGS}" | ||
93 | |||
94 | opkg-cl ${ipkg_args} update | ||
95 | |||
96 | for i in ${package_linguas}; do | ||
97 | opkg-cl ${ipkg_args} install $i | ||
98 | done | ||
99 | |||
100 | if [ ! -z "${package_to_install}" ]; then | ||
101 | opkg-cl ${ipkg_args} install ${package_to_install} | ||
102 | fi | ||
103 | |||
104 | if [ ! -z "${package_attemptonly}" ]; then | ||
105 | opkg-cl ${ipkg_args} install ${package_attemptonly} > "`dirname ${BB_LOGFILE}`/log.do_${task}_attemptonly.${PID}" || true | ||
106 | fi | ||
107 | |||
108 | package_tryout_install_multilib_ipk | ||
109 | if [ ! -z "${MULTILIB_CHECK_FILE}" ]; then | ||
110 | #sanity check | ||
111 | multilib_sanity_check ${target_rootfs} ${multilib_tryout_dirs} || exit 1 | ||
112 | fi | ||
113 | |||
114 | if [ ! -z "${package_multilib}" ]; then | ||
115 | opkg-cl ${ipkg_args} install ${package_multilib} | ||
116 | fi | ||
117 | } | ||
118 | |||
119 | ipk_log_check() { | ||
120 | target="$1" | ||
121 | lf_path="$2" | ||
122 | |||
123 | lf_txt="`cat $lf_path`" | ||
124 | for keyword_die in "exit 1" "Collected errors" ERR Fail | ||
125 | do | ||
126 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1 | ||
127 | then | ||
128 | echo "log_check: There were error messages in the logfile" | ||
129 | printf "log_check: Matched keyword: [$keyword_die]\n\n" | ||
130 | echo "$lf_txt" | grep -v log_check | grep -C 5 "$keyword_die" | ||
131 | echo "" | ||
132 | do_exit=1 | ||
133 | fi | ||
134 | done | ||
135 | test "$do_exit" = 1 && exit 1 | ||
136 | true | ||
137 | } | ||
138 | |||
139 | # | ||
140 | # Update the Packages index files in ${DEPLOY_DIR_IPK} | ||
141 | # | ||
142 | package_update_index_ipk () { | ||
143 | #set -x | ||
144 | |||
145 | ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}" | ||
146 | |||
147 | if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then | ||
148 | return | ||
149 | fi | ||
150 | |||
151 | packagedirs="${DEPLOY_DIR_IPK}" | ||
152 | for arch in $ipkgarchs; do | ||
153 | packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch" | ||
154 | done | ||
155 | |||
156 | multilib_archs="${MULTILIB_ARCHS}" | ||
157 | for arch in $multilib_archs; do | ||
158 | packagedirs="$packagedirs ${DEPLOY_DIR_IPK}/$arch" | ||
159 | done | ||
160 | |||
161 | found=0 | ||
162 | for pkgdir in $packagedirs; do | ||
163 | if [ -e $pkgdir/ ]; then | ||
164 | found=1 | ||
165 | touch $pkgdir/Packages | ||
166 | flock $pkgdir/Packages.flock -c "opkg-make-index -r $pkgdir/Packages -p $pkgdir/Packages -m $pkgdir/" | ||
167 | fi | ||
168 | done | ||
169 | if [ "$found" != "1" ]; then | ||
170 | bbfatal "There are no packages in ${DEPLOY_DIR_IPK}!" | ||
171 | fi | ||
172 | } | ||
173 | |||
174 | # | ||
175 | # Generate an ipkg conf file ${IPKGCONF_TARGET} suitable for use against | ||
176 | # the target system and an ipkg conf file ${IPKGCONF_SDK} suitable for | ||
177 | # use against the host system in sdk builds | ||
178 | # | ||
179 | package_generate_ipkg_conf () { | ||
180 | package_generate_archlist | ||
181 | echo "src oe file:${DEPLOY_DIR_IPK}" >> ${IPKGCONF_SDK} | ||
182 | ipkgarchs="${SDK_PACKAGE_ARCHS}" | ||
183 | for arch in $ipkgarchs; do | ||
184 | if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then | ||
185 | echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${IPKGCONF_SDK} | ||
186 | fi | ||
187 | done | ||
188 | |||
189 | echo "src oe file:${DEPLOY_DIR_IPK}" >> ${IPKGCONF_TARGET} | ||
190 | ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}" | ||
191 | for arch in $ipkgarchs; do | ||
192 | if [ -e ${DEPLOY_DIR_IPK}/$arch/Packages ] ; then | ||
193 | echo "src oe-$arch file:${DEPLOY_DIR_IPK}/$arch" >> ${IPKGCONF_TARGET} | ||
194 | fi | ||
195 | done | ||
196 | } | ||
197 | |||
198 | package_generate_archlist () { | ||
199 | ipkgarchs="${SDK_PACKAGE_ARCHS}" | ||
200 | priority=1 | ||
201 | for arch in $ipkgarchs; do | ||
202 | echo "arch $arch $priority" >> ${IPKGCONF_SDK} | ||
203 | priority=$(expr $priority + 5) | ||
204 | done | ||
205 | |||
206 | ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}" | ||
207 | priority=1 | ||
208 | for arch in $ipkgarchs; do | ||
209 | echo "arch $arch $priority" >> ${IPKGCONF_TARGET} | ||
210 | priority=$(expr $priority + 5) | ||
211 | done | ||
212 | } | ||
213 | |||
214 | python do_package_ipk () { | 19 | python do_package_ipk () { |
215 | import re, copy | 20 | import re, copy |
216 | import textwrap | 21 | import textwrap |