diff options
author | Richard Purdie <richard@openedhand.com> | 2007-11-13 23:03:21 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-11-13 23:03:21 +0000 |
commit | e13102cd66ba59d5dde07ac0ec1e1fee1c7da21b (patch) | |
tree | bc378b31ecec9cbec636eaca6fe0ea7b7cf112fe | |
parent | 0fa37f2d05e4d9de2e9103c452aaee0e71705ef3 (diff) | |
download | openembedded-core-e13102cd66ba59d5dde07ac0ec1e1fee1c7da21b.tar.gz openembedded-core-e13102cd66ba59d5dde07ac0ec1e1fee1c7da21b.tar.bz2 openembedded-core-e13102cd66ba59d5dde07ac0ec1e1fee1c7da21b.tar.xz openembedded-core-e13102cd66ba59d5dde07ac0ec1e1fee1c7da21b.zip |
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
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 31 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/git.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/svn.py | 14 |
3 files changed, 48 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index d9dfc7402..4da92110e 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -194,6 +194,7 @@ def get_srcrev(d): return "SRCREVINACTION" scms = [] + # Only call setup_localpath on URIs which suppports_srcrev() urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False) for u in urldata: @@ -365,6 +366,34 @@ class Fetch(object): return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) getSRCDate = staticmethod(getSRCDate) + def srcrev_internal_helper(ud, d): + """ + Return: + a) a source revision if specified + b) True if auto srcrev is in action + c) False otherwise + """ + + if 'rev' in ud.parm: + return ud.parm['rev'] + + if 'tag' in ud.parm: + return ud.parm['tag'] + + rev = None + if 'name' in ud.parm: + pn = data.getVar("PN", d, 1) + rev = data.getVar("SRCREV_pn-" + pn + "_" + ud.parm['name'], d, 1) + if not rev: + rev = data.getVar("SRCREV", d, 1) + if not rev: + return False + if rev is "SRCREVINACTION": + return True + return rev + + srcrev_internal_helper = staticmethod(srcrev_internal_helper) + def try_mirror(d, tarfn): """ Try to use a mirrored version of the sources. We do this @@ -454,7 +483,7 @@ class Fetch(object): pd = persist_data.PersistData(d) key = self._revision_key(url, ud, d) - latest_rev = self.latest_revision(url, ud, d) + latest_rev = self._build_revision(url, ud, d) last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev") count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count") diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py index cdd5a1090..5984818f9 100644 --- a/bitbake/lib/bb/fetch/git.py +++ b/bitbake/lib/bb/fetch/git.py @@ -50,13 +50,14 @@ class Git(Fetch): if 'protocol' in ud.parm: ud.proto = ud.parm['protocol'] - tag = data.getVar("SRCREV", d, 1) - if 'tag' in ud.parm: - ud.tag = ud.parm['tag'] - elif tag is "SRCREVINACTION": - ud.tag = self.latest_revision(url, ud, d) - else: - ud.tag = tag + tag = Fetch.srcrev_internal_helper(ud, d) + if tag is True: + ud.tag = self.latest_revision(url, ud, d) + elif tag: + ud.tag = tag + + if not ud.tag: + ud.tag = self.latest_revision(url, ud, d) if ud.tag == "master": ud.tag = self.latest_revision(url, ud, d) @@ -132,3 +133,5 @@ class Git(Fetch): output = runfetchcmd("git ls-remote %s://%s%s" % (ud.proto, ud.host, ud.path), d, True) return output.split()[0] + def _build_revision(self, url, ud, d): + return ud.tag diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py index c3cebc390..5e5b31b3a 100644 --- a/bitbake/lib/bb/fetch/svn.py +++ b/bitbake/lib/bb/fetch/svn.py @@ -70,10 +70,11 @@ class Svn(Fetch): if "DATE" in pv: ud.revision = "" else: - rev = data.getVar("SRCREV", d, 1) - if rev is "SRCREVINACTION": - rev = self.latest_revision(url, ud, d) - if rev: + rev = Fetch.srcrev_internal_helper(ud, d) + if rev is True: + ud.revision = self.latest_revision(url, ud, d) + ud.date = "" + elif rev: ud.revision = rev ud.date = "" else: @@ -195,8 +196,9 @@ class Svn(Fetch): def _sortable_revision(self, url, ud, d): """ Return a sortable revision number which in our case is the revision number - (use the cached version to avoid network access) """ - return self.latest_revision(url, ud, d) + return self._build_revision(url, ud, d) + def _build_revision(self, url, ud, d): + return ud.revision |