Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: SRCPV migration
Date: Tue, 17 Nov 2009 09:55:18 +0100	[thread overview]
Message-ID: <20091117085518.GF23383@jama> (raw)
In-Reply-To: <1258379748.16625.8.camel@dax.rpnet.com>

[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]

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@gmail.com
Jansa Martin                 sip:jamasip@voip.wengo.fr 
JaMa                         

[-- Attachment #2: 0001-Optional-LOCALCOUNT-for-recipe.patch --]
[-- Type: text/plain, Size: 2680 bytes --]

From dcb8732640c031ab86150deb4933f1a87501c78b Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@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


[-- Attachment #3: 0002-BB_LOCALCOUNT_OVERRIDE-to-enable-setting-LOCALCOUNT-.patch --]
[-- Type: text/plain, Size: 1631 bytes --]

From 1b010656ae8a77a6a5ce12d8ef7ec2a8ef628704 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@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


  reply	other threads:[~2009-11-17  8:56 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-15 16:36 SRCPV migration Martin Jansa
2009-11-15 21:22 ` Martin Jansa
2009-11-16  8:38 ` Koen Kooi
2009-11-16  9:39   ` Richard Purdie
2009-11-16 10:37     ` Koen Kooi
2009-11-16 10:49       ` Richard Purdie
2009-11-16 10:59         ` Koen Kooi
2009-11-16 11:39           ` Richard Purdie
2009-11-16 12:10             ` Koen Kooi
2009-11-16 12:37               ` Richard Purdie
2009-11-16 13:15                 ` Koen Kooi
2009-11-16 13:43                 ` Martin Jansa
2009-11-16 13:55                   ` Richard Purdie
2009-11-17  8:55                     ` Martin Jansa [this message]
2009-11-17  9:08                       ` Phil Blundell
2009-11-17 10:01                       ` Richard Purdie
2009-11-17 10:57                         ` Martin Jansa
2009-11-20 10:20                         ` Martin Jansa
2009-11-17 10:18                       ` mok
2009-11-17 15:12                         ` Martin Jansa
2009-11-17 16:23                           ` Martin Jansa
2009-11-17 16:53                             ` Martin Jansa
2009-11-17 15:49                         ` Henning Heinold
2009-11-17  9:42                 ` Martin Jansa
2009-11-19 16:02                 ` Koen Kooi
2009-11-19 16:11                   ` Martin Jansa
2009-11-19 16:34                   ` Martin Jansa
2009-11-19 17:34                     ` Koen Kooi
2009-11-16 11:51           ` Martin Jansa
2009-11-16 12:19             ` Koen Kooi
2009-11-16 12:39               ` Martin Jansa
2009-11-16 10:42     ` Holger Hans Peter Freyther
2009-11-22 19:05     ` SRCPV migration - How SRCPV works! Martin Jansa
2009-11-23  8:07       ` Koen Kooi
2009-11-23  8:52         ` Martin Jansa
2009-11-23 11:12           ` Koen Kooi
2009-11-23 11:42             ` Martin Jansa
2009-11-23 12:00               ` Richard Purdie
2009-11-23 12:15         ` Richard Purdie
2009-11-23 12:29           ` Philip Balister
2009-11-23 13:24             ` Koen Kooi
2009-11-23 13:31           ` Koen Kooi
2009-11-23 13:52             ` Otavio Salvador
2009-11-23 14:58               ` Koen Kooi
2009-11-23 15:09                 ` Martin Jansa
2009-11-23 14:29             ` Richard Purdie
2009-11-23 15:00               ` Koen Kooi
2009-11-23 15:12                 ` Martin Jansa
2009-11-23 15:52                   ` Koen Kooi
2009-11-23 16:07                     ` Martin Jansa
2009-11-23 15:05               ` Philip Balister
2009-11-23 15:47       ` Chris Conroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091117085518.GF23383@jama \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox