Fix URL and version parsing in the SVN fetcher

parent 68c1b82f
......@@ -43,7 +43,7 @@ class Svn(Fetcher):
os.mkdir(fetchto)
basename = path_utils.svn_basename(module.url)
mod_path = os.path.join(fetchto, basename)
cmd = "cd {0} && svn checkout {1} " + module.basename()
cmd = "cd {0} && svn checkout {1} " + basename
if module.revision:
cmd = cmd.format(fetchto, module.url + '@' + module.revision)
else:
......@@ -54,7 +54,7 @@ class Svn(Fetcher):
if os.system(cmd) != 0:
success = False
module.isfetched = True
module.path = os.path.join(fetchto, module.basename())
module.path = mod_path
return success
@staticmethod
......
......@@ -50,6 +50,10 @@ class ModuleConfig(object):
self.parent = parent
if self.source != fetch.LOCAL:
if self.source == fetch.SVN:
self.url, self.revision = \
path_mod.svn_parse(url)
else:
self.url, self.branch, self.revision = \
path_mod.url_parse(url)
basename = self.basename()
......
......@@ -29,7 +29,7 @@ import os
def url_parse(url):
"""
Check if link to a repo seems to be correct. Filter revision
Check if link to a Git repo seems to be correct. Filter revision
number and branch
"""
url_clean, branch, rev = None, None, None
......@@ -43,6 +43,20 @@ def url_parse(url):
return (url_clean, branch, rev)
def svn_parse(url):
"""
Check if link to a SVN repo seems to be correct. Filter revision
number
"""
url_clean, rev = None, None
if "@" in url:
url_clean, rev = url.split("@")
else:
url_clean = url
return (url_clean, rev)
def url_basename(url):
"""
Get basename from an url
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment