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/rootfs_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/rootfs_deb.bbclass')
-rw-r--r-- | meta/classes/rootfs_deb.bbclass | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass index bcfa95003c..728ea0e2d1 100644 --- a/meta/classes/rootfs_deb.bbclass +++ b/meta/classes/rootfs_deb.bbclass | |||
@@ -21,118 +21,3 @@ DEB_POSTPROCESS_COMMANDS = "" | |||
21 | 21 | ||
22 | opkglibdir = "${localstatedir}/lib/opkg" | 22 | opkglibdir = "${localstatedir}/lib/opkg" |
23 | 23 | ||
24 | deb_package_setflag() { | ||
25 | sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/lib/dpkg/status | ||
26 | } | ||
27 | |||
28 | deb_package_getflag() { | ||
29 | cat ${IMAGE_ROOTFS}/var/lib/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" | ||
30 | } | ||
31 | |||
32 | fakeroot rootfs_deb_do_rootfs () { | ||
33 | set +e | ||
34 | |||
35 | mkdir -p ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives | ||
36 | |||
37 | # update index | ||
38 | package_update_index_deb | ||
39 | |||
40 | #install packages | ||
41 | export INSTALL_ROOTFS_DEB="${IMAGE_ROOTFS}" | ||
42 | export INSTALL_BASEARCH_DEB="${DPKG_ARCH}" | ||
43 | export INSTALL_ARCHS_DEB="${PACKAGE_ARCHS}" | ||
44 | export INSTALL_PACKAGES_NORMAL_DEB="${PACKAGE_INSTALL}" | ||
45 | export INSTALL_PACKAGES_ATTEMPTONLY_DEB="${PACKAGE_INSTALL_ATTEMPTONLY}" | ||
46 | export INSTALL_PACKAGES_LINGUAS_DEB="${LINGUAS_INSTALL}" | ||
47 | export INSTALL_TASK_DEB="rootfs" | ||
48 | |||
49 | package_install_internal_deb | ||
50 | ${DEB_POSTPROCESS_COMMANDS} | ||
51 | |||
52 | rootfs_install_complementary | ||
53 | |||
54 | export D=${IMAGE_ROOTFS} | ||
55 | export OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
56 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
57 | export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
58 | export INTERCEPT_DIR=${WORKDIR}/intercept_scripts | ||
59 | export NATIVE_ROOT=${STAGING_DIR_NATIVE} | ||
60 | |||
61 | # Attempt to run preinsts | ||
62 | # Mark packages with preinst failures as unpacked | ||
63 | for i in ${IMAGE_ROOTFS}/var/lib/dpkg/info/*.preinst; do | ||
64 | if [ -f $i ] && ! sh $i; then | ||
65 | deb_package_setflag unpacked `basename $i .preinst` | ||
66 | fi | ||
67 | done | ||
68 | |||
69 | # Attempt to run postinsts | ||
70 | # Mark packages with postinst failures as unpacked | ||
71 | for i in ${IMAGE_ROOTFS}/var/lib/dpkg/info/*.postinst; do | ||
72 | if [ -f $i ] && ! sh $i configure; then | ||
73 | deb_package_setflag unpacked `basename $i .postinst` | ||
74 | fi | ||
75 | done | ||
76 | |||
77 | set -e | ||
78 | |||
79 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
80 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
81 | |||
82 | # Hacks to allow opkg's update-alternatives and opkg to coexist for now | ||
83 | mkdir -p ${IMAGE_ROOTFS}${opkglibdir} | ||
84 | if [ -e ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives ]; then | ||
85 | rmdir ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives | ||
86 | fi | ||
87 | ln -s ${opkglibdir}/alternatives ${IMAGE_ROOTFS}/var/lib/dpkg/alternatives | ||
88 | ln -s /var/lib/dpkg/info ${IMAGE_ROOTFS}${opkglibdir}/info | ||
89 | ln -s /var/lib/dpkg/status ${IMAGE_ROOTFS}${opkglibdir}/status | ||
90 | |||
91 | ${ROOTFS_POSTPROCESS_COMMAND} | ||
92 | |||
93 | if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then | ||
94 | delayed_postinsts="$(delayed_postinsts)" | ||
95 | if [ -n "$delayed_postinsts" ]; then | ||
96 | bberror "The following packages could not be configured offline and rootfs is read-only: $delayed_postinsts" | ||
97 | exit 1 | ||
98 | fi | ||
99 | fi | ||
100 | |||
101 | log_check rootfs | ||
102 | } | ||
103 | |||
104 | rootfs_deb_do_rootfs[vardeps] += "delayed_postinsts" | ||
105 | |||
106 | delayed_postinsts () { | ||
107 | cat ${IMAGE_ROOTFS}/var/lib/dpkg/status|grep -e "^Package:" -e "^Status:"|sed -ne 'N;s/Package: \(.*\)\nStatus:.*unpacked/\1/p' | ||
108 | } | ||
109 | |||
110 | save_postinsts () { | ||
111 | # Scripts need to be ordered when executed, this ensures numeric order | ||
112 | # If we ever run into needing more the 899 scripts, we'll have to | ||
113 | # change num to start with 1000. | ||
114 | num=100 | ||
115 | for p in $(delayed_postinsts); do | ||
116 | install -d ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts | ||
117 | cp ${IMAGE_ROOTFS}/var/lib/dpkg/info/$p.postinst ${IMAGE_ROOTFS}${sysconfdir}/deb-postinsts/$num-$p | ||
118 | num=`echo \$((num+1))` | ||
119 | done | ||
120 | } | ||
121 | |||
122 | remove_packaging_data_files() { | ||
123 | rm -rf ${IMAGE_ROOTFS}${opkglibdir} | ||
124 | rm -rf ${IMAGE_ROOTFS}/var/lib/dpkg/ | ||
125 | } | ||
126 | |||
127 | rootfs_install_packages() { | ||
128 | ${STAGING_BINDIR_NATIVE}/apt-get ${APT_ARGS} install `cat $1` --force-yes --allow-unauthenticated | ||
129 | |||
130 | # Mark all packages installed | ||
131 | sed -i -e "s/Status: install ok unpacked/Status: install ok installed/;" $INSTALL_ROOTFS_DEB/var/lib/dpkg/status | ||
132 | } | ||
133 | |||
134 | rootfs_uninstall_packages() { | ||
135 | # for some reason, --root doesn't really work here... We use --admindir&--instdir instead. | ||
136 | ${STAGING_BINDIR_NATIVE}/dpkg --admindir=${IMAGE_ROOTFS}/var/lib/dpkg --instdir=${IMAGE_ROOTFS} -r --force-depends $@ | ||
137 | } | ||
138 | |||