summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorConstantin Musca <constantinx.musca@intel.com>2012-12-05 10:58:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-17 17:42:19 +0000
commitd0f35207f9e19b440393a79ebf621649c495738d (patch)
tree7906465c9116719628dc96114fd1f9617a864a96 /bitbake/lib/bb/fetch2/__init__.py
parentf39e75ddefe783ffc226d916d6617c794fd1e738 (diff)
downloadpoky-d0f35207f9e19b440393a79ebf621649c495738d.tar.gz
bitbake: fetch2: remove localcount and use AUTOINC instead
- do not use the BB_URI_LOCALCOUNT database for computing revision incremental numbers anymore - sortable_revision now generates "AUTOINC+${latest_rev}" - use one incrementing value rather than several - PV becomes 0.1+gitAUTOINC+deadbeefdecafbad_decafbaddeadbeef - remove all localcount code and simplify the fetcher - this patch addresses the following proposal: http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-November/003878.html (Bitbake rev: 61cf01c5c236b4218f40cfae7c059c2b86765dbd) Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py55
1 files changed, 9 insertions, 46 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 81964f112e..150dc3c18f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -422,10 +422,18 @@ def get_srcrev(d):
422 if not format: 422 if not format:
423 raise FetchError("The SRCREV_FORMAT variable must be set when multiple SCMs are used.") 423 raise FetchError("The SRCREV_FORMAT variable must be set when multiple SCMs are used.")
424 424
425 autoinc = False
426 autoinc_templ = 'AUTOINC+'
425 for scm in scms: 427 for scm in scms:
426 ud = urldata[scm] 428 ud = urldata[scm]
427 for name in ud.names: 429 for name in ud.names:
428 rev = ud.method.sortable_revision(scm, ud, d, name) 430 rev = ud.method.sortable_revision(scm, ud, d, name)
431 if rev.startswith(autoinc_templ):
432 if not autoinc:
433 autoinc = True
434 format = "%s%s" % (autoinc_templ, format)
435 rev = rev[len(autoinc_templ):]
436
429 format = format.replace(name, rev) 437 format = format.replace(name, rev)
430 438
431 return format 439 return format
@@ -1036,23 +1044,6 @@ class FetchMethod(object):
1036 logger.info("URL %s could not be checked for status since no method exists.", url) 1044 logger.info("URL %s could not be checked for status since no method exists.", url)
1037 return True 1045 return True
1038 1046
1039 def localcount_internal_helper(ud, d, name):
1040 """
1041 Return:
1042 a) a locked localcount if specified
1043 b) None otherwise
1044 """
1045
1046 localcount = None
1047 if name != '':
1048 pn = d.getVar("PN", True)
1049 localcount = d.getVar("LOCALCOUNT_" + name, True)
1050 if not localcount:
1051 localcount = d.getVar("LOCALCOUNT", True)
1052 return localcount
1053
1054 localcount_internal_helper = staticmethod(localcount_internal_helper)
1055
1056 def latest_revision(self, url, ud, d, name): 1047 def latest_revision(self, url, ud, d, name):
1057 """ 1048 """
1058 Look in the cache for the latest revision, if not present ask the SCM. 1049 Look in the cache for the latest revision, if not present ask the SCM.
@@ -1075,36 +1066,8 @@ class FetchMethod(object):
1075 if hasattr(self, "_sortable_revision"): 1066 if hasattr(self, "_sortable_revision"):
1076 return self._sortable_revision(url, ud, d) 1067 return self._sortable_revision(url, ud, d)
1077 1068
1078 localcounts = bb.persist_data.persist('BB_URI_LOCALCOUNT', d)
1079 key = self.generate_revision_key(url, ud, d, name)
1080
1081 latest_rev = self._build_revision(url, ud, d, name) 1069 latest_rev = self._build_revision(url, ud, d, name)
1082 last_rev = localcounts.get(key + '_rev') 1070 return 'AUTOINC+%s' % str(latest_rev)
1083 uselocalcount = d.getVar("BB_LOCALCOUNT_OVERRIDE", True) or False
1084 count = None
1085 if uselocalcount:
1086 count = FetchMethod.localcount_internal_helper(ud, d, name)
1087 if count is None:
1088 count = localcounts.get(key + '_count') or "0"
1089
1090 if last_rev == latest_rev:
1091 return str(count + "+" + latest_rev)
1092
1093 buildindex_provided = hasattr(self, "_sortable_buildindex")
1094 if buildindex_provided:
1095 count = self._sortable_buildindex(url, ud, d, latest_rev)
1096
1097 if count is None:
1098 count = "0"
1099 elif uselocalcount or buildindex_provided:
1100 count = str(count)
1101 else:
1102 count = str(int(count) + 1)
1103
1104 localcounts[key + '_rev'] = latest_rev
1105 localcounts[key + '_count'] = count
1106
1107 return str(count + "+" + latest_rev)
1108 1071
1109 def generate_revision_key(self, url, ud, d, name): 1072 def generate_revision_key(self, url, ud, d, name):
1110 key = self._revision_key(url, ud, d, name) 1073 key = self._revision_key(url, ud, d, name)