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__.py34
1 files changed, 10 insertions, 24 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 16cf1fa2be..b9cca91684 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -358,7 +358,8 @@ def localpaths(d):
358 358
359 return local 359 return local
360 360
361srcrev_internal_call = False 361def get_autorev(d):
362 return "AUTOINC"
362 363
363def get_srcrev(d): 364def get_srcrev(d):
364 """ 365 """
@@ -369,18 +370,6 @@ def get_srcrev(d):
369 have been set. 370 have been set.
370 """ 371 """
371 372
372 #
373 # Ugly code alert. localpath in the fetchers will try to evaluate SRCREV which
374 # could translate into a call to here. If it does, we need to catch this
375 # and provide some way so it knows get_srcrev is active instead of being
376 # some number etc. hence the srcrev_internal_call tracking and the magic
377 # "SRCREVINACTION" return value.
378 #
379 # Neater solutions welcome!
380 #
381 if bb.fetch2.srcrev_internal_call:
382 return "SRCREVINACTION"
383
384 scms = [] 373 scms = []
385 374
386 # Only call setup_localpath on URIs which supports_srcrev() 375 # Only call setup_localpath on URIs which supports_srcrev()
@@ -548,6 +537,8 @@ class FetchData(object):
548 self.method = m 537 self.method = m
549 if hasattr(m,"urldata_init"): 538 if hasattr(m,"urldata_init"):
550 m.urldata_init(self, d) 539 m.urldata_init(self, d)
540 if m.supports_srcrev():
541 self.revision = Fetch.srcrev_internal_helper(self, d);
551 return 542 return
552 raise NoMethodError("Missing implementation for url %s" % url) 543 raise NoMethodError("Missing implementation for url %s" % url)
553 544
@@ -572,11 +563,7 @@ class FetchData(object):
572 local = "" 563 local = ""
573 self.localpath = local 564 self.localpath = local
574 if not local: 565 if not local:
575 try: 566 self.localpath = self.method.localpath(self.url, self, d)
576 bb.fetch2.srcrev_internal_call = True
577 self.localpath = self.method.localpath(self.url, self, d)
578 finally:
579 bb.fetch2.srcrev_internal_call = False
580 # We have to clear data's internal caches since the cached value of SRCREV is now wrong. 567 # We have to clear data's internal caches since the cached value of SRCREV is now wrong.
581 # Horrible... 568 # Horrible...
582 bb.data.delVar("ISHOULDNEVEREXIST", d) 569 bb.data.delVar("ISHOULDNEVEREXIST", d)
@@ -682,8 +669,8 @@ class Fetch(object):
682 """ 669 """
683 Return: 670 Return:
684 a) a source revision if specified 671 a) a source revision if specified
685 b) True if auto srcrev is in action 672 b) latest revision if SREREV="AUTOINC"
686 c) False otherwise 673 c) None if not specified
687 """ 674 """
688 675
689 if 'rev' in ud.parm: 676 if 'rev' in ud.parm:
@@ -704,10 +691,9 @@ class Fetch(object):
704 rev = data.getVar("SRCREV", d, 1) 691 rev = data.getVar("SRCREV", d, 1)
705 if rev == "INVALID": 692 if rev == "INVALID":
706 raise InvalidSRCREV("Please set SRCREV to a valid value") 693 raise InvalidSRCREV("Please set SRCREV to a valid value")
707 if not rev: 694 if rev == "AUTOINC":
708 return False 695 rev = ud.method.latest_revision(ud.url, ud, d)
709 if rev is "SRCREVINACTION": 696
710 return True
711 return rev 697 return rev
712 698
713 srcrev_internal_helper = staticmethod(srcrev_internal_helper) 699 srcrev_internal_helper = staticmethod(srcrev_internal_helper)