]> code.ossystems Code Review - openembedded-core.git/commitdiff
sstate: Add postrm command support
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Sep 2016 10:45:14 +0000 (11:45 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Sep 2016 21:56:36 +0000 (22:56 +0100)
There are some issues in sstate which can't be handled by file removal
alone. Currently there is no way to execute a command against sstate and
doing so is potentially problematic for things like dependencies. This
patch adds a mechanism where any "postrm" script is executed if its present
allowing some openjade/sgml issues to be resolved.

[YOCTO #8273]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/sstate.bbclass

index 216e133279bbc61e567e2962c66b1f9f5c14d080..ac9d77d52832f6c72a553fdcdc296369a1ba492d 100644 (file)
@@ -175,6 +175,8 @@ def sstate_install(ss, d):
     if os.access(manifest, os.R_OK):
         bb.fatal("Package already staged (%s)?!" % manifest)
 
+    d.setVar("SSTATE_INST_POSTRM", manifest + ".postrm")
+
     locks = []
     for lock in ss['lockfiles-shared']:
         locks.append(bb.utils.lockfile(lock, True))
@@ -408,6 +410,13 @@ def sstate_clean_manifest(manifest, d):
         except OSError:
             pass
 
+    postrm = manifest + ".postrm"
+    if os.path.exists(manifest + ".postrm"):
+        import subprocess
+        os.chmod(postrm, 0o755)
+        subprocess.call(postrm, shell=True)
+        oe.path.remove(postrm)
+
     oe.path.remove(manifest)
 
 def sstate_clean(ss, d):
@@ -1012,6 +1021,8 @@ python sstate_eventhandler2() {
         for r in toremove:
             (stamp, manifest, workdir) = r.split()
             for m in glob.glob(manifest + ".*"):
+                if m.endswith(".postrm"):
+                    continue
                 sstate_clean_manifest(m, d)
             bb.utils.remove(stamp + "*")
             if removeworkdir: