[rtems-source-builder commit] sb: Fix the downloader file:// URL to copy the file to the local path.

Chris Johns chrisj at rtems.org
Tue Jun 16 10:58:45 UTC 2015


Module:    rtems-source-builder
Branch:    master
Commit:    5b5d6bff74fed9da7626805620670cfd22970c2f
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=5b5d6bff74fed9da7626805620670cfd22970c2f

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue Jun 16 20:57:06 2015 +1000

sb: Fix the downloader file:// URL to copy the file to the local path.

---

 source-builder/sb/download.py | 12 +++++++-----
 source-builder/sb/path.py     | 12 ++++++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 5622d4a..624151b 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -262,9 +262,9 @@ def _file_parser(source, pathkey, config, opts):
     #
     _local_path(source, pathkey, config)
     #
-    # Symlink.
+    # Get the paths sorted.
     #
-    source['symlink'] = source['local']
+    source['file'] = source['url'][6:]
 
 parsers = { 'http': _http_parser,
             'ftp':  _http_parser,
@@ -510,9 +510,11 @@ def _cvs_downloader(url, local, config, opts):
     return True
 
 def _file_downloader(url, local, config, opts):
-    if path.exists(local):
-        return True
-    return path.isdir(url)
+    try:
+        path.copy(url[6:], local)
+    except:
+        return False
+    return True
 
 downloaders = { 'http': _http_downloader,
                 'ftp':  _http_downloader,
diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py
index 5fa8aef..824b8f5 100644
--- a/source-builder/sb/path.py
+++ b/source-builder/sb/path.py
@@ -167,6 +167,18 @@ def expand(name, paths):
         l += [join(p, name)]
     return l
 
+def copy(src, dst):
+    hsrc = host(src)
+    hdst = host(dst)
+    try:
+        shutil.copy(hsrc, hdst)
+    except OSError, why:
+        if windows:
+            if WindowsError is not None and isinstance(why, WindowsError):
+                pass
+        else:
+            raise error.general('copying tree: %s -> %s: %s' % (hsrc, hdst, str(why)))
+
 def copy_tree(src, dst):
     trace = False
 




More information about the vc mailing list