Skip to content

Commit

Permalink
Dropped support for gwdb2, moved gwdb1 implementation in a library, f…
Browse files Browse the repository at this point in the history
…ixed compilation.
  • Loading branch information
Julien Sagot authored and sagotch committed Jul 8, 2019
1 parent 4ae9e89 commit 9c89d4f
Show file tree
Hide file tree
Showing 32 changed files with 449 additions and 6,605 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -19,8 +19,7 @@ geneweb.install

# Generated from .camlp5 sources
bin/distrib/setup/setup.ml
bin/distrib/ged2gwb/ged2gwb.ml
bin/distrib/ged2gwb/ged2gwb2.ml
bin/distrib/ged2gwb/ged2gwb1.ml
lib/api_saisie_piqi.ml
lib/api_saisie_piqi_ext.ml
lib/gwlib.ml
Expand Down
38 changes: 16 additions & 22 deletions Makefile
Expand Up @@ -15,25 +15,22 @@ DISTRIB_DIR=distribution
BUILD_DIR=_build/default

EXE = \
bin/distrib/connex.exe \
bin/distrib/ged2gwb.exe \
bin/distrib/ged2gwb2.exe \
bin/distrib/gwb2ged.exe \
bin/distrib/gwc1.exe \
bin/distrib/gwc2.exe \
bin/distrib/gwd.exe \
bin/distrib/gwdiff.exe \
bin/distrib/gwtp.exe \
bin/distrib/gwu.exe \
bin/distrib/mk_consang.exe \
bin/distrib/setup.exe \
bin/distrib/update_nldb.exe \
bin/distrib/connex \
bin/distrib/consang \
bin/distrib/ged2gwb \
bin/distrib/gwb2ged \
bin/distrib/gwc \
bin/distrib/gwd \
bin/distrib/gwdiff \
bin/distrib/gwtp \
bin/distrib/gwu \
bin/distrib/setup \
bin/distrib/update_nldb \

###### [BEGIN] Generated files section

CAMLP5_PA_EXTEND_FILES = \
bin/distrib/ged2gwb/ged2gwb \
bin/distrib/ged2gwb/ged2gwb2 \
bin/distrib/ged2gwb/ged2gwb1 \
lib/templ \
lib/update \
bin/distrib/setup/setup
Expand Down Expand Up @@ -66,7 +63,7 @@ lib/gwlib.ml:
echo " try Sys.getenv \"GWPREFIX\"" >> $@
echo " with Not_found -> \"$(PREFIX)\"" | sed -e 's|\\|/|g' >> $@

CPPO_D=$(API_D)
CPPO_D=$(API_D) $(GWDB_D)

%/dune: %/dune.in
cat $< \
Expand All @@ -75,6 +72,7 @@ CPPO_D=$(API_D)
-e "s/%%%CPPO_D%%%/$(CPPO_D)/g" \
-e "s/%%%API_PKG%%%/$(API_PKG)/g" \
-e "s/%%%SOSA_PKG%%%/$(SOSA_PKG)/g" \
-e "s/%%%GWDB_PKG%%%/$(GWDB_PKG)/g" \
> $@

hd/etc/version.txt:
Expand Down Expand Up @@ -154,15 +152,11 @@ distrib: exe
cp etc/a.gwf $(DISTRIB_DIR)/gw/.
echo "127.0.0.1" > $(DISTRIB_DIR)/gw/only.txt
echo "-setup_link" > $(DISTRIB_DIR)/gw/gwd.arg
cp $(BUILD_DISTRIB_DIR)gwc1.exe $(DISTRIB_DIR)/gw/gwc$(EXT);
cp $(BUILD_DISTRIB_DIR)gwc1.exe $(DISTRIB_DIR)/gw/gwc1$(EXT);
cp $(BUILD_DISTRIB_DIR)gwc2.exe $(DISTRIB_DIR)/gw/gwc2$(EXT);
cp $(BUILD_DISTRIB_DIR)mk_consang.exe $(DISTRIB_DIR)/gw/consang$(EXT);
cp $(BUILD_DISTRIB_DIR)mk_consang.exe $(DISTRIB_DIR)/gw/mk_consang$(EXT);
cp $(BUILD_DISTRIB_DIR)gwc.exe $(DISTRIB_DIR)/gw/gwc$(EXT);
cp $(BUILD_DISTRIB_DIR)consang.exe $(DISTRIB_DIR)/gw/consang$(EXT);
cp $(BUILD_DISTRIB_DIR)gwd.exe $(DISTRIB_DIR)/gw/gwd$(EXT);
cp $(BUILD_DISTRIB_DIR)gwu.exe $(DISTRIB_DIR)/gw/gwu$(EXT);
cp $(BUILD_DISTRIB_DIR)ged2gwb.exe $(DISTRIB_DIR)/gw/ged2gwb$(EXT);
cp $(BUILD_DISTRIB_DIR)ged2gwb2.exe $(DISTRIB_DIR)/gw/ged2gwb2$(EXT);
cp $(BUILD_DISTRIB_DIR)gwb2ged.exe $(DISTRIB_DIR)/gw/gwb2ged$(EXT);
cp $(BUILD_DISTRIB_DIR)connex.exe $(DISTRIB_DIR)/gw/connex$(EXT);
cp $(BUILD_DISTRIB_DIR)gwdiff.exe $(DISTRIB_DIR)/gw/gwdiff$(EXT);
Expand Down
2 changes: 0 additions & 2 deletions benchmark/bench.ml
@@ -1,5 +1,3 @@
open Geneweb

let bench name n fn arg =
ignore @@ Benchmark.latency1 ~name n (List.map fn) arg

Expand Down
2 changes: 1 addition & 1 deletion benchmark/dune.in
@@ -1,6 +1,6 @@
(executable
(name bench)
(libraries unix geneweb.wserver %%%SOSA_PKG%%% geneweb benchmark)
(libraries unix geneweb.wserver %%%SOSA_PKG%%% %%%GWDB_PKG%%% geneweb benchmark)
)

(alias (name runbench) (action (run ./bench.exe) ) )
10 changes: 6 additions & 4 deletions bin/distrib/db1link/db1link.ml
@@ -1,5 +1,6 @@
(* Copyright (c) 1998-2007 INRIA *)

open Geneweb
open Gwcomp
open Dbdisk
open Def
Expand Down Expand Up @@ -1346,10 +1347,10 @@ let link next_family_fun bdir =
linked_base gen per_index_ic per_ic fam_index_ic fam_ic bdir
in
Hashtbl.clear gen.g_patch_p;
let base = Gwdb.base_of_base1 dsk_base in
let base = dsk_base in
if !do_check && gen.g_pcnt > 0 then
begin let changed_p (ip, p, o_sex, o_rpar) =
let p = Gwdb.dsk_person_of_person p in
let p = Gwdb1.dsk_person_of_person (Gwdb1.OfGwdb.person p) in
let p =
{p with sex = fold_option (fun s -> s) p.sex o_sex;
rparents =
Expand All @@ -1361,22 +1362,23 @@ let link next_family_fun bdir =
in
let i = Adef.int_of_iper ip in Hashtbl.replace gen.g_patch_p i p
in
let base = Gwdb1.ToGwdb.base base in
Check.check_base base (set_error base gen) (set_warning base)
(fun i -> gen.g_def.(i)) changed_p !pr_stats;
flush stdout
end;
if not gen.g_errored then
begin
if !do_consang then
(let _ = (ConsangAll.compute base (-1) true : _ option) in ());
(let _ = (ConsangAll.compute (Gwdb1.ToGwdb.base base) (-1) true : _ option) in ());
Gc.compact ();
Outbase.output bdir dsk_base;
output_wizard_notes bdir gen.g_wiznotes;
output_particles_file bdir dsk_base.data.particles;
(try Mutil.remove_dir tmp_dir with _ -> ());
(try Unix.rmdir "gw_tmp" with _ -> ());
output_command_line bdir;
Util.init_cache_info bdir base;
Util.init_cache_info bdir (Gwdb1.ToGwdb.base base);
true
end
else false
2 changes: 2 additions & 0 deletions bin/distrib/db1link/db1link.mli
@@ -1,6 +1,8 @@
(* $Id: db1link.mli,v 5.2 2008-01-15 11:06:04 ddr Exp $ *)
(* Copyright (c) 2007-2008 INRIA *)

open Geneweb

type file_info =
{ mutable f_curr_src_file : string;
mutable f_curr_gwo_file : string;
Expand Down
3 changes: 2 additions & 1 deletion bin/distrib/db2link/db2link.ml
@@ -1,6 +1,7 @@
(* $Id: db2link.ml,v 5.18 2012-01-27 08:53:53 ddr Exp $ *)
(* Copyright (c) 2006-2008 INRIA *)

open Geneweb
open Def
open Gwcomp

Expand Down Expand Up @@ -1175,7 +1176,7 @@ let fold_option fsome vnone =
| None -> vnone

let changed_p (ip, p, o_sex, o_rpar) =
let p = Gwdb.dsk_person_of_person p in
let p = Gwdb2.dsk_person_of_person (Gwdb2.OfGwdb.person p) in
let _p =
{p with sex = fold_option (fun s -> s) p.sex o_sex;
rparents =
Expand Down
43 changes: 29 additions & 14 deletions bin/distrib/dune.in
@@ -1,25 +1,40 @@
(env (dev (flags (-w -33) ) ) )

(include_subdirs unqualified)

(executables
(public_names connex gwc1 gwc2 gwd gwu mk_consang setup update_nldb)
(modules connex gwc1 gwc2 gwd gwu mk_consang setup update_nldb)
(libraries %%%SOSA_PKG%%% geneweb geneweb.wserver)
(public_names connex gwb2ged gwd gwdiff gwu setup update_nldb)
(modules connex gwb2ged gwdiff gwd gwu setup update_nldb)
(libraries str %%%GWDB_PKG%%% geneweb geneweb.wserver)
)

(executables
(public_names ged2gwb ged2gwb2)
(modules ged2gwb ged2gwb2 utf8List)
(libraries unix str camlp5.gramlib %%%SOSA_PKG%%% geneweb)
(names gwtp)
(modules gwtp httpEnv iolight)
(libraries %%%GWDB_PKG%%% geneweb)
)

(executables
(public_names gwb2ged gwdiff)
(modules gwb2ged gwdiff)
(libraries str %%%SOSA_PKG%%% geneweb)
(rule (copy mk_consang/mk_consang.ml consang.ml))
(executable
(public_name consang)
(modules consang)
(preprocess (action (run %{bin:cppo} %%%CPPO_D%%% %{input-file})))
(libraries %%%GWDB_PKG%%% geneweb)
)

(executables
(public_names gwtp)
(modules gwtp httpEnv iolight)
(libraries %%%SOSA_PKG%%% geneweb)
#ifdef GWDB1
(library (name db1link) (wrapped false) (libraries geneweb.gwdb1 geneweb) (modules db1link))
(rule (copy gwc/gwc1.ml gwc.ml))
(rule (copy ged2gwb/ged2gwb1.ml ged2gwb.ml))
(executable
(public_name gwc)
(modules gwc)
(preprocess (action (run %{bin:cppo} %%%CPPO_D%%% %{input-file})))
(libraries geneweb.gwdb1 geneweb geneweb.wserver db1link)
)
(executable
(public_name ged2gwb)
(modules ged2gwb utf8List)
(libraries unix str camlp5.gramlib geneweb.gwdb1 geneweb)
)
#endif
3 changes: 2 additions & 1 deletion bin/distrib/ged2gwb/ged2gwb1.camlp5.ml
Expand Up @@ -3605,8 +3605,9 @@ let finish_base base (persons, families, _, _) =
check_parents_sex base persons families;
check_parents_children base ascends unions couples descends;
if !try_negative_dates then negative_dates base persons families;
let base = Gwdb.base_of_base1 base in
let base = base in
if !do_check then
let base = Gwdb1.ToGwdb.base base in
Check.check_base base
(fun x -> Check.print_base_error !log_oc base x; Printf.fprintf !log_oc "\n")
(function
Expand Down

0 comments on commit 9c89d4f

Please sign in to comment.