]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/library/librarian.ml
Use seed to avoid further name clashes.
[helm.git] / helm / software / components / library / librarian.ml
index 376c8064974c73927258ebd913d55a8b16ca001c..919edb36c4f9104eb88ec5be974016b12637533c 100644 (file)
@@ -40,7 +40,10 @@ let remove_trailing_slash s =
 let load_root_file rootpath =
   let data = HExtlib.input_file rootpath in
   let lines = Str.split (Str.regexp "\n") data in
-  let clean s = Pcre.replace ~pat:"^ *" (Pcre.replace ~pat:" *$" s) in
+  let clean s = 
+    Pcre.replace ~pat:"[ \t]+" ~templ:" "
+      (Pcre.replace ~pat:"^ *" (Pcre.replace ~pat:" *$" s))
+  in
   List.map 
     (fun l -> 
       match Str.split (Str.regexp "=") l with
@@ -300,8 +303,12 @@ module Make = functor (F:Format) -> struct
       let local, remote =
         List.partition (fun (_,_,froot,_) -> froot = Some root) todo
       in
-      let local = List.filter (is_not_ro opts) local in
-       remote @ local
+      let local, skipped = List.partition (is_not_ro opts) local in
+      List.iter 
+       (fun x -> 
+        HLog.warn("Read only baseuri for: "^F.string_of_source_object(fst4 x)))
+       skipped;
+      remote @ local
     in
     if todo <> [] then
       let compiled, failed = 
@@ -348,7 +355,8 @@ module Make = functor (F:Format) -> struct
       if targets = [] then 
         make_aux root opts [] [] deps
       else
-        make_aux root opts [] [] (purge_unwanted_roots targets deps)
+        make_aux root opts [] [] 
+          (purge_unwanted_roots targets deps)
     in
     HLog.debug ("Leaving directory '"^root^"'");
     Sys.chdir old_root;
@@ -357,12 +365,19 @@ module Make = functor (F:Format) -> struct
 
 end
   
-let write_deps_file root deps =
-  let oc = open_out (root ^ "/depends") in
-  List.iter 
-    (fun (t,d) -> output_string oc (t^" "^String.concat " " d^"\n")) 
-    deps;
-  close_out oc;
-  HLog.message ("Generated: " ^ root ^ "/depends")
-;;
+let write_deps_file where deps = match where with 
+   | Some root ->
+      let oc = open_out (root ^ "/depends") in
+      let map (t, d) = output_string oc (t^" "^String.concat " " d^"\n") in
+      List.iter map deps; close_out oc;
+      HLog.message ("Generated: " ^ root ^ "/depends")
+   | None -> 
+      print_endline (String.concat " " (List.flatten (List.map snd deps)))
+      
+(* FG ***********************************************************************)
+
+(* scheme uri part as defined in URI Generic Syntax (RFC 3986) *)
+let uri_scheme_rex = Pcre.regexp "^[[:alpha:]][[:alnum:]\-+.]*:"
+
+let is_uri str =
+   Pcre.pmatch ~rex:uri_scheme_rex str