Initial comit - Clone
This commit is contained in:
9
bin/gwgc/dune.in
Normal file
9
bin/gwgc/dune.in
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifdef GENEWEB_GWDB_LEGACY
|
||||
(executable
|
||||
(name gwgc)
|
||||
(public_name geneweb.gwgc)
|
||||
(modules gwgc)
|
||||
(preprocess (action (run %{bin:cppo} %%%CPPO_D%%% %{input-file})))
|
||||
(libraries unix str %%%GWDB_PKG%%% %%%SOSA_PKG%%% geneweb)
|
||||
)
|
||||
#endif
|
||||
27
bin/gwgc/gwgc.ml
Normal file
27
bin/gwgc/gwgc.ml
Normal file
@@ -0,0 +1,27 @@
|
||||
let dry_run = ref false
|
||||
let bname = ref ""
|
||||
|
||||
let speclist =
|
||||
[ ("--dry-run", Arg.Set dry_run, " do not commit changes (only print)") ]
|
||||
|
||||
let anonfun i = bname := i
|
||||
let usage = "Usage: " ^ Sys.argv.(0) ^ " [OPTION] base"
|
||||
|
||||
let () =
|
||||
Arg.parse speclist anonfun usage;
|
||||
let bname =
|
||||
match !bname with
|
||||
| "" ->
|
||||
Arg.usage speclist usage;
|
||||
exit 1
|
||||
| s -> s
|
||||
in
|
||||
let dry_run = !dry_run in
|
||||
Secure.set_base_dir (Filename.dirname bname);
|
||||
Lock.control (Mutil.lock_file bname) true ~onerror:Lock.print_try_again
|
||||
@@ fun () ->
|
||||
let base = Database.opendb bname in
|
||||
let p, f, s = Gwdb_gc.gc ~dry_run base in
|
||||
Printf.printf
|
||||
"%s:\n\tnb of persons: %d\n\tnb of families: %d\n\tnb of strings: %d\n"
|
||||
bname (List.length p) (List.length f) (List.length s)
|
||||
Reference in New Issue
Block a user