Skip to content

Commit 143881b

Browse files
Pedro Ferreirarpurdie
authored andcommitted
buildhistory.bbclass: restore BUILDHISTORY_PRESERVE files
On each build using sstate-cache, buildhistory will move content to a temporary folder named `old`. When buildhistory looks for the main dir, it wont find it and ends up creating it. As a consequence how code is structured wont restore any preserved file. Code block moved to ensure if old dir exists, it will attempt to restore those files marked to preserve. (From OE-Core rev: 0f8c6e6bc783de248ed346607541d26567f18858) Signed-off-by: Pedro Silva Ferreira <Pedro.Silva.Ferreira@criticaltechworks.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1 parent 43a2be2 commit 143881b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

meta/classes/buildhistory.bbclass

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,6 @@ python buildhistory_emit_pkghistory() {
260260
if not os.path.exists(pkghistdir):
261261
bb.utils.mkdirhier(pkghistdir)
262262
else:
263-
# We need to make sure that all files kept in
264-
# buildhistory/old are restored successfully
265-
# otherwise next block of code wont have files to
266-
# check and purge
267-
if d.getVar("BUILDHISTORY_RESET"):
268-
for pkg in packagelist:
269-
preservebuildhistoryfiles(pkg, preserve)
270-
271263
# Remove files for packages that no longer exist
272264
for item in os.listdir(pkghistdir):
273265
if item not in preserve:
@@ -280,6 +272,13 @@ python buildhistory_emit_pkghistory() {
280272
else:
281273
os.unlink(itempath)
282274

275+
if os.path.exists(oldpkghistdir):
276+
# We need to make sure that all files in preserve
277+
# are restored from buildhistory/old successfully
278+
if d.getVar("BUILDHISTORY_RESET"):
279+
for pkg in packagelist:
280+
preservebuildhistoryfiles(pkg, preserve)
281+
283282
rcpinfo = RecipeInfo(pn)
284283
rcpinfo.pe = pe
285284
rcpinfo.pv = pv

0 commit comments

Comments
 (0)