summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 97cbd3567a..8504678dff 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1151,25 +1151,6 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
1151 if ud.lockfile and ud.lockfile != origud.lockfile: 1151 if ud.lockfile and ud.lockfile != origud.lockfile:
1152 bb.utils.unlockfile(lf) 1152 bb.utils.unlockfile(lf)
1153 1153
1154
1155def ensure_symlink(target, link_name):
1156 if not os.path.exists(link_name):
1157 dirname = os.path.dirname(link_name)
1158 bb.utils.mkdirhier(dirname)
1159 if os.path.islink(link_name):
1160 # Broken symbolic link
1161 os.unlink(link_name)
1162
1163 # In case this is executing without any file locks held (as is
1164 # the case for file:// URLs), two tasks may end up here at the
1165 # same time, in which case we do not want the second task to
1166 # fail when the link has already been created by the first task.
1167 try:
1168 os.symlink(target, link_name)
1169 except FileExistsError:
1170 pass
1171
1172
1173def try_mirrors(fetch, d, origud, mirrors, check = False): 1154def try_mirrors(fetch, d, origud, mirrors, check = False):
1174 """ 1155 """
1175 Try to use a mirrored version of the sources. 1156 Try to use a mirrored version of the sources.
@@ -1655,6 +1636,23 @@ class FetchMethod(object):
1655 """ 1636 """
1656 bb.utils.remove(urldata.localpath) 1637 bb.utils.remove(urldata.localpath)
1657 1638
1639 def ensure_symlink(self, target, link_name):
1640 if not os.path.exists(link_name):
1641 dirname = os.path.dirname(link_name)
1642 bb.utils.mkdirhier(dirname)
1643 if os.path.islink(link_name):
1644 # Broken symbolic link
1645 os.unlink(link_name)
1646
1647 # In case this is executing without any file locks held (as is
1648 # the case for file:// URLs), two tasks may end up here at the
1649 # same time, in which case we do not want the second task to
1650 # fail when the link has already been created by the first task.
1651 try:
1652 os.symlink(target, link_name)
1653 except FileExistsError:
1654 pass
1655
1658 def try_premirror(self, urldata, d): 1656 def try_premirror(self, urldata, d):
1659 """ 1657 """
1660 Should premirrors be used? 1658 Should premirrors be used?