summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 31d9f01c21..958469db62 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -720,7 +720,7 @@ def get_autorev(d):
720 d.setVar('__BB_DONT_CACHE', '1') 720 d.setVar('__BB_DONT_CACHE', '1')
721 return "AUTOINC" 721 return "AUTOINC"
722 722
723def get_srcrev(d): 723def get_srcrev(d, method_name='sortable_revision'):
724 """ 724 """
725 Return the revsion string, usually for use in the version string (PV) of the current package 725 Return the revsion string, usually for use in the version string (PV) of the current package
726 Most packages usually only have one SCM so we just pass on the call. 726 Most packages usually only have one SCM so we just pass on the call.
@@ -729,6 +729,9 @@ def get_srcrev(d):
729 729
730 The idea here is that we put the string "AUTOINC+" into return value if the revisions are not 730 The idea here is that we put the string "AUTOINC+" into return value if the revisions are not
731 incremental, other code is then responsible for turning that into an increasing value (if needed) 731 incremental, other code is then responsible for turning that into an increasing value (if needed)
732
733 A method_name can be supplied to retrieve an alternatively formatted revision from a fetcher, if
734 that fetcher provides a method with the given name and the same signature as sortable_revision.
732 """ 735 """
733 736
734 scms = [] 737 scms = []
@@ -742,7 +745,7 @@ def get_srcrev(d):
742 raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI") 745 raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")
743 746
744 if len(scms) == 1 and len(urldata[scms[0]].names) == 1: 747 if len(scms) == 1 and len(urldata[scms[0]].names) == 1:
745 autoinc, rev = urldata[scms[0]].method.sortable_revision(urldata[scms[0]], d, urldata[scms[0]].names[0]) 748 autoinc, rev = getattr(urldata[scms[0]].method, method_name)(urldata[scms[0]], d, urldata[scms[0]].names[0])
746 if len(rev) > 10: 749 if len(rev) > 10:
747 rev = rev[:10] 750 rev = rev[:10]
748 if autoinc: 751 if autoinc:
@@ -760,7 +763,7 @@ def get_srcrev(d):
760 for scm in scms: 763 for scm in scms:
761 ud = urldata[scm] 764 ud = urldata[scm]
762 for name in ud.names: 765 for name in ud.names:
763 autoinc, rev = ud.method.sortable_revision(ud, d, name) 766 autoinc, rev = getattr(ud.method, method_name)(ud, d, name)
764 seenautoinc = seenautoinc or autoinc 767 seenautoinc = seenautoinc or autoinc
765 if len(rev) > 10: 768 if len(rev) > 10:
766 rev = rev[:10] 769 rev = rev[:10]