diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-19 13:17:58 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-22 12:10:12 +0100 |
commit | d228f9d938ecde959621d03fdd6c70ea467b5f39 (patch) | |
tree | b01652d319bc4ec4999d62e657b68b221301e1fa /bitbake/lib/bb/fetch2/__init__.py | |
parent | 608821349c9a71e3e39d38bbc16669146c28d419 (diff) | |
download | poky-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/lib/bb/fetch2/__init__.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 27 |
1 files changed, 10 insertions, 17 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) |