summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-11-13 23:03:21 +0000
committerRichard Purdie <richard@openedhand.com>2007-11-13 23:03:21 +0000
commite13102cd66ba59d5dde07ac0ec1e1fee1c7da21b (patch)
treebc378b31ecec9cbec636eaca6fe0ea7b7cf112fe /bitbake/lib
parent0fa37f2d05e4d9de2e9103c452aaee0e71705ef3 (diff)
downloadpoky-e13102cd66ba59d5dde07ac0ec1e1fee1c7da21b.tar.gz
bitbake: Update SRCREV fetcher code to cope better with multiple SCM packages
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3145 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py31
-rw-r--r--bitbake/lib/bb/fetch/git.py17
-rw-r--r--bitbake/lib/bb/fetch/svn.py14
3 files changed, 48 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index d9dfc7402d..4da92110ef 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -194,6 +194,7 @@ def get_srcrev(d):
194 return "SRCREVINACTION" 194 return "SRCREVINACTION"
195 195
196 scms = [] 196 scms = []
197
197 # Only call setup_localpath on URIs which suppports_srcrev() 198 # Only call setup_localpath on URIs which suppports_srcrev()
198 urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False) 199 urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False)
199 for u in urldata: 200 for u in urldata:
@@ -365,6 +366,34 @@ class Fetch(object):
365 return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) 366 return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1)
366 getSRCDate = staticmethod(getSRCDate) 367 getSRCDate = staticmethod(getSRCDate)
367 368
369 def srcrev_internal_helper(ud, d):
370 """
371 Return:
372 a) a source revision if specified
373 b) True if auto srcrev is in action
374 c) False otherwise
375 """
376
377 if 'rev' in ud.parm:
378 return ud.parm['rev']
379
380 if 'tag' in ud.parm:
381 return ud.parm['tag']
382
383 rev = None
384 if 'name' in ud.parm:
385 pn = data.getVar("PN", d, 1)
386 rev = data.getVar("SRCREV_pn-" + pn + "_" + ud.parm['name'], d, 1)
387 if not rev:
388 rev = data.getVar("SRCREV", d, 1)
389 if not rev:
390 return False
391 if rev is "SRCREVINACTION":
392 return True
393 return rev
394
395 srcrev_internal_helper = staticmethod(srcrev_internal_helper)
396
368 def try_mirror(d, tarfn): 397 def try_mirror(d, tarfn):
369 """ 398 """
370 Try to use a mirrored version of the sources. We do this 399 Try to use a mirrored version of the sources. We do this
@@ -454,7 +483,7 @@ class Fetch(object):
454 483
455 pd = persist_data.PersistData(d) 484 pd = persist_data.PersistData(d)
456 key = self._revision_key(url, ud, d) 485 key = self._revision_key(url, ud, d)
457 latest_rev = self.latest_revision(url, ud, d) 486 latest_rev = self._build_revision(url, ud, d)
458 last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev") 487 last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
459 count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count") 488 count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
460 489
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index cdd5a1090c..5984818f9e 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -50,13 +50,14 @@ class Git(Fetch):
50 if 'protocol' in ud.parm: 50 if 'protocol' in ud.parm:
51 ud.proto = ud.parm['protocol'] 51 ud.proto = ud.parm['protocol']
52 52
53 tag = data.getVar("SRCREV", d, 1) 53 tag = Fetch.srcrev_internal_helper(ud, d)
54 if 'tag' in ud.parm: 54 if tag is True:
55 ud.tag = ud.parm['tag'] 55 ud.tag = self.latest_revision(url, ud, d)
56 elif tag is "SRCREVINACTION": 56 elif tag:
57 ud.tag = self.latest_revision(url, ud, d) 57 ud.tag = tag
58 else: 58
59 ud.tag = tag 59 if not ud.tag:
60 ud.tag = self.latest_revision(url, ud, d)
60 61
61 if ud.tag == "master": 62 if ud.tag == "master":
62 ud.tag = self.latest_revision(url, ud, d) 63 ud.tag = self.latest_revision(url, ud, d)
@@ -132,3 +133,5 @@ class Git(Fetch):
132 output = runfetchcmd("git ls-remote %s://%s%s" % (ud.proto, ud.host, ud.path), d, True) 133 output = runfetchcmd("git ls-remote %s://%s%s" % (ud.proto, ud.host, ud.path), d, True)
133 return output.split()[0] 134 return output.split()[0]
134 135
136 def _build_revision(self, url, ud, d):
137 return ud.tag
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py
index c3cebc390d..5e5b31b3ad 100644
--- a/bitbake/lib/bb/fetch/svn.py
+++ b/bitbake/lib/bb/fetch/svn.py
@@ -70,10 +70,11 @@ class Svn(Fetch):
70 if "DATE" in pv: 70 if "DATE" in pv:
71 ud.revision = "" 71 ud.revision = ""
72 else: 72 else:
73 rev = data.getVar("SRCREV", d, 1) 73 rev = Fetch.srcrev_internal_helper(ud, d)
74 if rev is "SRCREVINACTION": 74 if rev is True:
75 rev = self.latest_revision(url, ud, d) 75 ud.revision = self.latest_revision(url, ud, d)
76 if rev: 76 ud.date = ""
77 elif rev:
77 ud.revision = rev 78 ud.revision = rev
78 ud.date = "" 79 ud.date = ""
79 else: 80 else:
@@ -195,8 +196,9 @@ class Svn(Fetch):
195 def _sortable_revision(self, url, ud, d): 196 def _sortable_revision(self, url, ud, d):
196 """ 197 """
197 Return a sortable revision number which in our case is the revision number 198 Return a sortable revision number which in our case is the revision number
198 (use the cached version to avoid network access)
199 """ 199 """
200 200
201 return self.latest_revision(url, ud, d) 201 return self._build_revision(url, ud, d)
202 202
203 def _build_revision(self, url, ud, d):
204 return ud.revision