[Pkg-libvirt-commits] [libguestfs] 196/233: builder: do a copy when downloading local files

Hilko Bengen bengen at moszumanska.debian.org
Wed Feb 19 21:12:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 76e3e15d031df77db71b11ac1c40199eff80fa4d
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Tue Feb 11 12:52:10 2014 +0100

    builder: do a copy when downloading local files
    
    Instead of spawning curl even to "download" file:// URIs, just copy
    them.
---
 builder/downloader.ml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/builder/downloader.ml b/builder/downloader.ml
index 95b5817..e386c06 100644
--- a/builder/downloader.ml
+++ b/builder/downloader.ml
@@ -84,6 +84,17 @@ and download_to ~prog t ?(progress_bar = false) uri filename =
   unlink_on_exit filename_new;
 
   (match parseduri.URI.protocol with
+  | "file" ->
+    let path = parseduri.URI.path in
+    let cmd = sprintf "cp%s %s %s"
+      (if t.debug then " -v" else "")
+      (quote path) (quote filename_new) in
+    let r = Sys.command cmd in
+    if r <> 0 then (
+      eprintf (f_"%s: cp (download) command failed copying '%s'\n")
+        prog path;
+      exit 1
+    )
   | _ -> (* Any other protocol. *)
     (* Get the status code first to ensure the file exists. *)
     let cmd = sprintf "%s%s -g -o /dev/null -I -w '%%{http_code}' %s"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list