[oe-commits] [openembedded-core] 09/22: sstate: Ensure a given machine only removes things which it created

git at git.openembedded.org git at git.openembedded.org
Wed Aug 15 08:46:09 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 5634f2fb1740732056d2c1a22717184ef94405bf
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Aug 14 14:56:00 2018 +0000

    sstate: Ensure a given machine only removes things which it created
    
    Currently if you build qemux86 and then generic86, the latter will
    remove all of the former from deploy and workdir. This is because
    qemux86 is i586, genericx86 is i686 and the architctures are compatible
    therefore the sstate 'cleaup' code kicks in.
    
    There was a valid reason for this to ensure i586 packages didn't get into
    an i686 rootfs for example. With the rootfs creation being filtered now, this
    is no longer necessary.
    
    Instead, save out a list of stamps which a give machine has ever seen in
    a given build and only clean up these things if they're no longer
    "reachable".
    
    In particular this means the autobuilder should no longer spend a load of time
    deleting files when switching MACHINE, improving build times.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/sstate.bbclass | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 9927c76..cd42db6 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -1045,6 +1045,16 @@ python sstate_eventhandler2() {
         with open(preservestampfile, 'r') as f:
             preservestamps = f.readlines()
     seen = []
+
+    # The machine index contains all the stamps this machine has ever seen in this build directory.
+    # We should only remove things which this machine once accessed but no longer does.
+    machineindex = set()
+    bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
+    mi = d.expand("${SSTATE_MANIFESTS}/index-machine-${MACHINE}")
+    if os.path.exists(mi):
+        with open(mi, "r") as f:
+            machineindex = set(line.strip() for line in f.readlines())
+
     for a in sorted(list(set(d.getVar("SSTATE_ARCHS").split()))):
         toremove = []
         i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
@@ -1054,7 +1064,7 @@ python sstate_eventhandler2() {
             lines = f.readlines()
             for l in lines:
                 (stamp, manifest, workdir) = l.split()
-                if stamp not in stamps and stamp not in preservestamps:
+                if stamp not in stamps and stamp not in preservestamps and stamp in machineindex:
                     toremove.append(l)
                     if stamp not in seen:
                         bb.debug(2, "Stamp %s is not reachable, removing related manifests" % stamp)
@@ -1083,6 +1093,11 @@ python sstate_eventhandler2() {
         with open(i, "w") as f:
             for l in lines:
                 f.write(l)
+    machineindex |= set(stamps)
+    with open(mi, "w") as f:
+        for l in machineindex:
+            f.write(l + "\n")
+
     if preservestamps:
         os.remove(preservestampfile)
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list