[oe] SRCPV migration

Martin Jansa martin.jansa at gmail.com
Tue Nov 17 08:55:18 UTC 2009


On Mon, Nov 16, 2009 at 01:55:48PM +0000, Richard Purdie wrote:
> On Mon, 2009-11-16 at 14:43 +0100, Martin Jansa wrote:
> > On Mon, Nov 16, 2009 at 12:37:02PM +0000, Richard Purdie wrote:
> > > On Mon, 2009-11-16 at 13:10 +0100, Koen Kooi wrote:
> > > I think we will have to hold off some of the SRCPV migration until
> > > bitbake has some kind of lock down functionality for the local build
> > > numbers. Any volunteers to write a patch?
> > 
> > This could be enough?
> > 
> > Just putting
> > BB_GIT_LOCALCOUNT_FOR_SRCREV = "0"
> > somewhere (local.conf/distro.conf) and _count will always stay on 0
> > (gitr0+abc1234def)
> 
> No, we need to be able to control the version and it shouldn't be git
> specific...
> 
> Cheers,
> 
> Richard

OK better version

with this you can add

LOCALCOUNT_pn-bar ?= "4"
to ie sane-srcrevs.inc

or

LOCALCOUNT ?= "4" to 
recipes/foo/bar_git.bb

(btw seems like LOCALCOUNT_pn-bar has higher preferrence even if I use
"LOCALCOUNT = 4" in recipe, why?)

And it will be ignored for all distros where BB_LOCALCOUNT_OVERRIDE is
not set. 

With BB_LOCALCOUNT_OVERRIDE enabled, you can use LOCALCOUNT instead of
PR bump if you just change SRCREV, for others will be LOCALCOUNT in
SRCPV incremented by default.

If BB_GIT_CLONE_FOR_SRCREV is set than LOCALCOUNT is ALWAYS set to 
"git list-rev | wc -l" which could be considered also as consistent PV
scheme for multiple buildhosts.

BTW: SRCPV seems to be expanded in PV a bit sooner than SRCREV was,
which with combination with BB_GIT_CLONE_FOR_SRCREV means that all git
repositories are checked during recipe parsing (Klaus Kurzmann has a
list of git repositories used in OE recipes which are not accessible)

-- 
uin:136542059                jid:Martin.Jansa at gmail.com
Jansa Martin                 sip:jamasip at voip.wengo.fr 
JaMa                         
-------------- next part --------------
>From dcb8732640c031ab86150deb4933f1a87501c78b Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa at gmail.com>
Date: Tue, 17 Nov 2009 08:24:52 +0100
Subject: [PATCH 1/2] Optional LOCALCOUNT for recipe

* Instead of autoincrement from persistent cache when srcrev is changed.
* Should be used by distributions with multiple builders, where consistent
  PV is needed.
* Can be used instead of PR bump in PVs like this "0.0+${PR}+gitr${SRCPV}"
---
 lib/bb/fetch/__init__.py |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py
index 8c0d7ea..3b527e2 100644
--- a/lib/bb/fetch/__init__.py
+++ b/lib/bb/fetch/__init__.py
@@ -448,6 +448,27 @@ class Fetch(object):
 
     srcrev_internal_helper = staticmethod(srcrev_internal_helper)
 
+    def localcount_internal_helper(ud, d):
+        """
+        Return:
+            a) a locked localcount if specified
+	    b) None otherwise
+        """
+
+        localcount= None
+        if 'name' in ud.parm:
+            pn = data.getVar("PN", d, 1)
+            localcount = data.getVar("LOCALCOUNT_pn-" + pn + "_" + ud.parm['name'], d, 1)
+        if not localcount:
+            localcount = data.getVar("LOCALCOUNT", d, 1)
+        if localcount == "INVALID":
+            raise InvalidSRCREV("Please set LOCALCOUNT to a valid value")
+        if not localcount:
+            return None
+        return localcount
+
+    localcount_internal_helper = staticmethod(localcount_internal_helper)
+
     def try_mirror(d, tarfn):
         """
         Try to use a mirrored version of the sources. We do this
@@ -550,15 +571,20 @@ class Fetch(object):
 
         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")
+        localcount = Fetch.localcount_internal_helper(ud, d)
+        if localcount is None:
+            count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
+        else:
+            count = localcount
 
         if last_rev == latest_rev:
             return str(count + "+" + latest_rev)
 
-        if count is None:
-            count = "0"
-        else:
-            count = str(int(count) + 1)
+        if localcount is None:
+            if count is None:
+                count = "0"
+            else:
+                count = str(int(count) + 1)
 
         pd.setValue("BB_URI_LOCALCOUNT", key + "_rev", latest_rev)
         pd.setValue("BB_URI_LOCALCOUNT", key + "_count", count)
-- 
1.6.5.2

-------------- next part --------------
>From 1b010656ae8a77a6a5ce12d8ef7ec2a8ef628704 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa at gmail.com>
Date: Tue, 17 Nov 2009 09:11:57 +0100
Subject: [PATCH 2/2] BB_LOCALCOUNT_OVERRIDE to enable setting LOCALCOUNT for recipe

* This way LOCALCOUNTs can be specified directly in recipes instead of
  separated distro config (as not all want to use them). And will be
  used only when BB_LOCALCOUNT_OVERRIDE set in distro config.
---
 lib/bb/fetch/__init__.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py
index 3b527e2..9e50de6 100644
--- a/lib/bb/fetch/__init__.py
+++ b/lib/bb/fetch/__init__.py
@@ -183,6 +183,9 @@ def checkstatus(d):
         if not ret:
             bb.msg.fatal(bb.msg.domain.Fetcher, "URL %s doesn't work" % u)
 
+def want_localcount_override(d):
+    return bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
+
 def localpaths(d):
     """
     Return a list of the local filenames, assuming successful fetch
@@ -571,7 +574,10 @@ class Fetch(object):
 
         latest_rev = self._build_revision(url, ud, d)
         last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
-        localcount = Fetch.localcount_internal_helper(ud, d)
+        localcount = None
+        if want_localcount_override(d):
+            bb.msg.error(1, 'LOCALCOUNT override enabled')
+            localcount = Fetch.localcount_internal_helper(ud, d)
         if localcount is None:
             count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
         else:
-- 
1.6.5.2



More information about the Openembedded-devel mailing list