[oe] Allow mercurial fetcher to follow tip

Peter Chubb peter.chubb at nicta.com.au
Fri Sep 4 03:31:40 UTC 2009


There are occasions when developing when I want a package always to
grab the latest copy of a package.  Witht eh CVS fetcher you can do
this by setting the `date' tag to `now'.  This patch adds similar
functionality to the mercurial fetcher: if the revision to fetch is
`tip' then always grab from the server, and don't use the cached
tarball.

Oh, and I fixed a typo in the Class comment.

Signed-off-by: Peter Chubb <peter.chubb at nicta.com.au>

--- bitbake/lib/bb/fetch/hg.py~	2009-08-18 11:12:41.000000000 +1000
+++ bitbake/lib/bb/fetch/hg.py	2009-09-04 13:19:37.000000000 +1000
@@ -34,13 +34,21 @@
 from bb.fetch import runfetchcmd
 
 class Hg(Fetch):
-    """Class to fetch a from mercurial repositories"""
+    """Class to fetch from mercurial repositories"""
     def supports(self, url, ud, d):
         """
         Check to see if a given url can be fetched with mercurial.
         """
         return ud.type in ['hg']
 
+    def forcefetch(self, url, ud, d):
+        if 'rev' in ud.parm:
+            revTag = ud.parm['rev']
+        else:
+            revTag = "tip"
+        return revTag == "tip"
+
+
     def localpath(self, url, ud, d):
         if not "module" in ud.parm:
             raise MissingParameterError("hg method needs a 'module' parameter")
@@ -108,7 +116,7 @@
         """Fetch url"""
 
         # try to use the tarball stash
-        if Fetch.try_mirror(d, ud.localfile):
+        if not self.forcefetch(loc, ud, d) and Fetch.try_mirror(d, ud.localfile):
             bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists or was mirrored, skipping hg checkout." % ud.localpath)
             return
 

--
Dr Peter Chubb        www.nicta.com.au      peter DOT chubb AT nicta.com.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
From Imagination to Impact                       Imagining the (ICT) Future




More information about the Openembedded-devel mailing list