summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2013-10-31 17:36:25 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-01 17:59:30 +0000
commitde7e6efb80e3155e74f65fbb4f1e9058ca71d1f9 (patch)
treee533ec04a60b626b653e40610ea7c259a250d919 /bitbake/lib
parentba84fbe8319b11bdc207e0d43fa303f7bf01416f (diff)
downloadpoky-de7e6efb80e3155e74f65fbb4f1e9058ca71d1f9.tar.gz
bitbake: fetch2/svn.py: use log instead of info to retrieve revision
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. (Bitbake rev: 17d8ef0b813a05c231e3dbe6e8bc82a4a9b1d2f8) Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/svn.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
index 9a779d2448..123aa136eb 100644
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -27,6 +27,7 @@ import os
27import sys 27import sys
28import logging 28import logging
29import bb 29import bb
30import re
30from bb import data 31from bb import data
31from bb.fetch2 import FetchMethod 32from bb.fetch2 import FetchMethod
32from bb.fetch2 import FetchError 33from bb.fetch2 import FetchError
@@ -91,6 +92,8 @@ class Svn(FetchMethod):
91 92
92 if command == "info": 93 if command == "info":
93 svncmd = "%s info %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module) 94 svncmd = "%s info %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
95 elif command == "log1":
96 svncmd = "%s log --limit 1 %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
94 else: 97 else:
95 suffix = "" 98 suffix = ""
96 if ud.revision: 99 if ud.revision:
@@ -167,14 +170,13 @@ class Svn(FetchMethod):
167 """ 170 """
168 Return the latest upstream revision number 171 Return the latest upstream revision number
169 """ 172 """
170 bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "info")) 173 bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "log1"))
171 174
172 output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True) 175 output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "log1"), d, True)
173 176
174 revision = None 177 # skip the first line, as per output of svn log
175 for line in output.splitlines(): 178 # then we expect the revision on the 2nd line
176 if "Last Changed Rev" in line: 179 revision = re.search('^r([0-9]*)', output.splitlines()[1]).group(1)
177 revision = line.split(":")[1].strip()
178 180
179 return revision 181 return revision
180 182