Fix URL and version parsing in the SVN fetcher

parent 68c1b82f
...@@ -43,9 +43,9 @@ class Svn(Fetcher): ...@@ -43,9 +43,9 @@ class Svn(Fetcher):
os.mkdir(fetchto) os.mkdir(fetchto)
basename = path_utils.svn_basename(module.url) basename = path_utils.svn_basename(module.url)
mod_path = os.path.join(fetchto, basename) 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: if module.revision:
cmd = cmd.format(fetchto, module.url + '@' + module.revision) cmd = cmd.format(fetchto, module.url + '@' + module.revision)
else: else:
cmd = cmd.format(fetchto, module.url) cmd = cmd.format(fetchto, module.url)
success = True success = True
...@@ -54,7 +54,7 @@ class Svn(Fetcher): ...@@ -54,7 +54,7 @@ class Svn(Fetcher):
if os.system(cmd) != 0: if os.system(cmd) != 0:
success = False success = False
module.isfetched = True module.isfetched = True
module.path = os.path.join(fetchto, module.basename()) module.path = mod_path
return success return success
@staticmethod @staticmethod
......
...@@ -50,8 +50,12 @@ class ModuleConfig(object): ...@@ -50,8 +50,12 @@ class ModuleConfig(object):
self.parent = parent self.parent = parent
if self.source != fetch.LOCAL: if self.source != fetch.LOCAL:
self.url, self.branch, self.revision = \ if self.source == fetch.SVN:
path_mod.url_parse(url) self.url, self.revision = \
path_mod.svn_parse(url)
else:
self.url, self.branch, self.revision = \
path_mod.url_parse(url)
basename = self.basename() basename = self.basename()
path = path_mod.relpath(os.path.abspath( path = path_mod.relpath(os.path.abspath(
os.path.join(fetchto, basename))) os.path.join(fetchto, basename)))
......
...@@ -29,7 +29,7 @@ import os ...@@ -29,7 +29,7 @@ import os
def url_parse(url): 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 number and branch
""" """
url_clean, branch, rev = None, None, None url_clean, branch, rev = None, None, None
...@@ -43,6 +43,20 @@ def url_parse(url): ...@@ -43,6 +43,20 @@ def url_parse(url):
return (url_clean, branch, rev) 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): def url_basename(url):
""" """
Get basename from an 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