diff options
author | Richard Purdie <richard@openedhand.com> | 2008-05-14 16:50:51 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-05-14 16:50:51 +0000 |
commit | a71df5506ad870dd64c91ae5490bf2611463b308 (patch) | |
tree | a714f00fd855dcd0b5c18161d2d34e75f553c42e /meta/classes | |
parent | 217b864ca32204f34f0d74487604016b168a22a3 (diff) | |
download | poky-a71df5506ad870dd64c91ae5490bf2611463b308.tar.gz |
packaged-staging.bbclass: Add code to handle checking the stamp dependency tree properly
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4472 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/packaged-staging.bbclass | 68 |
1 files changed, 56 insertions, 12 deletions
diff --git a/meta/classes/packaged-staging.bbclass b/meta/classes/packaged-staging.bbclass index a98b4a71a5..41b348d1b3 100644 --- a/meta/classes/packaged-staging.bbclass +++ b/meta/classes/packaged-staging.bbclass | |||
@@ -16,7 +16,7 @@ PSTAGE_PKGARCH = "${BUILD_SYS}" | |||
16 | PSTAGE_EXTRAPATH ?= "" | 16 | PSTAGE_EXTRAPATH ?= "" |
17 | PSTAGE_PKGPATH = "${DISTRO}${PSTAGE_EXTRAPATH}" | 17 | PSTAGE_PKGPATH = "${DISTRO}${PSTAGE_EXTRAPATH}" |
18 | PSTAGE_PKGPN = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}" | 18 | PSTAGE_PKGPN = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}" |
19 | PSTAGE_PKGNAME = "${PSTAGE_PKGPN}_${PSTAGE_PKGVERSION}_${PSTAGE_PKGARCH}.ipk" | 19 | PSTAGE_PKGNAME = "${PSTAGE_PKGPN}_${PSTAGE_PKGVERSION}_${PSTAGE_PKGARCH}.ipk" |
20 | PSTAGE_PKG = "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}" | 20 | PSTAGE_PKG = "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}" |
21 | 21 | ||
22 | # multimachine.bbclass will override this but add a default in case we're not using it | 22 | # multimachine.bbclass will override this but add a default in case we're not using it |
@@ -107,7 +107,7 @@ def pstage_manualclean(srcname, destvarname, d): | |||
107 | def pstage_cleanpackage(pkgname, d): | 107 | def pstage_cleanpackage(pkgname, d): |
108 | import os, bb | 108 | import os, bb |
109 | 109 | ||
110 | path = bb.data.getVar("PATH", d, 1) | 110 | path = bb.data.getVar("PATH", d, 1) |
111 | list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True) | 111 | list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True) |
112 | 112 | ||
113 | bb.note("Checking if staging package installed") | 113 | bb.note("Checking if staging package installed") |
@@ -170,20 +170,64 @@ python packagestage_scenefunc () { | |||
170 | stagepkg = bb.data.expand("${PSTAGE_PKG}", d) | 170 | stagepkg = bb.data.expand("${PSTAGE_PKG}", d) |
171 | 171 | ||
172 | if os.path.exists(stagepkg): | 172 | if os.path.exists(stagepkg): |
173 | bb.note("Following speedup\n") | ||
174 | path = bb.data.getVar("PATH", d, 1) | 173 | path = bb.data.getVar("PATH", d, 1) |
175 | installcmd = bb.data.getVar("PSTAGE_INSTALL_CMD", d, 1) | 174 | file = bb.data.getVar("FILE", d, True) |
175 | bb.debug(2, "Packaged staging active for %s\n" % file) | ||
176 | 176 | ||
177 | bb.build.exec_func("staging_helper", d) | 177 | bb.build.exec_func("staging_helper", d) |
178 | 178 | ||
179 | bb.debug(1, "Staging stuff already packaged, using that instead") | 179 | # |
180 | lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) | 180 | # Install the staging package somewhere temporarily so we can extract the stamp files |
181 | ret = os.system("PATH=\"%s\" %s %s" % (path, installcmd, stagepkg)) | 181 | # |
182 | bb.utils.unlockfile(lf) | 182 | cmd = bb.data.expand("opkg-cl install -force-depends -f ${PSTAGE_MACHCONFIG} -o ${WORKDIR}/tstage", d) |
183 | ret = os.system("PATH=\"%s\" %s %s" % (path, cmd, stagepkg)) | ||
183 | if ret != 0: | 184 | if ret != 0: |
184 | bb.note("Failure installing prestage package") | 185 | bb.fatal("Couldn't install the staging package to a temp directory") |
185 | 186 | ||
186 | bb.build.make_stamp("do_stage_package_populated", d) | 187 | # |
188 | # Copy the stamp files into the main stamps directoy | ||
189 | # | ||
190 | cmd = bb.data.expand("cp -dpR ${WORKDIR}/tstage/stamps/* ${TMPDIR}/stamps/", d) | ||
191 | ret = os.system(cmd) | ||
192 | if ret != 0: | ||
193 | bb.fatal("Couldn't copy the staging package stamp files") | ||
194 | |||
195 | # | ||
196 | # Iterate over the stamps seeing if they're valid. If we find any that | ||
197 | # are invalid or the task wasn't in the taskgraph, assume caution and | ||
198 | # do a rebuild. | ||
199 | # | ||
200 | # FIXME - some tasks are safe to ignore in the task graph. e.g. package_write_* | ||
201 | stageok = True | ||
202 | taskscovered = bb.data.getVar("PSTAGE_TASKS_COVERED", d, True).split() | ||
203 | stamp = bb.data.getVar("STAMP", d, True) | ||
204 | for task in taskscovered: | ||
205 | task = 'do_' + task | ||
206 | stampfn = "%s.%s" % (stamp, task) | ||
207 | bb.debug(1, "Checking %s" % (stampfn)) | ||
208 | if os.path.exists(stampfn): | ||
209 | stageok = bb.runqueue.check_stamp_fn(file, task, d) | ||
210 | bb.debug(1, "Result %s" % (stageok)) | ||
211 | if not stageok: | ||
212 | break | ||
213 | |||
214 | # Remove the stamps and files we added above | ||
215 | # FIXME - we should really only remove the stamps we added | ||
216 | os.system('rm -f ' + stamp + '.*') | ||
217 | os.system(bb.data.expand("rm -rf ${WORKDIR}/tstage", d)) | ||
218 | |||
219 | if stageok: | ||
220 | bb.note("Staging package found, using it for %s." % file) | ||
221 | installcmd = bb.data.getVar("PSTAGE_INSTALL_CMD", d, 1) | ||
222 | lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) | ||
223 | ret = os.system("PATH=\"%s\" %s %s" % (path, installcmd, stagepkg)) | ||
224 | bb.utils.unlockfile(lf) | ||
225 | if ret != 0: | ||
226 | bb.note("Failure installing prestage package") | ||
227 | |||
228 | bb.build.make_stamp("do_stage_package_populated", d) | ||
229 | else: | ||
230 | bb.note("Staging package found but invalid for %s" % file) | ||
187 | 231 | ||
188 | } | 232 | } |
189 | packagestage_scenefunc[cleandirs] = "${PSTAGE_TMPDIR_STAGE}" | 233 | packagestage_scenefunc[cleandirs] = "${PSTAGE_TMPDIR_STAGE}" |
@@ -317,7 +361,7 @@ python do_package_stage () { | |||
317 | if bb.data.inherits_class('package_deb', d): | 361 | if bb.data.inherits_class('package_deb', d): |
318 | if arch == 'all': | 362 | if arch == 'all': |
319 | srcname = bb.data.expand(pkgname + "_${PV}-" + pr + "_all.deb", d) | 363 | srcname = bb.data.expand(pkgname + "_${PV}-" + pr + "_all.deb", d) |
320 | else: | 364 | else: |
321 | srcname = bb.data.expand(pkgname + "_${PV}-" + pr + "_${DPKG_ARCH}.deb", d) | 365 | srcname = bb.data.expand(pkgname + "_${PV}-" + pr + "_${DPKG_ARCH}.deb", d) |
322 | srcfile = bb.data.expand("${DEPLOY_DIR_DEB}/" + arch + "/" + srcname, d) | 366 | srcfile = bb.data.expand("${DEPLOY_DIR_DEB}/" + arch + "/" + srcname, d) |
323 | if os.path.exists(srcfile): | 367 | if os.path.exists(srcfile): |
@@ -353,6 +397,6 @@ do_package_stage_all () { | |||
353 | do_package_stage_all[recrdeptask] = "do_package_stage" | 397 | do_package_stage_all[recrdeptask] = "do_package_stage" |
354 | addtask package_stage_all after do_package_stage before do_build | 398 | addtask package_stage_all after do_package_stage before do_build |
355 | 399 | ||
356 | 400 | #do_setscene[recrdeptask] = "do_setscene" | |
357 | 401 | ||
358 | 402 | ||