All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] fetch2/svn.py: use log instead of info to retrieve revision
@ 2013-11-01  0:36 Nicolas Dechesne
  2013-11-04 18:48 ` Nicolas Dechesne
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Dechesne @ 2013-11-01  0:36 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Nicolas Dechesne

We have faced a corner case situation where the 'last changed
revision' returned from svn info is wrong. It happens when the last
revision is a directory move. e.g. if we assume that the svn
repository at revA has root/x/y/z/foo/bar and it is moved to
root/a/b/c/foo/bar in revB, then svn info 'last change revision' will
return revA. As such when using AUTOREV, we are going to attempt to
retrieve root/a/b/c/foo/bar (as per SRC_URI) but at revA when it did
not exist.

So this patch changes how we retrieve the latest revision and uses
'svn log --limit 1' which gives correct result in all tested cases.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
---
 lib/bb/fetch2/svn.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/bb/fetch2/svn.py b/lib/bb/fetch2/svn.py
index 9a779d2..123aa13 100644
--- a/lib/bb/fetch2/svn.py
+++ b/lib/bb/fetch2/svn.py
@@ -27,6 +27,7 @@ import os
 import sys
 import logging
 import bb
+import re
 from   bb import data
 from   bb.fetch2 import FetchMethod
 from   bb.fetch2 import FetchError
@@ -91,6 +92,8 @@ class Svn(FetchMethod):
 
         if command == "info":
             svncmd = "%s info %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
+        elif command == "log1":
+            svncmd = "%s log --limit 1 %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
         else:
             suffix = ""
             if ud.revision:
@@ -167,14 +170,13 @@ class Svn(FetchMethod):
         """
         Return the latest upstream revision number
         """
-        bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "info"))
+        bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "log1"))
 
-        output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True)
+        output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "log1"), d, True)
 
-        revision = None
-        for line in output.splitlines():
-            if "Last Changed Rev" in line:
-                revision = line.split(":")[1].strip()
+        # skip the first line, as per output of svn log
+        # then we expect the revision on the 2nd line
+        revision = re.search('^r([0-9]*)', output.splitlines()[1]).group(1)
 
         return revision
 
-- 
1.8.4.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] fetch2/svn.py: use log instead of info to retrieve revision
  2013-11-01  0:36 [PATCH RFC] fetch2/svn.py: use log instead of info to retrieve revision Nicolas Dechesne
@ 2013-11-04 18:48 ` Nicolas Dechesne
  2013-11-05 13:17   ` Robert Yang
  2013-11-07 16:26   ` Paul Eggleton
  0 siblings, 2 replies; 4+ messages in thread
From: Nicolas Dechesne @ 2013-11-04 18:48 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Nicolas Dechesne

On Thu, Oct 31, 2013 at 5:36 PM, Nicolas Dechesne
<nicolas.dechesne@linaro.org> wrote:
> We have faced a corner case situation where the 'last changed
> revision' returned from svn info is wrong. It happens when the last
> revision is a directory move. e.g. if we assume that the svn
> repository at revA has root/x/y/z/foo/bar and it is moved to
> root/a/b/c/foo/bar in revB, then svn info 'last change revision' will
> return revA. As such when using AUTOREV, we are going to attempt to
> retrieve root/a/b/c/foo/bar (as per SRC_URI) but at revA when it did
> not exist.
>
> So this patch changes how we retrieve the latest revision and uses
> 'svn log --limit 1' which gives correct result in all tested cases.

Richard, thanks for merging in master. any chance this can go to dora
and dylan too, as this is a bug fix? the same patch applies in both
branches, and we are currently using dylan and dora for our projects.

thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] fetch2/svn.py: use log instead of info to retrieve revision
  2013-11-04 18:48 ` Nicolas Dechesne
@ 2013-11-05 13:17   ` Robert Yang
  2013-11-07 16:26   ` Paul Eggleton
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Yang @ 2013-11-05 13:17 UTC (permalink / raw)
  To: Nicolas Dechesne, bitbake-devel



On 11/05/2013 02:48 AM, Nicolas Dechesne wrote:
> On Thu, Oct 31, 2013 at 5:36 PM, Nicolas Dechesne
> <nicolas.dechesne@linaro.org> wrote:
>> We have faced a corner case situation where the 'last changed
>> revision' returned from svn info is wrong. It happens when the last
>> revision is a directory move. e.g. if we assume that the svn
>> repository at revA has root/x/y/z/foo/bar and it is moved to
>> root/a/b/c/foo/bar in revB, then svn info 'last change revision' will
>> return revA. As such when using AUTOREV, we are going to attempt to
>> retrieve root/a/b/c/foo/bar (as per SRC_URI) but at revA when it did
>> not exist.
>>
>> So this patch changes how we retrieve the latest revision and uses
>> 'svn log --limit 1' which gives correct result in all tested cases.
>
> Richard, thanks for merging in master. any chance this can go to dora

Hi Nicolas,

I will add it to the queue of dora, thanks.

// Robert


> and dylan too, as this is a bug fix? the same patch applies in both
> branches, and we are currently using dylan and dora for our projects.
>
> thanks
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] fetch2/svn.py: use log instead of info to retrieve revision
  2013-11-04 18:48 ` Nicolas Dechesne
  2013-11-05 13:17   ` Robert Yang
@ 2013-11-07 16:26   ` Paul Eggleton
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Eggleton @ 2013-11-07 16:26 UTC (permalink / raw)
  To: Nicolas Dechesne; +Cc: bitbake-devel

Hi Nicolas,

On Monday 04 November 2013 10:48:24 Nicolas Dechesne wrote:
> On Thu, Oct 31, 2013 at 5:36 PM, Nicolas Dechesne
> <nicolas.dechesne@linaro.org> wrote:
> > We have faced a corner case situation where the 'last changed
> > revision' returned from svn info is wrong. It happens when the last
> > revision is a directory move. e.g. if we assume that the svn
> > repository at revA has root/x/y/z/foo/bar and it is moved to
> > root/a/b/c/foo/bar in revB, then svn info 'last change revision' will
> > return revA. As such when using AUTOREV, we are going to attempt to
> > retrieve root/a/b/c/foo/bar (as per SRC_URI) but at revA when it did
> > not exist.
> > 
> > So this patch changes how we retrieve the latest revision and uses
> > 'svn log --limit 1' which gives correct result in all tested cases.
> 
> Richard, thanks for merging in master. any chance this can go to dora
> and dylan too, as this is a bug fix? the same patch applies in both
> branches, and we are currently using dylan and dora for our projects.

OK, I've queued it up for dylan as well.

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-07 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01  0:36 [PATCH RFC] fetch2/svn.py: use log instead of info to retrieve revision Nicolas Dechesne
2013-11-04 18:48 ` Nicolas Dechesne
2013-11-05 13:17   ` Robert Yang
2013-11-07 16:26   ` Paul Eggleton

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.