Commits

Anonymous committed d8033f9 Draft

.

Comments (0)

Files changed (2)

src/post_template.ml

 
 
       let get_sources_cache pd ~dest ~rkind ~dlfunc ~cachedir =
+
 (*
 *)
 ( ignore pd ; ignore dest ; ignore rkind ; ignore dlfunc ; ignore cachedir ; failwith "qwe" )
                   let dl_dest =
                     match rkind with
                     | `Repo -> dest
-                    | `File ->
+                    | `File _base_name ->
                         let temp = Filename.temp_dir_name in
                         let () = cachedbg "remote file, downloading to %S"
                           temp
               | `Remote (rkind, _) ->
                   begin
                   match rkind with
-                  | `File ->
+                  | `File _base_name ->
                       let () = cachedbg "package %S was remote file, \
                                          cleaning local \
                                          downloaded file %S"
                         pkg_name local_path
                       in
                       Sys.remove local_path
-                  | `Dir | `Repo ->
+                  | `Repo ->
                       if extract_res = local_path
                       then
                         let () = cachedbg "package %S was remote repo, but \
             | `Remote (rkind, dlfunc) ->
                 let cache_dir_opt =
                   (match rkind with
-                   | `File -> !!cache_dir_files
+                   | `File _base_name -> !!cache_dir_files
                    | `Repo -> !!cache_dir_repos
                   )
                 in

src/pre_template.ml

 type action = (unit -> unit)
 type downloadfunc = (dl_dest:string (* directory *) -> string (* exact path *))
 type source =
-  { s_base_name : string
-  ; s_download :
+  { s_download :
       [ `No
       | `Local of string
-      | `Remote of [`File | `Repo] * downloadfunc
+      | `Remote of [`File of string (* base name *) | `Repo]
+                 * downloadfunc
       ]
   ; s_extract : ( path:string (* exact path *) ->
                   dest:string (* somewhere in work dir *) ->
 
 
     let none =
-      { s_base_name = "NONE"
-      ; s_download = `No
+      { s_download = `No
       ; s_extract =
           (fun ~path ~dest ->
              ( ignore path
            else failwith "can't clone mercurial repository with command %s"
                   (Reb_sys.dump_argv argv)
       in
-      { s_base_name = last_component_of_uri repo
-      ; s_download =
+      { s_download =
          (if is_local repo
           then
             `Local repo
       ~funcname
 
     let local_tar_gz infn =
-      { s_base_name = last_component_of_uri infn
-      ; s_download = `Local infn
+      { s_download = `Local infn
       ; s_extract =
           do_local_tar_gz ~funcname:"Source.local_tar_gz"
       }
       ~funcname
 
     let local_tar_bz2 infn =
-      { s_base_name = last_component_of_uri infn
-      ; s_download = `Local infn
+      { s_download = `Local infn
       ; s_extract =
           do_local_tar_bz2 ~funcname:"Source.local_tar_bz2"
       }
 
     let local_dir dir =
-      { s_base_name = last_component_of_uri dir
-      ; s_download = `Local dir
+      { s_download = `Local dir
       ; s_extract =
           (fun ~path ~dest ->
              match Reb_sys.run ~show:true [| "cp"; "-R"; path; dest |] with
 
     let remote_archive ?hash ~unpack ~uri ~funcname =
       let base_name = last_component_of_uri uri in
-      { s_base_name = base_name
-      ; s_download = `Remote (`File,
+      { s_download = `Remote (`File base_name,
           (fun ~dl_dest ->
              let outfn = dl_dest </> base_name in
              ( download ?hash ~uri ~funcname ~outfn