diff options
author | Laurentiu Palcu <laurentiu.palcu@intel.com> | 2013-12-18 18:02:18 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-11 11:53:38 +0000 |
commit | 7fc9bdaeed5aa3f2dd8b83a660eb97797bd2fcf4 (patch) | |
tree | fe2f2286820d9b484e721a323e8c8eacc1af39b9 /meta/classes/package_deb.bbclass | |
parent | 85cc53a5a09e4076a0940c938374e6be8795db80 (diff) | |
download | poky-7fc9bdaeed5aa3f2dd8b83a660eb97797bd2fcf4.tar.gz |
Activate the new python rootfs/image creation routines
This commit will:
* remove old bash code common to all backends;
* create a new do_rootfs() python function that will use the new
rootfs/image creation routines;
* allow creation of dpkg based images;
* fail for rpm/opkg (not implemented yet);
(From OE-Core rev: a83144bac8d67704ff66f5dc0fc56f5b63979694)
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_deb.bbclass')
-rw-r--r-- | meta/classes/package_deb.bbclass | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 5d316aa8b2..bf9739e099 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass | |||
@@ -15,38 +15,6 @@ APTCONF_TARGET = "${WORKDIR}" | |||
15 | APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" | 15 | APT_ARGS = "${@['', '--no-install-recommends'][d.getVar("NO_RECOMMENDATIONS", True) == "1"]}" |
16 | 16 | ||
17 | # | 17 | # |
18 | # Update the Packages index files in ${DEPLOY_DIR_DEB} | ||
19 | # | ||
20 | package_update_index_deb () { | ||
21 | |||
22 | local debarchs="" | ||
23 | |||
24 | if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then | ||
25 | return | ||
26 | fi | ||
27 | |||
28 | for arch in ${PACKAGE_ARCHS} ${SDK_PACKAGE_ARCHS}; do | ||
29 | if [ -e ${DEPLOY_DIR_DEB}/$arch ]; then | ||
30 | debarchs="$debarchs $arch" | ||
31 | fi | ||
32 | done | ||
33 | |||
34 | found=0 | ||
35 | for arch in $debarchs; do | ||
36 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | ||
37 | continue; | ||
38 | fi | ||
39 | cd ${DEPLOY_DIR_DEB}/$arch | ||
40 | dpkg-scanpackages . | gzip > Packages.gz | ||
41 | echo "Label: $arch" > Release | ||
42 | found=1 | ||
43 | done | ||
44 | if [ "$found" != "1" ]; then | ||
45 | bbfatal "There are no packages in ${DEPLOY_DIR_DEB}!" | ||
46 | fi | ||
47 | } | ||
48 | |||
49 | # | ||
50 | # install a bunch of packages using apt | 18 | # install a bunch of packages using apt |
51 | # the following shell variables needs to be set before calling this func: | 19 | # the following shell variables needs to be set before calling this func: |
52 | # INSTALL_ROOTFS_DEB - install root dir | 20 | # INSTALL_ROOTFS_DEB - install root dir |
@@ -57,120 +25,6 @@ package_update_index_deb () { | |||
57 | # INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc | 25 | # INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc |
58 | # INSTALL_TASK_DEB - task name | 26 | # INSTALL_TASK_DEB - task name |
59 | 27 | ||
60 | package_install_internal_deb () { | ||
61 | |||
62 | local target_rootfs="${INSTALL_ROOTFS_DEB}" | ||
63 | local dpkg_arch="${INSTALL_BASEARCH_DEB}" | ||
64 | local archs="${INSTALL_ARCHS_DEB}" | ||
65 | local package_to_install="${INSTALL_PACKAGES_NORMAL_DEB}" | ||
66 | local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_DEB}" | ||
67 | local package_linguas="${INSTALL_PACKAGES_LINGUAS_DEB}" | ||
68 | local task="${INSTALL_TASK_DEB}" | ||
69 | |||
70 | mkdir -p ${APTCONF_TARGET}/apt | ||
71 | rm -f ${APTCONF_TARGET}/apt/sources.list.rev | ||
72 | rm -f ${APTCONF_TARGET}/apt/preferences | ||
73 | |||
74 | priority=1 | ||
75 | for arch in $archs; do | ||
76 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | ||
77 | continue; | ||
78 | fi | ||
79 | |||
80 | echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${APTCONF_TARGET}/apt/sources.list.rev | ||
81 | (echo "Package: *" | ||
82 | echo "Pin: release l=$arch" | ||
83 | echo "Pin-Priority: $(expr 800 + $priority)" | ||
84 | echo) >> ${APTCONF_TARGET}/apt/preferences | ||
85 | priority=$(expr $priority + 5) | ||
86 | done | ||
87 | |||
88 | for pkg in ${PACKAGE_EXCLUDE}; do | ||
89 | (echo "Package: $pkg" | ||
90 | echo "Pin: release *" | ||
91 | echo "Pin-Priority: -1" | ||
92 | echo) >> ${APTCONF_TARGET}/apt/preferences | ||
93 | done | ||
94 | |||
95 | tac ${APTCONF_TARGET}/apt/sources.list.rev > ${APTCONF_TARGET}/apt/sources.list | ||
96 | |||
97 | # The params in deb package control don't allow character `_', so | ||
98 | # change the arch's `_' to `-' in it. | ||
99 | dpkg_arch=`echo ${dpkg_arch} | sed 's/_/-/g'` | ||
100 | cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \ | ||
101 | | sed -e "s#Architecture \".*\";#Architecture \"${dpkg_arch}\";#" \ | ||
102 | | sed -e "s:#ROOTFS#:${target_rootfs}:g" \ | ||
103 | | sed -e "s:#APTCONF#:${APTCONF_TARGET}/apt:g" \ | ||
104 | > "${APTCONF_TARGET}/apt/apt.conf" | ||
105 | |||
106 | export APT_CONFIG="${APTCONF_TARGET}/apt/apt.conf" | ||
107 | |||
108 | mkdir -p ${target_rootfs}/var/lib/dpkg/info | ||
109 | mkdir -p ${target_rootfs}/var/lib/dpkg/updates | ||
110 | |||
111 | > ${target_rootfs}/var/lib/dpkg/status | ||
112 | > ${target_rootfs}/var/lib/dpkg/available | ||
113 | |||
114 | apt-get update | ||
115 | |||
116 | if [ ! -z "${package_linguas}" ]; then | ||
117 | for i in ${package_linguas}; do | ||
118 | apt-get ${APT_ARGS} install $i --force-yes --allow-unauthenticated | ||
119 | if [ $? -ne 0 ]; then | ||
120 | exit 1 | ||
121 | fi | ||
122 | done | ||
123 | fi | ||
124 | |||
125 | # normal install | ||
126 | if [ ! -z "${package_to_install}" ]; then | ||
127 | apt-get ${APT_ARGS} install ${package_to_install} --force-yes --allow-unauthenticated | ||
128 | if [ $? -ne 0 ]; then | ||
129 | exit 1 | ||
130 | fi | ||
131 | |||
132 | # Attempt to correct the probable broken dependencies in place. | ||
133 | apt-get ${APT_ARGS} -f install | ||
134 | if [ $? -ne 0 ]; then | ||
135 | exit 1 | ||
136 | fi | ||
137 | fi | ||
138 | |||
139 | rm -f `dirname ${BB_LOGFILE}`/log.do_${task}-attemptonly.${PID} | ||
140 | if [ ! -z "${package_attemptonly}" ]; then | ||
141 | for i in ${package_attemptonly}; do | ||
142 | apt-get ${APT_ARGS} install $i --force-yes --allow-unauthenticated >> `dirname ${BB_LOGFILE}`/log.do_${task}-attemptonly.${PID} 2>&1 || true | ||
143 | done | ||
144 | fi | ||
145 | |||
146 | find ${target_rootfs} -name \*.dpkg-new | for i in `cat`; do | ||
147 | mv $i `echo $i | sed -e's,\.dpkg-new$,,'` | ||
148 | done | ||
149 | |||
150 | # Mark all packages installed | ||
151 | sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${target_rootfs}/var/lib/dpkg/status | ||
152 | } | ||
153 | |||
154 | deb_log_check() { | ||
155 | target="$1" | ||
156 | lf_path="$2" | ||
157 | |||
158 | lf_txt="`cat $lf_path`" | ||
159 | for keyword_die in "^E:" | ||
160 | do | ||
161 | if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1 | ||
162 | then | ||
163 | echo "log_check: There were error messages in the logfile" | ||
164 | printf "log_check: Matched keyword: [$keyword_die]\n\n" | ||
165 | echo "$lf_txt" | grep -v log_check | grep -C 5 -i "$keyword_die" | ||
166 | echo "" | ||
167 | do_exit=1 | ||
168 | fi | ||
169 | done | ||
170 | test "$do_exit" = 1 && exit 1 | ||
171 | true | ||
172 | } | ||
173 | |||
174 | python do_package_deb () { | 28 | python do_package_deb () { |
175 | import re, copy | 29 | import re, copy |
176 | import textwrap | 30 | import textwrap |