summaryrefslogtreecommitdiffstats
path: root/bitbake-dev/lib/bb/fetch/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake-dev/lib/bb/fetch/__init__.py')
-rw-r--r--bitbake-dev/lib/bb/fetch/__init__.py50
1 files changed, 40 insertions, 10 deletions
diff --git a/bitbake-dev/lib/bb/fetch/__init__.py b/bitbake-dev/lib/bb/fetch/__init__.py
index b8a00107e2..ab4658bc3b 100644
--- a/bitbake-dev/lib/bb/fetch/__init__.py
+++ b/bitbake-dev/lib/bb/fetch/__init__.py
@@ -99,6 +99,11 @@ def fetcher_init(d):
99 pd.delDomain("BB_URI_HEADREVS") 99 pd.delDomain("BB_URI_HEADREVS")
100 else: 100 else:
101 bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy) 101 bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy)
102
103 for m in methods:
104 if hasattr(m, "init"):
105 m.init(d)
106
102 # Make sure our domains exist 107 # Make sure our domains exist
103 pd.addDomain("BB_URI_HEADREVS") 108 pd.addDomain("BB_URI_HEADREVS")
104 pd.addDomain("BB_URI_LOCALCOUNT") 109 pd.addDomain("BB_URI_LOCALCOUNT")
@@ -147,14 +152,16 @@ def init(urls, d, setup = True):
147 urldata_cache[fn] = urldata 152 urldata_cache[fn] = urldata
148 return urldata 153 return urldata
149 154
150def go(d): 155def go(d, urls = None):
151 """ 156 """
152 Fetch all urls 157 Fetch all urls
153 init must have previously been called 158 init must have previously been called
154 """ 159 """
155 urldata = init([], d, True) 160 if not urls:
161 urls = d.getVar("SRC_URI", 1).split()
162 urldata = init(urls, d, True)
156 163
157 for u in urldata: 164 for u in urls:
158 ud = urldata[u] 165 ud = urldata[u]
159 m = ud.method 166 m = ud.method
160 if ud.localfile: 167 if ud.localfile:
@@ -465,6 +472,23 @@ class Fetch(object):
465 472
466 srcrev_internal_helper = staticmethod(srcrev_internal_helper) 473 srcrev_internal_helper = staticmethod(srcrev_internal_helper)
467 474
475 def localcount_internal_helper(ud, d):
476 """
477 Return:
478 a) a locked localcount if specified
479 b) None otherwise
480 """
481
482 localcount= None
483 if 'name' in ud.parm:
484 pn = data.getVar("PN", d, 1)
485 localcount = data.getVar("LOCALCOUNT_" + ud.parm['name'], d, 1)
486 if not localcount:
487 localcount = data.getVar("LOCALCOUNT", d, 1)
488 return localcount
489
490 localcount_internal_helper = staticmethod(localcount_internal_helper)
491
468 def try_mirror(d, tarfn): 492 def try_mirror(d, tarfn):
469 """ 493 """
470 Try to use a mirrored version of the sources. We do this 494 Try to use a mirrored version of the sources. We do this
@@ -553,12 +577,7 @@ class Fetch(object):
553 """ 577 """
554 578
555 """ 579 """
556 has_sortable_valid = hasattr(self, "_sortable_revision_valid") 580 if hasattr(self, "_sortable_revision"):
557 has_sortable = hasattr(self, "_sortable_revision")
558
559 if has_sortable and not has_sortable_valid:
560 return self._sortable_revision(url, ud, d)
561 elif has_sortable and self._sortable_revision_valid(url, ud, d):
562 return self._sortable_revision(url, ud, d) 581 return self._sortable_revision(url, ud, d)
563 582
564 pd = persist_data.PersistData(d) 583 pd = persist_data.PersistData(d)
@@ -566,13 +585,24 @@ class Fetch(object):
566 585
567 latest_rev = self._build_revision(url, ud, d) 586 latest_rev = self._build_revision(url, ud, d)
568 last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev") 587 last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
569 count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count") 588 uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
589 count = None
590 if uselocalcount:
591 count = Fetch.localcount_internal_helper(ud, d)
592 if count is None:
593 count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
570 594
571 if last_rev == latest_rev: 595 if last_rev == latest_rev:
572 return str(count + "+" + latest_rev) 596 return str(count + "+" + latest_rev)
573 597
598 buildindex_provided = hasattr(self, "_sortable_buildindex")
599 if buildindex_provided:
600 count = self._sortable_buildindex(url, ud, d, latest_rev)
601
574 if count is None: 602 if count is None:
575 count = "0" 603 count = "0"
604 elif uselocalcount or buildindex_provided:
605 count = str(count)
576 else: 606 else:
577 count = str(int(count) + 1) 607 count = str(int(count) + 1)
578 608