bitbake/lib/bb/fetch:
authorHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 5 Jan 2006 20:14:21 +0000 (20:14 +0000)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Thu, 5 Jan 2006 20:14:21 +0000 (20:14 +0000)
    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
lib/bb/fetch/cvs.py
lib/bb/fetch/svn.py

index d68a1f1..da5b10c 100644 (file)
@@ -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
index 7935744..461a2f5 100644 (file)
@@ -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 = ""
 
index 6c1f95d..ac5eebf 100644 (file)
@@ -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"]