* [master][rocko][PATCH 0/1] Fix uninative link when loaded from a file url
@ 2017-12-07 21:20 Mark Hatle
2017-12-07 21:20 ` [PATCH 1/1] uninative.bbclass: Fix broken symlink issue Mark Hatle
0 siblings, 1 reply; 2+ messages in thread
From: Mark Hatle @ 2017-12-07 21:20 UTC (permalink / raw)
To: openembedded-core
If the uninative link is set from a file URL, a symlink will be created. If
that file is later deleted (i.e. referenced a file in another project layer).
The system will fail on a backtrace during the os.symlink. The same type of
problem must have existed in the bitbake fetcher, as the code there was
already written to allow this case. This copies that design and does the
same procedure of checking for a broken symlink, and unlinks in that case.
This also adds the secondary step if there are two processes that happen to
get to there at the same time (shared DL_DIR for two projects), the exitence
of the link will not trigger a failure due to the try/except.
Mark Hatle (1):
uninative.bbclass: Fix broken symlink issue
meta/classes/uninative.bbclass | 12 ++++++++++++
1 file changed, 12 insertions(+)
--
2.14.2.666.gea220ee
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] uninative.bbclass: Fix broken symlink issue
2017-12-07 21:20 [master][rocko][PATCH 0/1] Fix uninative link when loaded from a file url Mark Hatle
@ 2017-12-07 21:20 ` Mark Hatle
0 siblings, 0 replies; 2+ messages in thread
From: Mark Hatle @ 2017-12-07 21:20 UTC (permalink / raw)
To: openembedded-core
If two builds are sharing the same DL_DIR, and the uninative file is local
to a layer. When the first build gets to uninative it creates the link local
to itself, and subsequent users can use the same link. However if that first
build then is deleted from the disk, the symlink is no longer valid (broken).
We need to update the system to detect this case, and use the model
implemented by the bitbke fetch2 code. Look for a broken link, remove it,
then try to create the link and ignore an exception if it already exists
(since we just unlinked any bad one).
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
meta/classes/uninative.bbclass | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index a410647328..670efa9f05 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -63,7 +63,19 @@ python uninative_event_fetchloader() {
fetcher.download()
localpath = fetcher.localpath(srcuri)
if localpath != tarballpath and os.path.exists(localpath) and not os.path.exists(tarballpath):
+ # Follow the symlink behavior from the bitbake fetch2.
+ # This will cover the case where an existing symlink is broken
+ # as well as if there are two processes trying to create it
+ # at the same time.
+ if os.path.islink(tarballpath):
+ # Broken symbolic link
+ os.unlink(tarballpath)
+
+ # Deal with two processes trying to make symlink at once
+ try:
os.symlink(localpath, tarballpath)
+ except FileExistsError:
+ pass
cmd = d.expand("\
mkdir -p ${UNINATIVE_STAGING_DIR}-uninative; \
--
2.14.2.666.gea220ee
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-07 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07 21:20 [master][rocko][PATCH 0/1] Fix uninative link when loaded from a file url Mark Hatle
2017-12-07 21:20 ` [PATCH 1/1] uninative.bbclass: Fix broken symlink issue Mark Hatle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox