Remove Create_file action
Makes no sense now that we use digests rather than timestamps
This commit is contained in:
parent
508c90201f
commit
7a8fa99f5a
|
@ -44,7 +44,6 @@ struct
|
||||||
; cstr_rest "progn" nil t (fun l -> Progn l)
|
; cstr_rest "progn" nil t (fun l -> Progn l)
|
||||||
; cstr "echo" (string @> nil) (fun x -> Echo x)
|
; cstr "echo" (string @> nil) (fun x -> Echo x)
|
||||||
; cstr "cat" (path @> nil) (fun x -> Cat x)
|
; cstr "cat" (path @> nil) (fun x -> Cat x)
|
||||||
; cstr "create-file" (path @> nil) (fun x -> Create_file x)
|
|
||||||
; cstr "copy" (path @> path @> nil) (fun src dst -> Copy (src, dst))
|
; cstr "copy" (path @> path @> nil) (fun src dst -> Copy (src, dst))
|
||||||
(*
|
(*
|
||||||
(* We don't expose symlink to the user yet since this might complicate things *)
|
(* We don't expose symlink to the user yet since this might complicate things *)
|
||||||
|
@ -78,7 +77,6 @@ struct
|
||||||
| Progn l -> List (Atom "progn" :: List.map l ~f:sexp_of_t)
|
| Progn l -> List (Atom "progn" :: List.map l ~f:sexp_of_t)
|
||||||
| Echo x -> List [Atom "echo"; string x]
|
| Echo x -> List [Atom "echo"; string x]
|
||||||
| Cat x -> List [Atom "cat"; path x]
|
| Cat x -> List [Atom "cat"; path x]
|
||||||
| Create_file x -> List [Atom "create-file"; path x]
|
|
||||||
| Copy (x, y) ->
|
| Copy (x, y) ->
|
||||||
List [Atom "copy"; path x; path y]
|
List [Atom "copy"; path x; path y]
|
||||||
| Symlink (x, y) ->
|
| Symlink (x, y) ->
|
||||||
|
@ -113,7 +111,6 @@ module Make_mapper
|
||||||
| Progn l -> Progn (List.map l ~f:(fun t -> map t ~f_program ~f_string ~f_path))
|
| Progn l -> Progn (List.map l ~f:(fun t -> map t ~f_program ~f_string ~f_path))
|
||||||
| Echo x -> Echo (f_string x)
|
| Echo x -> Echo (f_string x)
|
||||||
| Cat x -> Cat (f_path x)
|
| Cat x -> Cat (f_path x)
|
||||||
| Create_file x -> Create_file (f_path x)
|
|
||||||
| Copy (x, y) -> Copy (f_path x, f_path y)
|
| Copy (x, y) -> Copy (f_path x, f_path y)
|
||||||
| Symlink (x, y) ->
|
| Symlink (x, y) ->
|
||||||
Symlink (f_path x, f_path y)
|
Symlink (f_path x, f_path y)
|
||||||
|
@ -325,7 +322,6 @@ module Unexpanded = struct
|
||||||
| Progn l -> Progn (List.map l ~f:(fun t -> expand dir t ~f))
|
| Progn l -> Progn (List.map l ~f:(fun t -> expand dir t ~f))
|
||||||
| Echo x -> Echo (E.string ~dir ~f x)
|
| Echo x -> Echo (E.string ~dir ~f x)
|
||||||
| Cat x -> Cat (E.path ~dir ~f x)
|
| Cat x -> Cat (E.path ~dir ~f x)
|
||||||
| Create_file x -> Create_file (E.path ~dir ~f x)
|
|
||||||
| Copy (x, y) ->
|
| Copy (x, y) ->
|
||||||
Copy (E.path ~dir ~f x, E.path ~dir ~f y)
|
Copy (E.path ~dir ~f x, E.path ~dir ~f y)
|
||||||
| Symlink (x, y) ->
|
| Symlink (x, y) ->
|
||||||
|
@ -424,7 +420,6 @@ module Unexpanded = struct
|
||||||
| Progn l -> Progn (List.map l ~f:(fun t -> partial_expand dir t ~f))
|
| Progn l -> Progn (List.map l ~f:(fun t -> partial_expand dir t ~f))
|
||||||
| Echo x -> Echo (E.string ~dir ~f x)
|
| Echo x -> Echo (E.string ~dir ~f x)
|
||||||
| Cat x -> Cat (E.path ~dir ~f x)
|
| Cat x -> Cat (E.path ~dir ~f x)
|
||||||
| Create_file x -> Create_file (E.path ~dir ~f x)
|
|
||||||
| Copy (x, y) ->
|
| Copy (x, y) ->
|
||||||
Copy (E.path ~dir ~f x, E.path ~dir ~f y)
|
Copy (E.path ~dir ~f x, E.path ~dir ~f y)
|
||||||
| Symlink (x, y) ->
|
| Symlink (x, y) ->
|
||||||
|
@ -458,7 +453,6 @@ let fold_one_step t ~init:acc ~f =
|
||||||
| Run _
|
| Run _
|
||||||
| Echo _
|
| Echo _
|
||||||
| Cat _
|
| Cat _
|
||||||
| Create_file _
|
|
||||||
| Copy _
|
| Copy _
|
||||||
| Symlink _
|
| Symlink _
|
||||||
| Copy_and_add_line_directive _
|
| Copy_and_add_line_directive _
|
||||||
|
@ -545,11 +539,6 @@ let rec exec t ~ectx ~dir ~env_extra ~stdout_to ~stderr_to =
|
||||||
in
|
in
|
||||||
Io.copy_channels ic oc);
|
Io.copy_channels ic oc);
|
||||||
return ()
|
return ()
|
||||||
| Create_file fn ->
|
|
||||||
let fn = Path.to_string fn in
|
|
||||||
if Sys.file_exists fn then Sys.force_remove fn;
|
|
||||||
Unix.close (Unix.openfile fn [O_CREAT; O_TRUNC; O_WRONLY] 0o666);
|
|
||||||
return ()
|
|
||||||
| Copy (src, dst) ->
|
| Copy (src, dst) ->
|
||||||
Io.copy_file ~src:(Path.to_string src) ~dst:(Path.to_string dst);
|
Io.copy_file ~src:(Path.to_string src) ~dst:(Path.to_string dst);
|
||||||
return ()
|
return ()
|
||||||
|
@ -692,7 +681,6 @@ module Infer = struct
|
||||||
| Run (prog, _) -> acc +< prog
|
| Run (prog, _) -> acc +< prog
|
||||||
| Redirect (_, fn, t) -> infer (acc +@ fn) t
|
| Redirect (_, fn, t) -> infer (acc +@ fn) t
|
||||||
| Cat fn -> acc +< fn
|
| Cat fn -> acc +< fn
|
||||||
| Create_file fn -> acc +@ fn
|
|
||||||
| Update_file (fn, _) -> acc +@ fn
|
| Update_file (fn, _) -> acc +@ fn
|
||||||
| Rename (src, dst) -> acc +< src +@ dst
|
| Rename (src, dst) -> acc +< src +@ dst
|
||||||
| Copy (src, dst)
|
| Copy (src, dst)
|
||||||
|
@ -734,7 +722,6 @@ module Infer = struct
|
||||||
| Run (_, _) -> acc
|
| Run (_, _) -> acc
|
||||||
| Redirect (_, fn, t) -> partial (acc +@? fn) t
|
| Redirect (_, fn, t) -> partial (acc +@? fn) t
|
||||||
| Cat fn -> acc +<? fn
|
| Cat fn -> acc +<? fn
|
||||||
| Create_file fn -> acc +@? fn
|
|
||||||
| Update_file (fn, _) -> acc +@? fn
|
| Update_file (fn, _) -> acc +@? fn
|
||||||
| Rename (src, dst) -> acc +<? src +@? dst
|
| Rename (src, dst) -> acc +<? src +@? dst
|
||||||
| Copy (src, dst)
|
| Copy (src, dst)
|
||||||
|
@ -762,7 +749,6 @@ module Infer = struct
|
||||||
| Run (_, _) -> acc
|
| Run (_, _) -> acc
|
||||||
| Redirect (_, fn, t) -> partial_with_all_targets (acc +@? fn) t
|
| Redirect (_, fn, t) -> partial_with_all_targets (acc +@? fn) t
|
||||||
| Cat fn -> acc +<? fn
|
| Cat fn -> acc +<? fn
|
||||||
| Create_file fn -> acc +@? fn
|
|
||||||
| Update_file (fn, _) -> acc +@? fn
|
| Update_file (fn, _) -> acc +@? fn
|
||||||
| Rename (src, dst) -> acc +<? src +@? dst
|
| Rename (src, dst) -> acc +<? src +@? dst
|
||||||
| Copy (src, dst)
|
| Copy (src, dst)
|
||||||
|
|
|
@ -18,7 +18,6 @@ module type Ast = sig
|
||||||
| Ignore of Outputs.t * t
|
| Ignore of Outputs.t * t
|
||||||
| Progn of t list
|
| Progn of t list
|
||||||
| Echo of string
|
| Echo of string
|
||||||
| Create_file of path
|
|
||||||
| Cat of path
|
| Cat of path
|
||||||
| Copy of path * path
|
| Copy of path * path
|
||||||
| Symlink of path * path
|
| Symlink of path * path
|
||||||
|
|
|
@ -260,7 +260,7 @@ let symlink ~src ~dst =
|
||||||
action ~targets:[dst] (Symlink (src, dst))
|
action ~targets:[dst] (Symlink (src, dst))
|
||||||
|
|
||||||
let create_file fn =
|
let create_file fn =
|
||||||
action ~targets:[fn] (Create_file fn)
|
action ~targets:[fn] (Redirect (Stdout, fn, Progn []))
|
||||||
|
|
||||||
let remove_tree dir =
|
let remove_tree dir =
|
||||||
arr (fun _ -> Action.Remove_tree dir)
|
arr (fun _ -> Action.Remove_tree dir)
|
||||||
|
|
Loading…
Reference in New Issue