From c4e44beed02739556f01a7a1c26b0657d3e699b6 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 5 Jan 2006 20:14:21 +0000 Subject: bitbake/lib/bb/fetch: Add a getSRCDate static method to the Fetcher Baseclass to extract the SRCDATE with fallbacks to CVSDATE and DATE Switch over users of CVSDATE to this new method. --- lib/bb/fetch/__init__.py | 9 +++++++++ lib/bb/fetch/cvs.py | 4 ++-- lib/bb/fetch/svn.py | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py index d68a1f166..da5b10c4b 100644 --- a/lib/bb/fetch/__init__.py +++ b/lib/bb/fetch/__init__.py @@ -149,6 +149,15 @@ class Fetch(object): """Fetch urls""" raise NoMethodError("Missing implementation for url") + def getSRCDate(d): + """ + Return the SRC Date for the component + + d the bb.data module + """ + return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1 ) + getSRCDate = staticmethod(getSRCDate) + #if __name__ == "__main__": import bk diff --git a/lib/bb/fetch/cvs.py b/lib/bb/fetch/cvs.py index 7935744e7..461a2f50f 100644 --- a/lib/bb/fetch/cvs.py +++ b/lib/bb/fetch/cvs.py @@ -60,7 +60,7 @@ class Cvs(Fetch): date = parm['date'] else: if not tag: - date = data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) + date = Fetch.getSRCDate(d) else: date = "" @@ -105,7 +105,7 @@ class Cvs(Fetch): date = parm['date'] else: if not tag: - date = data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) + date = Fetch.getSRCDate(d) else: date = "" diff --git a/lib/bb/fetch/svn.py b/lib/bb/fetch/svn.py index 6c1f95d9a..ac5eebf5c 100644 --- a/lib/bb/fetch/svn.py +++ b/lib/bb/fetch/svn.py @@ -57,7 +57,7 @@ class Svn(Fetch): else: revision = "" - date = data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) + date = Fetch.getSRCDate(d) return os.path.join(data.getVar("DL_DIR", d, 1),data.expand('%s_%s_%s_%s_%s.tar.gz' % ( module.replace('/', '.'), host, path.replace('/', '.'), revision, date), d)) localpath = staticmethod(localpath) @@ -96,7 +96,7 @@ class Svn(Fetch): else: revision = "" - date = data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) + date = Fetch.getSRCDate(d) if "method" in parm: method = parm["method"] -- cgit 1.2.3-korg