aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-27 09:21:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-11 22:13:20 +0100
commit6afd5cb344f0c7eb415dc1731bade1af4dd600f0 (patch)
tree635bf70393c6f2b86d993044ab2ed209be559c17
parentbb5c7b792162f6397634d05c151ec67ff60dd7d1 (diff)
downloadopenembedded-core-6afd5cb344f0c7eb415dc1731bade1af4dd600f0.zip
openembedded-core-6afd5cb344f0c7eb415dc1731bade1af4dd600f0.tar.gz
openembedded-core-6afd5cb344f0c7eb415dc1731bade1af4dd600f0.tar.bz2
staging: Ensure dependencies are removed before being added
Currently items are added to the sysroot, the obsolete items are removed. If a change such as pkgconfig -> pkgconf is made, this leads to conflicts of overlapping files in the sysroot. In order to better support this, handle removing items before adding them. This requires some minor refactoring to construct the installed list before the main function loop, otherwise there are no changes in this patch other than reordering the operations. (From OE-Core rev: add4f107c151d32d9ea914bb0b93c3d3c17c776c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 5b45fe40db81292dd6bb57b210d1e4ba32e65e9e) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/classes/staging.bbclass77
1 files changed, 39 insertions, 38 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 590be61..286d7b7 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -470,8 +470,6 @@ python extend_recipe_sysroot() {
multilibs = {}
manifests = {}
- installed = []
-
for f in os.listdir(depdir):
if not f.endswith(".complete"):
continue
@@ -483,16 +481,52 @@ python extend_recipe_sysroot() {
os.unlink(f)
os.unlink(f.replace(".complete", ""))
+ installed = []
for dep in configuredeps:
c = setscenedeps[dep][0]
- taskhash = setscenedeps[dep][5]
- taskmanifest = depdir + "/" + c + "." + taskhash
if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
continue
-
installed.append(c)
+ # We want to remove anything which this task previously installed but is no longer a dependency
+ taskindex = depdir + "/" + "index." + mytaskname
+ if os.path.exists(taskindex):
+ potential = []
+ with open(taskindex, "r") as f:
+ for l in f:
+ l = l.strip()
+ if l not in installed:
+ l = depdir + "/" + l
+ if not os.path.exists(l):
+ # Was likely already uninstalled
+ continue
+ potential.append(l)
+ # We need to ensure not other task needs this dependency. We hold the sysroot
+ # lock so we ca search the indexes to check
+ if potential:
+ for i in glob.glob(depdir + "/index.*"):
+ if i.endswith("." + mytaskname):
+ continue
+ with open(i, "r") as f:
+ for l in f:
+ l = l.strip()
+ if l in potential:
+ potential.remove(l)
+ for l in potential:
+ bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
+ lnk = os.readlink(l)
+ sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
+ os.unlink(l)
+ os.unlink(l + ".complete")
+
+ for dep in configuredeps:
+ c = setscenedeps[dep][0]
+ if c not in installed:
+ continue
+ taskhash = setscenedeps[dep][5]
+ taskmanifest = depdir + "/" + c + "." + taskhash
+
if os.path.exists(depdir + "/" + c):
lnk = os.readlink(depdir + "/" + c)
if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
@@ -607,39 +641,6 @@ python extend_recipe_sysroot() {
c = setscenedeps[dep][0]
os.symlink(manifests[dep], depdir + "/" + c + ".complete")
- # We want to remove anything which this task previously installed but is no longer a dependency
- # This could potentially race against another task which also installed it but still requires it
- # but the alternative is not doing anything at all and that race window should be small enough
- # to be insignificant
- taskindex = depdir + "/" + "index." + mytaskname
- if os.path.exists(taskindex):
- potential = []
- with open(taskindex, "r") as f:
- for l in f:
- l = l.strip()
- if l not in installed:
- l = depdir + "/" + l
- if not os.path.exists(l):
- # Was likely already uninstalled
- continue
- potential.append(l)
- # We need to ensure not other task needs this dependency. We hold the sysroot
- # lock so we ca search the indexes to check
- if potential:
- for i in glob.glob(depdir + "/index.*"):
- if i.endswith("." + mytaskname):
- continue
- with open(i, "r") as f:
- for l in f:
- l = l.strip()
- if l in potential:
- potential.remove(l)
- for l in potential:
- bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
- lnk = os.readlink(l)
- sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
- os.unlink(l)
- os.unlink(l + ".complete")
with open(taskindex, "w") as f:
for l in sorted(installed):
f.write(l + "\n")