summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py42
1 files changed, 35 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 7326ed0f46..ab4658bc3b 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/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")
@@ -467,6 +472,23 @@ class Fetch(object):
467 472
468 srcrev_internal_helper = staticmethod(srcrev_internal_helper) 473 srcrev_internal_helper = staticmethod(srcrev_internal_helper)
469 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
470 def try_mirror(d, tarfn): 492 def try_mirror(d, tarfn):
471 """ 493 """
472 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
@@ -555,12 +577,7 @@ class Fetch(object):
555 """ 577 """
556 578
557 """ 579 """
558 has_sortable_valid = hasattr(self, "_sortable_revision_valid") 580 if hasattr(self, "_sortable_revision"):
559 has_sortable = hasattr(self, "_sortable_revision")
560
561 if has_sortable and not has_sortable_valid:
562 return self._sortable_revision(url, ud, d)
563 elif has_sortable and self._sortable_revision_valid(url, ud, d):
564 return self._sortable_revision(url, ud, d) 581 return self._sortable_revision(url, ud, d)
565 582
566 pd = persist_data.PersistData(d) 583 pd = persist_data.PersistData(d)
@@ -568,13 +585,24 @@ class Fetch(object):
568 585
569 latest_rev = self._build_revision(url, ud, d) 586 latest_rev = self._build_revision(url, ud, d)
570 last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev") 587 last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
571 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")
572 594
573 if last_rev == latest_rev: 595 if last_rev == latest_rev:
574 return str(count + "+" + latest_rev) 596 return str(count + "+" + latest_rev)
575 597
598 buildindex_provided = hasattr(self, "_sortable_buildindex")
599 if buildindex_provided:
600 count = self._sortable_buildindex(url, ud, d, latest_rev)
601
576 if count is None: 602 if count is None:
577 count = "0" 603 count = "0"
604 elif uselocalcount or buildindex_provided:
605 count = str(count)
578 else: 606 else:
579 count = str(int(count) + 1) 607 count = str(int(count) + 1)
580 608