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 master rev: 17d8ef0b813a05c231e3dbe6e8bc82a4a9b1d2f8) (Bitbake rev: d14e532f07f31b99c55bec9d87470eb54251c8db) Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
2238d4a63f
commit
1c8c9f1e53
|
@ -27,6 +27,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import bb
|
import bb
|
||||||
|
import re
|
||||||
from bb import data
|
from bb import data
|
||||||
from bb.fetch2 import FetchMethod
|
from bb.fetch2 import FetchMethod
|
||||||
from bb.fetch2 import FetchError
|
from bb.fetch2 import FetchError
|
||||||
|
@ -91,6 +92,8 @@ class Svn(FetchMethod):
|
||||||
|
|
||||||
if command == "info":
|
if command == "info":
|
||||||
svncmd = "%s info %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
|
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:
|
else:
|
||||||
suffix = ""
|
suffix = ""
|
||||||
if ud.revision:
|
if ud.revision:
|
||||||
|
@ -167,14 +170,13 @@ class Svn(FetchMethod):
|
||||||
"""
|
"""
|
||||||
Return the latest upstream revision number
|
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
|
# skip the first line, as per output of svn log
|
||||||
for line in output.splitlines():
|
# then we expect the revision on the 2nd line
|
||||||
if "Last Changed Rev" in line:
|
revision = re.search('^r([0-9]*)', output.splitlines()[1]).group(1)
|
||||||
revision = line.split(":")[1].strip()
|
|
||||||
|
|
||||||
return revision
|
return revision
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue