summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-19 13:17:58 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-22 12:10:12 +0100
commitd228f9d938ecde959621d03fdd6c70ea467b5f39 (patch)
treeb01652d319bc4ec4999d62e657b68b221301e1fa /bitbake
parent608821349c9a71e3e39d38bbc16669146c28d419 (diff)
downloadpoky-d228f9d938ecde959621d03fdd6c70ea467b5f39.tar.gz
bitbake: fetch2/git: Clean up sortable_revision
Now we no longer try and provide increasing values from the fetcher, we can simplify the function structure for the sortable_revision pieces and move the AUTOINC handling directly into the function which needs it, simplifying the code. (Bitbake rev: fb068bee47bb1a06f02447daf16c2b2a79c03288) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py27
-rw-r--r--bitbake/lib/bb/fetch2/bzr.py4
-rw-r--r--bitbake/lib/bb/fetch2/svn.py4
3 files changed, 14 insertions, 21 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 9029a5a83c..6443303ca2 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -619,7 +619,10 @@ def get_srcrev(d):
619 raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI") 619 raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")
620 620
621 if len(scms) == 1 and len(urldata[scms[0]].names) == 1: 621 if len(scms) == 1 and len(urldata[scms[0]].names) == 1:
622 return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d, urldata[scms[0]].names[0]) 622 autoinc, rev = urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d, urldata[scms[0]].names[0])
623 if autoinc:
624 return "AUTOINC+" + rev
625 return rev
623 626
624 # 627 #
625 # Mutiple SCMs are in SRC_URI so we resort to SRCREV_FORMAT 628 # Mutiple SCMs are in SRC_URI so we resort to SRCREV_FORMAT
@@ -628,18 +631,14 @@ def get_srcrev(d):
628 if not format: 631 if not format:
629 raise FetchError("The SRCREV_FORMAT variable must be set when multiple SCMs are used.") 632 raise FetchError("The SRCREV_FORMAT variable must be set when multiple SCMs are used.")
630 633
631 autoinc = False 634 seenautoinc = False
632 autoinc_templ = 'AUTOINC+'
633 for scm in scms: 635 for scm in scms:
634 ud = urldata[scm] 636 ud = urldata[scm]
635 for name in ud.names: 637 for name in ud.names:
636 rev = ud.method.sortable_revision(scm, ud, d, name) 638 autoinc, rev = ud.method.sortable_revision(scm, ud, d, name)
637 if rev.startswith(autoinc_templ): 639 if autoinc and not seenautoinc:
638 if not autoinc: 640 rev = "AUTOINC+" + rev
639 autoinc = True 641 seenautoinc
640 format = "%s%s" % (autoinc_templ, format)
641 rev = rev[len(autoinc_templ):]
642
643 format = format.replace(name, rev) 642 format = format.replace(name, rev)
644 643
645 return format 644 return format
@@ -1277,14 +1276,8 @@ class FetchMethod(object):
1277 return rev 1276 return rev
1278 1277
1279 def sortable_revision(self, url, ud, d, name): 1278 def sortable_revision(self, url, ud, d, name):
1280 """
1281
1282 """
1283 if hasattr(self, "_sortable_revision"):
1284 return self._sortable_revision(url, ud, d)
1285
1286 latest_rev = self._build_revision(url, ud, d, name) 1279 latest_rev = self._build_revision(url, ud, d, name)
1287 return 'AUTOINC+%s' % str(latest_rev) 1280 return True, str(latest_rev)
1288 1281
1289 def generate_revision_key(self, url, ud, d, name): 1282 def generate_revision_key(self, url, ud, d, name):
1290 key = self._revision_key(url, ud, d, name) 1283 key = self._revision_key(url, ud, d, name)
diff --git a/bitbake/lib/bb/fetch2/bzr.py b/bitbake/lib/bb/fetch2/bzr.py
index 58e80c81f6..5d9e5f907c 100644
--- a/bitbake/lib/bb/fetch2/bzr.py
+++ b/bitbake/lib/bb/fetch2/bzr.py
@@ -132,12 +132,12 @@ class Bzr(FetchMethod):
132 132
133 return output.strip() 133 return output.strip()
134 134
135 def _sortable_revision(self, url, ud, d): 135 def sortable_revision(self, url, ud, d, name):
136 """ 136 """
137 Return a sortable revision number which in our case is the revision number 137 Return a sortable revision number which in our case is the revision number
138 """ 138 """
139 139
140 return self._build_revision(url, ud, d) 140 return False, self._build_revision(url, ud, d)
141 141
142 def _build_revision(self, url, ud, d): 142 def _build_revision(self, url, ud, d):
143 return ud.revision 143 return ud.revision
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
index cbf929e9c5..9a779d2448 100644
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -178,12 +178,12 @@ class Svn(FetchMethod):
178 178
179 return revision 179 return revision
180 180
181 def _sortable_revision(self, url, ud, d): 181 def sortable_revision(self, url, ud, d, name):
182 """ 182 """
183 Return a sortable revision number which in our case is the revision number 183 Return a sortable revision number which in our case is the revision number
184 """ 184 """
185 185
186 return self._build_revision(url, ud, d) 186 return False, self._build_revision(url, ud, d)
187 187
188 def _build_revision(self, url, ud, d): 188 def _build_revision(self, url, ud, d):
189 return ud.revision 189 return ud.revision