[oe-commits] [openembedded-core] 01/14: uninative.bbclass: Fix broken symlink issue

git at git.openembedded.org git at git.openembedded.org
Mon Jan 29 08:51:04 UTC 2018


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

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

commit 32895152580152c6613a4d651ba1bcee9be9883f
Author: Mark Hatle <mark.hatle at windriver.com>
AuthorDate: Tue Jan 23 14:56:18 2018 -0200

    uninative.bbclass: Fix broken symlink issue
    
    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 at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    (cherry picked from commit bfd9664edad7044b5da53fc33b8d0f6508f00950)
    Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/classes/uninative.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index a410647..670efa9 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; \

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


More information about the Openembedded-commits mailing list