summaryrefslogtreecommitdiff
path: root/yocto-poky/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
Diffstat (limited to 'yocto-poky/bitbake/lib/bb/fetch2')
-rw-r--r--yocto-poky/bitbake/lib/bb/fetch2/__init__.py16
-rw-r--r--yocto-poky/bitbake/lib/bb/fetch2/git.py11
-rw-r--r--yocto-poky/bitbake/lib/bb/fetch2/hg.py10
3 files changed, 24 insertions, 13 deletions
diff --git a/yocto-poky/bitbake/lib/bb/fetch2/__init__.py b/yocto-poky/bitbake/lib/bb/fetch2/__init__.py
index 3d53b63b3..288a1c8fd 100644
--- a/yocto-poky/bitbake/lib/bb/fetch2/__init__.py
+++ b/yocto-poky/bitbake/lib/bb/fetch2/__init__.py
@@ -464,7 +464,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d):
for k in replacements:
uri_replace_decoded[loc] = uri_replace_decoded[loc].replace(k, replacements[k])
#bb.note("%s %s %s" % (regexp, uri_replace_decoded[loc], uri_decoded[loc]))
- result_decoded[loc] = re.sub(regexp, uri_replace_decoded[loc], uri_decoded[loc])
+ result_decoded[loc] = re.sub(regexp, uri_replace_decoded[loc], uri_decoded[loc], 1)
if loc == 2:
# Handle path manipulations
basename = None
@@ -862,7 +862,7 @@ def build_mirroruris(origud, mirrors, ld):
replacements["BASENAME"] = origud.path.split("/")[-1]
replacements["MIRRORNAME"] = origud.host.replace(':','.') + origud.path.replace('/', '.').replace('*', '.')
- def adduri(ud, uris, uds):
+ def adduri(ud, uris, uds, mirrors):
for line in mirrors:
try:
(find, replace) = line
@@ -876,6 +876,12 @@ def build_mirroruris(origud, mirrors, ld):
logger.debug(1, "Mirror %s not in the list of trusted networks, skipping" % (newuri))
continue
+ # Create a local copy of the mirrors minus the current line
+ # this will prevent us from recursively processing the same line
+ # as well as indirect recursion A -> B -> C -> A
+ localmirrors = list(mirrors)
+ localmirrors.remove(line)
+
try:
newud = FetchData(newuri, ld)
newud.setup_localpath(ld)
@@ -885,16 +891,16 @@ def build_mirroruris(origud, mirrors, ld):
try:
# setup_localpath of file:// urls may fail, we should still see
# if mirrors of the url exist
- adduri(newud, uris, uds)
+ adduri(newud, uris, uds, localmirrors)
except UnboundLocalError:
pass
continue
uris.append(newuri)
uds.append(newud)
- adduri(newud, uris, uds)
+ adduri(newud, uris, uds, localmirrors)
- adduri(origud, uris, uds)
+ adduri(origud, uris, uds, mirrors)
return uris, uds
diff --git a/yocto-poky/bitbake/lib/bb/fetch2/git.py b/yocto-poky/bitbake/lib/bb/fetch2/git.py
index 40658ff94..9bd87ad25 100644
--- a/yocto-poky/bitbake/lib/bb/fetch2/git.py
+++ b/yocto-poky/bitbake/lib/bb/fetch2/git.py
@@ -66,6 +66,7 @@ Supported SRC_URI options are:
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import errno
import os
import re
import bb
@@ -181,8 +182,6 @@ class Git(FetchMethod):
def download(self, ud, d):
"""Fetch url"""
- ud.repochanged = not os.path.exists(ud.fullmirror)
-
# If the checkout doesn't exist and the mirror tarball does, extract it
if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror):
bb.utils.mkdirhier(ud.clonedir)
@@ -220,7 +219,11 @@ class Git(FetchMethod):
runfetchcmd(fetch_cmd, d)
runfetchcmd("%s prune-packed" % ud.basecmd, d)
runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
- ud.repochanged = True
+ try:
+ os.unlink(ud.fullmirror)
+ except OSError as exc:
+ if exc.errno != errno.ENOENT:
+ raise
os.chdir(ud.clonedir)
for name in ud.names:
if not self._contains_ref(ud, d, name):
@@ -228,7 +231,7 @@ class Git(FetchMethod):
def build_mirror_data(self, ud, d):
# Generate a mirror tarball if needed
- if ud.write_tarballs and (ud.repochanged or not os.path.exists(ud.fullmirror)):
+ if ud.write_tarballs and not os.path.exists(ud.fullmirror):
# it's possible that this symlink points to read-only filesystem with PREMIRROR
if os.path.islink(ud.fullmirror):
os.unlink(ud.fullmirror)
diff --git a/yocto-poky/bitbake/lib/bb/fetch2/hg.py b/yocto-poky/bitbake/lib/bb/fetch2/hg.py
index d978630ba..bbb4ed95d 100644
--- a/yocto-poky/bitbake/lib/bb/fetch2/hg.py
+++ b/yocto-poky/bitbake/lib/bb/fetch2/hg.py
@@ -163,8 +163,6 @@ class Hg(FetchMethod):
def download(self, ud, d):
"""Fetch url"""
- ud.repochanged = not os.path.exists(ud.fullmirror)
-
logger.debug(2, "Fetch: checking for module directory '" + ud.moddir + "'")
# If the checkout doesn't exist and the mirror tarball does, extract it
@@ -189,7 +187,11 @@ class Hg(FetchMethod):
logger.debug(1, "Running %s", pullcmd)
bb.fetch2.check_network_access(d, pullcmd, ud.url)
runfetchcmd(pullcmd, d)
- ud.repochanged = True
+ try:
+ os.unlink(ud.fullmirror)
+ except OSError as exc:
+ if exc.errno != errno.ENOENT:
+ raise
# No source found, clone it.
if not os.path.exists(ud.moddir):
@@ -238,7 +240,7 @@ class Hg(FetchMethod):
def build_mirror_data(self, ud, d):
# Generate a mirror tarball if needed
- if ud.write_tarballs == "1" and (ud.repochanged or not os.path.exists(ud.fullmirror)):
+ if ud.write_tarballs == "1" and not os.path.exists(ud.fullmirror):
# it's possible that this symlink points to read-only filesystem with PREMIRROR
if os.path.islink(ud.fullmirror):
os.unlink(ud.fullmirror)