summaryrefslogtreecommitdiffstats
path: root/meta/classes/rootfs_rpm.bbclass
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-01-27 10:08:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:53:42 +0000
commit62c625e3c15154db8e0dfcd0512ddac52a5e5fbf (patch)
tree4b13b2cc608a920a161650c1bdd673dac613562f /meta/classes/rootfs_rpm.bbclass
parent4d8982a1c630f88d2610a85705d68b8a0ec3c1ec (diff)
downloadpoky-62c625e3c15154db8e0dfcd0512ddac52a5e5fbf.tar.gz
Cleanup rootfs_rpm,package_rpm bbclass files
This commit cleans up the functions that were ported to python. (From OE-Core rev: a4fe5263a683b73d0318fe3c0c55382c084f25b5) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/rootfs_rpm.bbclass')
-rw-r--r--meta/classes/rootfs_rpm.bbclass184
1 files changed, 0 insertions, 184 deletions
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index 1a0c2255a9..032dabcd0c 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -24,170 +24,10 @@ do_rootfs[depends] += "createrepo-native:do_populate_sysroot"
24do_rootfs[recrdeptask] += "do_package_write_rpm" 24do_rootfs[recrdeptask] += "do_package_write_rpm"
25rootfs_rpm_do_rootfs[vardepsexclude] += "BUILDNAME" 25rootfs_rpm_do_rootfs[vardepsexclude] += "BUILDNAME"
26 26
27RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; "
28RPM_POSTPROCESS_COMMANDS = "rpm_setup_smart_target_config; "
29
30rpmlibdir = "/var/lib/rpm"
31opkglibdir = "${localstatedir}/lib/opkg"
32
33RPMOPTS="--dbpath ${rpmlibdir}"
34RPM="rpm ${RPMOPTS}"
35
36# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files 27# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files
37# in ${DEPLOY_DIR_RPM}. This can be removed if package_update_index_rpm can be called concurrently 28# in ${DEPLOY_DIR_RPM}. This can be removed if package_update_index_rpm can be called concurrently
38do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock" 29do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
39 30
40fakeroot rootfs_rpm_do_rootfs () {
41 ${RPM_PREPROCESS_COMMANDS}
42
43 # install packages
44 # This needs to work in the same way as populate_sdk_rpm.bbclass!
45 export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}"
46 export INSTALL_PLATFORM_RPM="$(echo ${TARGET_ARCH} | tr - _)${TARGET_VENDOR}-${TARGET_OS}"
47 export INSTALL_PACKAGES_RPM="${PACKAGE_INSTALL}"
48 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}"
49 export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}"
50 export INSTALL_PROVIDENAME_RPM=""
51 export INSTALL_TASK_RPM="rootfs_rpm_do_rootfs"
52 export INSTALL_COMPLEMENTARY_RPM=""
53
54 # Setup base system configuration
55 mkdir -p ${INSTALL_ROOTFS_RPM}/etc/rpm/
56
57 # List must be prefered to least preferred order
58 default_extra_rpm=""
59 INSTALL_PLATFORM_EXTRA_RPM=""
60 for os in ${MULTILIB_OS_LIST} ; do
61 old_IFS="$IFS"
62 IFS=":"
63 set -- $os
64 IFS="$old_IFS"
65 mlib=$1
66 mlib_os=$2
67 for prefix in ${MULTILIB_PREFIX_LIST} ; do
68 old_IFS="$IFS"
69 IFS=":"
70 set -- $prefix
71 IFS="$old_IFS"
72 if [ "$mlib" != "$1" ]; then
73 continue
74 fi
75 shift #remove mlib
76 while [ -n "$1" ]; do
77 platform="$(echo $1 | tr - _)-.*-$mlib_os"
78 if [ "$mlib" = "${BBEXTENDVARIANT}" ]; then
79 default_extra_rpm="$default_extra_rpm $platform"
80 else
81 INSTALL_PLATFORM_EXTRA_RPM="$INSTALL_PLATFORM_EXTRA_RPM $platform"
82 fi
83 shift
84 done
85 done
86 done
87 if [ -n "$default_extra_rpm" ]; then
88 INSTALL_PLATFORM_EXTRA_RPM="$default_extra_rpm $INSTALL_PLATFORM_EXTRA_RPM"
89 fi
90 export INSTALL_PLATFORM_EXTRA_RPM
91
92 package_install_internal_rpm
93
94 rootfs_install_complementary
95
96 export D=${IMAGE_ROOTFS}
97 export OFFLINE_ROOT=${IMAGE_ROOTFS}
98 export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
99 export OPKG_OFFLINE_ROOT=${IMAGE_ROOTFS}
100
101 ${ROOTFS_POSTINSTALL_COMMAND}
102
103 # Report delayed package scriptlets
104 for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*; do
105 if [ -f $i ]; then
106 echo "Delayed package scriptlet: `head -n 3 $i | tail -n 1`"
107 fi
108 done
109
110 install -d ${IMAGE_ROOTFS}/${sysconfdir}
111 echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version
112
113 ${RPM_POSTPROCESS_COMMANDS}
114 ${ROOTFS_POSTPROCESS_COMMAND}
115
116 if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
117 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ] ; then
118 failed_pkgs=$(ls -A ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts)
119 if [ -n "$failed_pkgs" ] ; then
120 bberror "The following post-install scripts could not be run offline and rootfs is read-only: $failed_pkgs"
121 exit 1
122 fi
123 fi
124 fi
125
126 rm -rf ${IMAGE_ROOTFS}/var/cache2/
127 rm -rf ${IMAGE_ROOTFS}/var/run2/
128 rm -rf ${IMAGE_ROOTFS}/var/log2/
129
130 # remove lock files
131 rm -f ${IMAGE_ROOTFS}${rpmlibdir}/__db.*
132
133 # Remove all remaining resolver files
134 rm -rf ${IMAGE_ROOTFS}/install
135
136 log_check rootfs
137}
138
139rootfs_rpm_do_rootfs[vardeps] += "delayed_postinsts"
140
141delayed_postinsts() {
142 if [ -d ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts ]; then
143 ls ${IMAGE_ROOTFS}${sysconfdir}/rpm-postinsts
144 fi
145}
146
147save_postinsts() {
148 # this is just a stub. For RPM, the failed postinstalls are already saved in
149 # /etc/rpm-postinsts
150 true
151}
152
153remove_packaging_data_files() {
154 # Save the rpmlib for increment rpm image generation
155 t="${T}/saved_rpmlib/var/lib"
156 rm -fr $t
157 mkdir -p $t
158 mv ${IMAGE_ROOTFS}${rpmlibdir} $t
159 rm -rf ${IMAGE_ROOTFS}${opkglibdir}
160 rm -rf ${IMAGE_ROOTFS}/var/lib/smart
161}
162
163rpm_setup_smart_target_config() {
164 # Set up smart configuration for the target
165 rm -rf ${IMAGE_ROOTFS}/var/lib/smart
166 smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y
167 package_write_smart_config ${IMAGE_ROOTFS}
168 rm -f ${IMAGE_ROOTFS}/var/lib/smart/config.old
169}
170
171rootfs_install_packages() {
172 # Note - we expect the variables not set here to already have been set
173 export INSTALL_PACKAGES_RPM=""
174 export INSTALL_PACKAGES_ATTEMPTONLY_RPM="`cat $1`"
175 export INSTALL_PROVIDENAME_RPM=""
176 export INSTALL_TASK_RPM="rootfs_install_packages"
177 export INSTALL_COMPLEMENTARY_RPM="1"
178
179 package_install_internal_rpm
180}
181
182rootfs_uninstall_packages() {
183 rpm -e --nodeps --root=${IMAGE_ROOTFS} --dbpath=/var/lib/rpm\
184 --define='_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper'\
185 --define='_tmppath /install/tmp' $@
186
187 # remove temp directory
188 rm -rf ${IMAGE_ROOTFS}/install
189}
190
191python () { 31python () {
192 if d.getVar('BUILD_IMAGES_FROM_FEEDS', True): 32 if d.getVar('BUILD_IMAGES_FROM_FEEDS', True):
193 flags = d.getVarFlag('do_rootfs', 'recrdeptask') 33 flags = d.getVarFlag('do_rootfs', 'recrdeptask')
@@ -198,28 +38,4 @@ python () {
198 d.setVar('RPM_PREPROCESS_COMMANDS', '') 38 d.setVar('RPM_PREPROCESS_COMMANDS', '')
199 d.setVar('RPM_POSTPROCESS_COMMANDS', '') 39 d.setVar('RPM_POSTPROCESS_COMMANDS', '')
200 40
201 # The following code should be kept in sync w/ the populate_sdk_rpm version.
202
203 # package_arch order is reversed. This ensures the -best- match is listed first!
204 package_archs = d.getVar("PACKAGE_ARCHS", True) or ""
205 package_archs = ":".join(package_archs.split()[::-1])
206 package_os = d.getVar("TARGET_OS", True) or ""
207 ml_prefix_list = "%s:%s" % ('default', package_archs)
208 ml_os_list = "%s:%s" % ('default', package_os)
209 multilibs = d.getVar('MULTILIBS', True) or ""
210 for ext in multilibs.split():
211 eext = ext.split(':')
212 if len(eext) > 1 and eext[0] == 'multilib':
213 localdata = bb.data.createCopy(d)
214 default_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + eext[1], False)
215 if default_tune:
216 localdata.setVar("DEFAULTTUNE", default_tune)
217 bb.data.update_data(localdata)
218 package_archs = localdata.getVar("PACKAGE_ARCHS", True) or ""
219 package_archs = ":".join([i in "all noarch any".split() and i or eext[1]+"_"+i for i in package_archs.split()][::-1])
220 package_os = localdata.getVar("TARGET_OS", True) or ""
221 ml_prefix_list += " %s:%s" % (eext[1], package_archs)
222 ml_os_list += " %s:%s" % (eext[1], package_os)
223 d.setVar('MULTILIB_PREFIX_LIST', ml_prefix_list)
224 d.setVar('MULTILIB_OS_LIST', ml_os_list)
225} 41}