From 7a8fa99f5a290e53fc04d01785367c83b9f13b72 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Fri, 4 Aug 2017 12:14:47 +0100 Subject: [PATCH] Remove Create_file action Makes no sense now that we use digests rather than timestamps --- src/action.ml | 14 -------------- src/action_intf.ml | 1 - src/build.ml | 2 +- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/action.ml b/src/action.ml index 40d2829e..70a5e21d 100644 --- a/src/action.ml +++ b/src/action.ml @@ -44,7 +44,6 @@ struct ; cstr_rest "progn" nil t (fun l -> Progn l) ; cstr "echo" (string @> nil) (fun x -> Echo 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)) (* (* 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) | Echo x -> List [Atom "echo"; string x] | Cat x -> List [Atom "cat"; path x] - | Create_file x -> List [Atom "create-file"; path x] | Copy (x, y) -> List [Atom "copy"; path x; path 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)) | Echo x -> Echo (f_string 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) | Symlink (x, 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)) | Echo x -> Echo (E.string ~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 (E.path ~dir ~f x, E.path ~dir ~f 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)) | Echo x -> Echo (E.string ~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 (E.path ~dir ~f x, E.path ~dir ~f y) | Symlink (x, y) -> @@ -458,7 +453,6 @@ let fold_one_step t ~init:acc ~f = | Run _ | Echo _ | Cat _ - | Create_file _ | Copy _ | Symlink _ | Copy_and_add_line_directive _ @@ -545,11 +539,6 @@ let rec exec t ~ectx ~dir ~env_extra ~stdout_to ~stderr_to = in Io.copy_channels ic oc); 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) -> Io.copy_file ~src:(Path.to_string src) ~dst:(Path.to_string dst); return () @@ -692,7 +681,6 @@ module Infer = struct | Run (prog, _) -> acc +< prog | Redirect (_, fn, t) -> infer (acc +@ fn) t | Cat fn -> acc +< fn - | Create_file fn -> acc +@ fn | Update_file (fn, _) -> acc +@ fn | Rename (src, dst) -> acc +< src +@ dst | Copy (src, dst) @@ -734,7 +722,6 @@ module Infer = struct | Run (_, _) -> acc | Redirect (_, fn, t) -> partial (acc +@? fn) t | Cat fn -> acc + acc +@? fn | Update_file (fn, _) -> acc +@? fn | Rename (src, dst) -> acc + acc | Redirect (_, fn, t) -> partial_with_all_targets (acc +@? fn) t | Cat fn -> acc + acc +@? fn | Update_file (fn, _) -> acc +@? fn | Rename (src, dst) -> acc + Action.Remove_tree dir)