diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/package_deb.bbclass | 125 | ||||
-rw-r--r-- | meta/classes/rootfs_deb.bbclass | 91 |
2 files changed, 141 insertions, 75 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 2181ce7c22..52bd264ead 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass | |||
@@ -67,6 +67,131 @@ python do_package_deb_install () { | |||
67 | os.putenv('PATH', path) | 67 | os.putenv('PATH', path) |
68 | } | 68 | } |
69 | 69 | ||
70 | # | ||
71 | # Update the Packages index files in ${DEPLOY_DIR_DEB} | ||
72 | # | ||
73 | package_update_index_deb () { | ||
74 | |||
75 | local debarchs="" | ||
76 | |||
77 | if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then | ||
78 | return | ||
79 | fi | ||
80 | |||
81 | for arch in ${PACKAGE_ARCHS}; do | ||
82 | sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'` | ||
83 | if [ -e ${DEPLOY_DIR_DEB}/$arch ]; then | ||
84 | debarchs="$debarchs $arch" | ||
85 | fi | ||
86 | if [ -e ${DEPLOY_DIR_DEB}/$sdkarch-nativesdk ]; then | ||
87 | debarchs="$debarchs $sdkarch-nativesdk" | ||
88 | fi | ||
89 | done | ||
90 | |||
91 | for arch in $debarchs; do | ||
92 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | ||
93 | continue; | ||
94 | fi | ||
95 | cd ${DEPLOY_DIR_DEB}/$arch | ||
96 | dpkg-scanpackages . | bzip2 > Packages.bz2 | ||
97 | echo "Label: $arch" > Release | ||
98 | done | ||
99 | } | ||
100 | |||
101 | # | ||
102 | # install a bunch of packages using apt | ||
103 | # the following shell variables needs to be set before calling this func: | ||
104 | # INSTALL_ROOTFS_DEB - install root dir | ||
105 | # INSTALL_BASEARCH_DEB - install base architecutre | ||
106 | # INSTALL_ARCHS_DEB - list of available archs | ||
107 | # INSTALL_PACKAGES_NORMAL_DEB - packages to be installed | ||
108 | # INSTALL_PACKAGES_ATTEMPTONLY_DEB - packages attemped to be installed only | ||
109 | # INSTALL_PACKAGES_LINGUAS_DEB - additional packages for uclibc | ||
110 | # INSTALL_TASK_DEB - task name | ||
111 | |||
112 | package_install_internal_deb () { | ||
113 | |||
114 | local target_rootfs="${INSTALL_ROOTFS_DEB}" | ||
115 | local dpkg_arch="${INSTALL_BASEARCH_DEB}" | ||
116 | local archs="${INSTALL_ARCHS_DEB}" | ||
117 | local package_to_install="${INSTALL_PACKAGES_NORMAL_DEB}" | ||
118 | local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_DEB}" | ||
119 | local package_lingusa="${INSTALL_PACKAGES_LINGUAS_DEB}" | ||
120 | local task="${INSTALL_TASK_DEB}" | ||
121 | |||
122 | rm -f ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev | ||
123 | rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences | ||
124 | |||
125 | priority=1 | ||
126 | for arch in $archs; do | ||
127 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | ||
128 | continue; | ||
129 | fi | ||
130 | |||
131 | echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev | ||
132 | (echo "Package: *" | ||
133 | echo "Pin: release l=$arch" | ||
134 | echo "Pin-Priority: $(expr 800 + $priority)" | ||
135 | echo) >> ${STAGING_ETCDIR_NATIVE}/apt/preferences | ||
136 | priority=$(expr $priority + 5) | ||
137 | done | ||
138 | |||
139 | tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list | ||
140 | |||
141 | cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \ | ||
142 | | sed -e "s#Architecture \".*\";#Architecture \"${dpkg_arch}\";#" \ | ||
143 | | sed -e "s:#ROOTFS#:${target_rootfs}:g" \ | ||
144 | > "${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf" | ||
145 | |||
146 | export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-${task}.conf" | ||
147 | |||
148 | mkdir -p ${target_rootfs}/var/dpkg/info | ||
149 | mkdir -p ${target_rootfs}/var/dpkg/updates | ||
150 | |||
151 | > ${target_rootfs}/var/dpkg/status | ||
152 | > ${target_rootfs}/var/dpkg/available | ||
153 | |||
154 | apt-get update | ||
155 | |||
156 | # Uclibc builds don't provide this stuff.. | ||
157 | if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then | ||
158 | if [ ! -z "${package_lingusa}" ]; then | ||
159 | apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated | ||
160 | if [ $? -ne 0 ]; then | ||
161 | exit 1 | ||
162 | fi | ||
163 | for i in ${package_lingusa}; do | ||
164 | apt-get install $i --force-yes --allow-unauthenticated | ||
165 | if [ $? -ne 0 ]; then | ||
166 | exit 1 | ||
167 | fi | ||
168 | done | ||
169 | fi | ||
170 | fi | ||
171 | |||
172 | # normal install | ||
173 | for i in ${package_to_install}; do | ||
174 | apt-get install $i --force-yes --allow-unauthenticated | ||
175 | if [ $? -ne 0 ]; then | ||
176 | exit 1 | ||
177 | fi | ||
178 | done | ||
179 | |||
180 | rm -f ${WORKDIR}/temp/log.do_${task}-attemptonly.${PID} | ||
181 | if [ ! -z "${package_attemptonly}" ]; then | ||
182 | for i in ${package_attemptonly}; do | ||
183 | apt-get install $i --force-yes --allow-unauthenticated >> ${WORKDIR}/temp/log.do_${task}-attemptonly.${PID} || true | ||
184 | done | ||
185 | fi | ||
186 | |||
187 | find ${target_rootfs} -name \*.dpkg-new | for i in `cat`; do | ||
188 | mv $i `echo $i | sed -e's,\.dpkg-new$,,'` | ||
189 | done | ||
190 | |||
191 | # Mark all packages installed | ||
192 | sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${target_rootfs}/var/dpkg/status | ||
193 | } | ||
194 | |||
70 | deb_log_check() { | 195 | deb_log_check() { |
71 | target="$1" | 196 | target="$1" |
72 | lf_path="$2" | 197 | lf_path="$2" |
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass index 1335e719f4..e03e80bdb0 100644 --- a/meta/classes/rootfs_deb.bbclass +++ b/meta/classes/rootfs_deb.bbclass | |||
@@ -12,50 +12,29 @@ opkglibdir = "${localstatedir}/lib/opkg" | |||
12 | 12 | ||
13 | fakeroot rootfs_deb_do_rootfs () { | 13 | fakeroot rootfs_deb_do_rootfs () { |
14 | set +e | 14 | set +e |
15 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/info | ||
16 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/updates | ||
17 | 15 | ||
18 | rm -f ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev | ||
19 | rm -f ${STAGING_ETCDIR_NATIVE}/apt/preferences | ||
20 | > ${IMAGE_ROOTFS}/var/dpkg/status | ||
21 | > ${IMAGE_ROOTFS}/var/dpkg/available | ||
22 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/alternatives | 16 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/alternatives |
23 | 17 | ||
24 | priority=1 | 18 | # update index |
25 | for arch in ${PACKAGE_ARCHS}; do | 19 | package_update_index_deb |
26 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | 20 | |
27 | continue; | 21 | #install packages |
28 | fi | 22 | export INSTALL_ROOTFS_DEB="${IMAGE_ROOTFS}" |
29 | cd ${DEPLOY_DIR_DEB}/$arch | 23 | export INSTALL_BASEARCH_DEB="${DPKG_ARCH}" |
30 | # if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then | 24 | export INSTALL_ARCHS_DEB="${PACKAGE_ARCHS}" |
31 | rm -f Packages.gz Packages Packages.bz2 | 25 | export INSTALL_PACKAGES_NORMAL_DEB="${PACKAGE_INSTALL}" |
32 | # fi | 26 | export INSTALL_PACKAGES_ATTEMPTONLY_DEB="${PACKAGE_INSTALL_ATTEMPTONLY}" |
33 | dpkg-scanpackages . | bzip2 > Packages.bz2 | 27 | export INSTALL_PACKAGES_LINGUAS_DEB="${LINGUAS_INSTALL}" |
34 | echo "Label: $arch" > Release | 28 | export INSTALL_TASK_DEB="rootfs" |
35 | |||
36 | echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev | ||
37 | (echo "Package: *" | ||
38 | echo "Pin: release l=$arch" | ||
39 | echo "Pin-Priority: $(expr 800 + $priority)" | ||
40 | echo) >> ${STAGING_ETCDIR_NATIVE}/apt/preferences | ||
41 | priority=$(expr $priority + 5) | ||
42 | done | ||
43 | 29 | ||
44 | tac ${STAGING_ETCDIR_NATIVE}/apt/sources.list.rev > ${STAGING_ETCDIR_NATIVE}/apt/sources.list | 30 | package_install_internal_deb |
45 | 31 | ||
46 | cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \ | ||
47 | | sed -e 's#Architecture ".*";#Architecture "${DPKG_ARCH}";#' \ | ||
48 | | sed -e 's:#ROOTFS#:${IMAGE_ROOTFS}:g' \ | ||
49 | > "${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" | ||
50 | 32 | ||
51 | export APT_CONFIG="${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf" | ||
52 | export D=${IMAGE_ROOTFS} | 33 | export D=${IMAGE_ROOTFS} |
53 | export OFFLINE_ROOT=${IMAGE_ROOTFS} | 34 | export OFFLINE_ROOT=${IMAGE_ROOTFS} |
54 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | 35 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} |
55 | export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | 36 | export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} |
56 | 37 | ||
57 | apt-get update | ||
58 | |||
59 | _flag () { | 38 | _flag () { |
60 | sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/dpkg/status | 39 | sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/dpkg/status |
61 | } | 40 | } |
@@ -63,47 +42,6 @@ fakeroot rootfs_deb_do_rootfs () { | |||
63 | cat ${IMAGE_ROOTFS}/var/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" | 42 | cat ${IMAGE_ROOTFS}/var/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" |
64 | } | 43 | } |
65 | 44 | ||
66 | if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then | ||
67 | if [ ! -z "${LINGUAS_INSTALL}" ]; then | ||
68 | apt-get install glibc-localedata-i18n --force-yes --allow-unauthenticated | ||
69 | if [ $? -ne 0 ]; then | ||
70 | exit 1 | ||
71 | fi | ||
72 | for i in ${LINGUAS_INSTALL}; do | ||
73 | apt-get install $i --force-yes --allow-unauthenticated | ||
74 | if [ $? -ne 0 ]; then | ||
75 | exit 1 | ||
76 | fi | ||
77 | done | ||
78 | fi | ||
79 | fi | ||
80 | |||
81 | if [ ! -z "${PACKAGE_INSTALL}" ]; then | ||
82 | for i in ${PACKAGE_INSTALL}; do | ||
83 | apt-get install $i --force-yes --allow-unauthenticated | ||
84 | if [ $? -ne 0 ]; then | ||
85 | exit 1 | ||
86 | fi | ||
87 | done | ||
88 | fi | ||
89 | |||
90 | rm ${WORKDIR}/temp/log.do_$target-attemptonly.${PID} | ||
91 | if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then | ||
92 | for i in ${PACKAGE_INSTALL_ATTEMPTONLY}; do | ||
93 | apt-get install $i --force-yes --allow-unauthenticated >> ${WORKDIR}/temp/log.do_rootfs-attemptonly.${PID} || true | ||
94 | done | ||
95 | fi | ||
96 | |||
97 | find ${IMAGE_ROOTFS} -name \*.dpkg-new | for i in `cat`; do | ||
98 | mv $i `echo $i | sed -e's,\.dpkg-new$,,'` | ||
99 | done | ||
100 | |||
101 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
102 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
103 | |||
104 | # Mark all packages installed | ||
105 | sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" ${IMAGE_ROOTFS}/var/dpkg/status | ||
106 | |||
107 | # Attempt to run preinsts | 45 | # Attempt to run preinsts |
108 | # Mark packages with preinst failures as unpacked | 46 | # Mark packages with preinst failures as unpacked |
109 | for i in ${IMAGE_ROOTFS}/var/dpkg/info/*.preinst; do | 47 | for i in ${IMAGE_ROOTFS}/var/dpkg/info/*.preinst; do |
@@ -122,6 +60,9 @@ fakeroot rootfs_deb_do_rootfs () { | |||
122 | 60 | ||
123 | set -e | 61 | set -e |
124 | 62 | ||
63 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
64 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
65 | |||
125 | # Hacks to allow opkg's update-alternatives and opkg to coexist for now | 66 | # Hacks to allow opkg's update-alternatives and opkg to coexist for now |
126 | mkdir -p ${IMAGE_ROOTFS}${opkglibdir} | 67 | mkdir -p ${IMAGE_ROOTFS}${opkglibdir} |
127 | if [ -e ${IMAGE_ROOTFS}/var/dpkg/alternatives ]; then | 68 | if [ -e ${IMAGE_ROOTFS}/var/dpkg/alternatives ]; then |
@@ -133,7 +74,7 @@ fakeroot rootfs_deb_do_rootfs () { | |||
133 | 74 | ||
134 | ${ROOTFS_POSTPROCESS_COMMAND} | 75 | ${ROOTFS_POSTPROCESS_COMMAND} |
135 | 76 | ||
136 | log_check rootfs | 77 | log_check rootfs |
137 | } | 78 | } |
138 | 79 | ||
139 | remove_packaging_data_files() { | 80 | remove_packaging_data_files() { |