summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index eed7095819..1d41033f54 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -170,6 +170,8 @@ def localpaths(d):
170 170
171 return local 171 return local
172 172
173srcrev_internal_call = False
174
173def get_srcrev(d): 175def get_srcrev(d):
174 """ 176 """
175 Return the version string for the current package 177 Return the version string for the current package
@@ -178,6 +180,19 @@ def get_srcrev(d):
178 In the multi SCM case, we build a value based on SRCREV_FORMAT which must 180 In the multi SCM case, we build a value based on SRCREV_FORMAT which must
179 have been set. 181 have been set.
180 """ 182 """
183
184 #
185 # Ugly code alert. localpath in the fetchers will try to evaluate SRCREV which
186 # could translate into a call to here. If it does, we need to catch this
187 # and provide some way so it knows get_srcrev is active instead of being
188 # some number etc. hence the srcrev_internal_call tracking and the magic
189 # "SRCREVINACTION" return value.
190 #
191 # Neater solutions welcome!
192 #
193 if bb.fetch.srcrev_internal_call:
194 return "SRCREVINACTION"
195
181 scms = [] 196 scms = []
182 # Only call setup_localpath on URIs which suppports_srcrev() 197 # Only call setup_localpath on URIs which suppports_srcrev()
183 urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False) 198 urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False)
@@ -273,12 +288,14 @@ class FetchData(object):
273 def setup_localpath(self, d): 288 def setup_localpath(self, d):
274 self.setup = True 289 self.setup = True
275 if "localpath" in self.parm: 290 if "localpath" in self.parm:
291 # if user sets localpath for file, use it instead.
276 self.localpath = self.parm["localpath"] 292 self.localpath = self.parm["localpath"]
277 else: 293 else:
294 bb.fetch.srcrev_internal_call = True
278 self.localpath = self.method.localpath(self.url, self, d) 295 self.localpath = self.method.localpath(self.url, self, d)
296 bb.fetch.srcrev_internal_call = False
279 self.md5 = self.localpath + '.md5' 297 self.md5 = self.localpath + '.md5'
280 self.lockfile = self.localpath + '.lock' 298 self.lockfile = self.localpath + '.lock'
281 # if user sets localpath for file, use it instead.
282 299
283 300
284class Fetch(object): 301class Fetch(object):