All of lore.kernel.org
 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 17:53:44 +0100	[thread overview]
Message-ID: <20091117165344.GM23383@jama> (raw)
In-Reply-To: <20091117162324.GL23383@jama>

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

On Tue, Nov 17, 2009 at 05:23:24PM +0100, Martin Jansa wrote:
> On Tue, Nov 17, 2009 at 04:12:12PM +0100, Martin Jansa wrote:
> > On Tue, Nov 17, 2009 at 11:18:02AM +0100, mok@mnet-online.de wrote:
> > > On Tue, 17 Nov 2009, Martin Jansa wrote:
> > > 
> > > > 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)
> > 
> > Hopefully resolved with this bitbake patch
> 
> Sorry previous patch used localcount even for svn recipes, that was
> wrong.

Hopefully last time? :)

-- 
uin:136542059                jid:Martin.Jansa@gmail.com
Jansa Martin                 sip:jamasip@voip.wengo.fr 
JaMa                         

[-- Attachment #2: 0002-BB_GIT_CLONE_FOR_SRCREV-using-only-_sortable_buildnu.patch --]
[-- Type: text/plain, Size: 4257 bytes --]

From 77bdb1a1175e21af65e8c50f708b930d011a2e01 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Tue, 17 Nov 2009 15:44:43 +0100
Subject: [PATCH 2/2] BB_GIT_CLONE_FOR_SRCREV using only _sortable_buildnumber() for known revision

---
 lib/bb/fetch/__init__.py |   15 ++++++++-------
 lib/bb/fetch/git.py      |   33 +++++++++------------------------
 2 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py
index 9508908..cc095e3 100644
--- a/lib/bb/fetch/__init__.py
+++ b/lib/bb/fetch/__init__.py
@@ -553,15 +553,13 @@ class Fetch(object):
         """
         
         """
-        has_want_sortable = hasattr(self, "_want_sortable_revision")
-        has_sortable = hasattr(self, "_sortable_revision")
+        has_want_sortable_buildnumber = hasattr(self, "_want_sortable_buildnumber")
+        has_sortable_buildnumber = hasattr(self, "_sortable_buildnumber")
+        has_sortable_revision = hasattr(self, "_sortable_revision")
 
-        if not has_want_sortable and has_sortable:
+        if has_sortable_revision:
             return self._sortable_revision(url, ud, d)
-        elif has_want_sortable and self._want_sortable_revision(url, ud, d) and has_sortable:
-            return self._sortable_revision(url, ud, d)
-        
-
+    
         pd = persist_data.PersistData(d)
         key = self.generate_revision_key(url, ud, d)
 
@@ -577,6 +575,9 @@ class Fetch(object):
         if last_rev == latest_rev:
             return str(count + "+" + latest_rev)
 
+        if has_sortable_buildnumber and has_want_sortable_buildnumber and self._want_sortable_buildnumber(url, ud, d):
+            count = self._sortable_buildnumber(url, ud, d, latest_rev)
+
         if count is None:
             count = "0"
         elif uselocalcount:
diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py
index 5cdf656..4dd58b0 100644
--- a/lib/bb/fetch/git.py
+++ b/lib/bb/fetch/git.py
@@ -146,44 +146,29 @@ class Git(Fetch):
     def _build_revision(self, url, ud, d):
         return ud.tag
 
-    def _want_sortable_revision(self, url, ud, d):
+    def _want_sortable_buildnumber(self, url, ud, d):
         return bb.data.getVar("BB_GIT_CLONE_FOR_SRCREV", d, True) or False
 
-    def _sortable_revision(self, url, ud, d):
+    def _sortable_buildnumber(self, url, ud, d, rev):
         """
-        This is only called when _want_sortable_revision called true
+        This is only called when _want_sortable_buildnumber called true
 
-        We will have to get the updated revision.
+        Latest revision is already known, we need only to count revisions in git repo.
         """
         gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
         repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
 
-        key = "GIT_CACHED_REVISION-%s-%s"  % (gitsrcname, ud.tag)
-        if bb.data.getVar(key, d):
-            return bb.data.getVar(key, d)
-
-
-        # Runtime warning on wrongly configured sources
-        if ud.tag == "1":
-            bb.msg.error(1, bb.msg.domain.Fetcher, "SRCREV is '1'. This indicates a configuration error of %s" % url)
-            return "0+1"
-
         cwd = os.getcwd()
 
         # Check if we have the rev already
         if not os.path.exists(repodir):
-            print "no repo"
-            self.go(None, ud, d)
+             bb.msg.error(bb.msg.domain.Fetcher, "GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber" % (url, repodir))
+             return "0"
 
         os.chdir(repodir)
-        if not self._contains_ref(ud.tag, d):
-            self.go(None, ud, d)
 
-        output = runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % ud.tag, d, quiet=True)
+        output = runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % rev, d, quiet=True)
         os.chdir(cwd)
 
-        sortable_revision = "%s+%s" % (output.split()[0], ud.tag)
-        bb.data.setVar(key, sortable_revision, d)
-        return sortable_revision
-        
-
+        sortable_buildnumber= "%s" % (output.split()[0])
+        return sortable_buildnumber
-- 
1.6.5.2


  reply	other threads:[~2009-11-17 16:55 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
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 [this message]
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=20091117165344.GM23383@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.