commit: 751445976b245a0b052f051bc0a1410d218f4ea4 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Tue Jun 10 09:24:12 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Jun 10 09:24:12 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75144597
net-misc/sks: EAPI 8, drop dev-lang/ocaml pin Closes: https://bugs.gentoo.org/832215 Signed-off-by: Sam James <sam <AT> gentoo.org> net-misc/sks/files/0001-Makefile-drop-Werror.patch | 29 ++ .../0002-Switch-to-caml_-prefixed-functions.patch | 380 +++++++++++++++++++++ ...e-String-Bytes-.-upper-lower-case-removal.patch | 48 +++ ...e-compat-packages-bigarray-compat-camlp-s.patch | 27 ++ net-misc/sks/sks-1.1.6_p20200624-r3.ebuild | 142 ++++++++ 5 files changed, 626 insertions(+) diff --git a/net-misc/sks/files/0001-Makefile-drop-Werror.patch b/net-misc/sks/files/0001-Makefile-drop-Werror.patch new file mode 100644 index 000000000000..28be702a12d9 --- /dev/null +++ b/net-misc/sks/files/0001-Makefile-drop-Werror.patch @@ -0,0 +1,29 @@ +From 70ae53256721a3822089cfba24888c76150313a7 Mon Sep 17 00:00:00 2001 +From: Sam James <s...@gentoo.org> +Date: Tue, 10 Jun 2025 10:19:04 +0100 +Subject: [PATCH 1/4] Makefile: drop -Werror + +See also https://sources.debian.org/patches/sks/1.1.6%2Bgit20210302.c3ba6d5a-4.1/0001-Do-not-error-on-warning-6-labels-omitted.patch/ + +Bug: https://bugs.gentoo.org/832215 +Signed-off-by: Sam James <s...@gentoo.org> +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index c84368e..739a0b1 100644 +--- a/Makefile ++++ b/Makefile +@@ -49,7 +49,7 @@ SKSVS=$(shell grep 'version_suffix = "+"' common.ml) + ifeq ($(strip $(SKSVS)),) + WARNERR= + else +-WARNERR=-warn-error A ++WARNERR= + endif + + CAMLINCLUDE= -package cryptokit,unix,str,bigarray,num -I bdb +-- +2.49.0 + diff --git a/net-misc/sks/files/0002-Switch-to-caml_-prefixed-functions.patch b/net-misc/sks/files/0002-Switch-to-caml_-prefixed-functions.patch new file mode 100644 index 000000000000..e685442b85d1 --- /dev/null +++ b/net-misc/sks/files/0002-Switch-to-caml_-prefixed-functions.patch @@ -0,0 +1,380 @@ +From 5e46e59e6e403690d5e7a7ec8acbce831e5db81c Mon Sep 17 00:00:00 2001 +From: Sam James <s...@gentoo.org> +Date: Tue, 10 Jun 2025 10:20:31 +0100 +Subject: [PATCH 2/4] Switch to caml_ prefixed functions + +This is needed w/ 5.3.0 at least. + +Signed-off-by: Sam James <s...@gentoo.org> +--- + bdb/bdb_stubs.c | 82 ++++++++++++++++++++++++------------------------- + crc.c | 8 ++--- + 2 files changed, 45 insertions(+), 45 deletions(-) + +diff --git a/bdb/bdb_stubs.c b/bdb/bdb_stubs.c +index 959ee27..87bcd5d 100644 +--- a/bdb/bdb_stubs.c ++++ b/bdb/bdb_stubs.c +@@ -59,7 +59,7 @@ static void dbt_from_string(DBT *dbt, value v) { + zerob(dbt, sizeof(*dbt)); + + dbt->data = (void *)String_val(v); +- dbt->size = string_length(v); ++ dbt->size = caml_string_length(v); + } + + #if OCAML_VERSION < 40600 +@@ -75,19 +75,19 @@ static value caml_alloc_initialized_string(size_t len, const char *p) + + #define test_cursor_closed(cursor) \ + if (UW_cursor_closed(cursor)) \ +- invalid_argument("Attempt to use closed cursor") ++ caml_invalid_argument("Attempt to use closed cursor") + + #define test_dbenv_closed(dbenv) \ + if (UW_dbenv_closed(dbenv)) \ +- invalid_argument("Attempt to use closed dbenv") ++ caml_invalid_argument("Attempt to use closed dbenv") + + #define test_db_closed(db) \ + if (UW_db_closed(db)) \ +- invalid_argument("Attempt to use closed db") ++ caml_invalid_argument("Attempt to use closed db") + + #define test_txn_closed(txn) \ + if (UW_txn_closed(txn)) \ +- invalid_argument("Attempt to use closed txn") ++ caml_invalid_argument("Attempt to use closed txn") + + // comments starting with "//+" are extracted automatically to create the .ml + // file that forms the caml side of this interface. +@@ -239,15 +239,15 @@ value caml_db_init(value v){ + //+ type db + + void raise_db(const char *msg) { +- raise_with_string(*caml_db_exn, msg); ++ caml_raise_with_string(*caml_db_exn, msg); + } + + void raise_key_exists() { +- raise_constant(*caml_key_exists_exn); ++ caml_raise_constant(*caml_key_exists_exn); + } + + void raise_run_recovery() { +- raise_constant(*caml_db_run_recovery_exn); ++ caml_raise_constant(*caml_db_run_recovery_exn); + } + + // Used as callback by db infrastructure for setting errors. As a result, +@@ -321,7 +321,7 @@ value caml_dbenv_create(value unit){ + + dbenv->set_errcall(dbenv,raise_db_cb); + +- rval = alloc_custom(&dbenv_custom,Camldbenv_wosize,0,1); ++ rval = caml_alloc_custom(&dbenv_custom,Camldbenv_wosize,0,1); + UW_dbenv(rval) = dbenv; + UW_dbenv_closed(rval) = False; + CAMLreturn (rval); +@@ -335,7 +335,7 @@ value caml_dbenv_open(value dbenv, value vdirectory, + CAMLparam4(dbenv,vdirectory,vflags,vmode); + int err; + const char *directory = String_val(vdirectory); +- int flags = convert_flag_list(vflags,dbenv_open_flags); ++ int flags = caml_convert_flag_list(vflags,dbenv_open_flags); + + test_dbenv_closed(dbenv); + +@@ -416,7 +416,7 @@ value caml_dbenv_set_verbose(value dbenv, value vflags, + CAMLparam3(dbenv,vflags,v_onoff); + int err; + +- int which = convert_flag_list(vflags,dbenv_verbose_flags) + 1; ++ int which = caml_convert_flag_list(vflags,dbenv_verbose_flags) + 1; + int onoff = Bool_val(v_onoff); + + test_dbenv_closed(dbenv); +@@ -524,8 +524,8 @@ value caml_db_create(value dbenv_opt, value vflags){ + + /* The flags parameter is currently unused, and must be set to 0. */ + if (vflags != Val_emptylist) +- invalid_argument("DB.create invalid create flag"); +- flags = convert_flag_list(vflags,db_create_flags); ++ caml_invalid_argument("DB.create invalid create flag"); ++ flags = caml_convert_flag_list(vflags,db_create_flags); + + if (Is_None(dbenv_opt)) { dbenv = NULL; } + else { +@@ -538,7 +538,7 @@ value caml_db_create(value dbenv_opt, value vflags){ + + db->set_errcall(db,raise_db_cb); + +- rval = alloc_custom(&db_custom,Camldb_wosize,0,1); ++ rval = caml_alloc_custom(&db_custom,Camldb_wosize,0,1); + UW_db(rval) = db; + UW_db_closed(rval) = False; + CAMLreturn (rval); +@@ -553,7 +553,7 @@ value caml_db_open(value db, value vfname, + CAMLparam5(db, vfname, vdbtype, vflags, vmode); + int err; + const char *fname = String_val(vfname); +- int flags = convert_flag_list(vflags,db_open_flags); ++ int flags = caml_convert_flag_list(vflags,db_open_flags); + int dbtype = Flag_val(vdbtype,db_types); + + test_db_closed(db); +@@ -630,7 +630,7 @@ value caml_db_put(value db, value txn_opt, value vkey, + + dbt_from_string(&key, vkey); + dbt_from_string(&data, vdata); +- flags = convert_flag_list(vflags, db_put_flags); ++ flags = caml_convert_flag_list(vflags, db_put_flags); + + err = UW_db(db)->put(UW_db(db), txn, &key, &data, flags); + if (err != 0) { +@@ -661,12 +661,12 @@ value caml_db_get(value db, value txn_opt, value vkey, value vflags) { + + zerob(&data,sizeof(DBT)); + dbt_from_string(&key, vkey); +- flags = convert_flag_list(vflags, db_get_flags); ++ flags = caml_convert_flag_list(vflags, db_get_flags); + + err = UW_db(db)->get(UW_db(db), txn, &key, &data, flags); + if (err != 0) { + ////fprintf(stderr,"Error found: %d\n",err); fflush(stderr); +- if (err == DB_NOTFOUND) { raise_not_found(); } ++ if (err == DB_NOTFOUND) { caml_raise_not_found(); } + UW_db(db)->err(UW_db(db),err,"caml_db_get"); + } + +@@ -683,7 +683,7 @@ value caml_db_set_flags(value db, value vflags) { + + test_db_closed(db); + +- flags = convert_flag_list(vflags,db_set_flags); ++ flags = caml_convert_flag_list(vflags,db_set_flags); + + err = UW_db(db)->set_flags(UW_db(db),flags); + if (err != 0) { UW_db(db)->err(UW_db(db),err,"caml_db_set_flags"); } +@@ -873,7 +873,7 @@ value caml_cursor_create(value vwritecursor, value txn_opt, value db) { + UW_db(db)->err(UW_db(db),err, "caml_cursor_create"); + } + +- rval = alloc_custom(&cursor_custom,Camlcursor_wosize,0,1); ++ rval = caml_alloc_custom(&cursor_custom,Camlcursor_wosize,0,1); + + UW_cursor(rval) = cursor; + UW_cursor_closed(rval) = False; +@@ -944,7 +944,7 @@ value caml_cursor_init(value cursor, value vkey, value vflags) { + CAMLparam3(cursor,vkey,vflags); + CAMLlocal1(rval); + DBT key,data; +- int flags = convert_flag_list(vflags,cursor_get_flags) | DB_SET; ++ int flags = caml_convert_flag_list(vflags,cursor_get_flags) | DB_SET; + int err; + + test_cursor_closed(cursor); +@@ -954,7 +954,7 @@ value caml_cursor_init(value cursor, value vkey, value vflags) { + + err = UW_cursor(cursor)->c_get(UW_cursor(cursor), &key, &data, flags); + if (err != 0) { +- if (err == DB_NOTFOUND) { raise_not_found(); } ++ if (err == DB_NOTFOUND) { caml_raise_not_found(); } + raise_db(db_strerror(err)); + } + +@@ -969,7 +969,7 @@ value caml_cursor_init_range(value cursor, value vkey, value vflags) { + CAMLparam3(cursor,vkey,vflags); + CAMLlocal3(rkey,rdata,rpair); + DBT key,data; +- int flags = convert_flag_list(vflags,cursor_get_flags) | DB_SET_RANGE; ++ int flags = caml_convert_flag_list(vflags,cursor_get_flags) | DB_SET_RANGE; + int err; + + test_cursor_closed(cursor); +@@ -979,7 +979,7 @@ value caml_cursor_init_range(value cursor, value vkey, value vflags) { + + err = UW_cursor(cursor)->c_get(UW_cursor(cursor), &key, &data, flags); + if (err != 0) { +- if (err == DB_NOTFOUND) { raise_not_found(); } ++ if (err == DB_NOTFOUND) { caml_raise_not_found(); } + raise_db(db_strerror(err)); + } + +@@ -1005,7 +1005,7 @@ value caml_cursor_init_both(value cursor, value vkey, + + int ctr = 0; + +- flags = convert_flag_list(vflags,cursor_get_flags) | DB_GET_BOTH; ++ flags = caml_convert_flag_list(vflags,cursor_get_flags) | DB_GET_BOTH; + test_cursor_closed(cursor); + + dbt_from_string(&key, vkey); +@@ -1013,7 +1013,7 @@ value caml_cursor_init_both(value cursor, value vkey, + + err = UW_cursor(cursor)->c_get(UW_cursor(cursor), &key, &data, flags); + if (err != 0) { +- if (err == DB_NOTFOUND) { raise_not_found (); } ++ if (err == DB_NOTFOUND) { caml_raise_not_found (); } + raise_db(db_strerror(err)); + } + +@@ -1028,7 +1028,7 @@ value caml_cursor_get(value cursor, value vtype, value vflags) { + CAMLlocal3(rpair,rkey,rdata); + DBT key,data; + int flags = Flag_val(vtype,cursor_get_type) | +- convert_flag_list(vflags,cursor_get_flags); ++ caml_convert_flag_list(vflags,cursor_get_flags); + int err; + zerob(&key,sizeof(DBT)); zerob(&data,sizeof(DBT)); + +@@ -1036,7 +1036,7 @@ value caml_cursor_get(value cursor, value vtype, value vflags) { + + err = UW_cursor(cursor)->c_get(UW_cursor(cursor), &key, &data,flags); + if (err != 0) { +- if (err == DB_NOTFOUND) { raise_not_found(); } ++ if (err == DB_NOTFOUND) { caml_raise_not_found(); } + raise_db(db_strerror(err)); + } + +@@ -1056,7 +1056,7 @@ value caml_cursor_get_keyonly(value cursor, value vtype, value vflags) { + CAMLlocal1(rkey); + DBT key,data; + int flags = Flag_val(vtype,cursor_get_type) | +- convert_flag_list(vflags,cursor_get_flags); ++ caml_convert_flag_list(vflags,cursor_get_flags); + int err; + zerob(&key,sizeof(DBT)); zerob(&data,sizeof(DBT)); + +@@ -1064,7 +1064,7 @@ value caml_cursor_get_keyonly(value cursor, value vtype, value vflags) { + + err = UW_cursor(cursor)->c_get(UW_cursor(cursor), &key, &data,flags); + if (err != 0) { +- if (err == DB_NOTFOUND) { raise_not_found(); } ++ if (err == DB_NOTFOUND) { caml_raise_not_found(); } + raise_db(db_strerror(err)); + } + +@@ -1118,7 +1118,7 @@ value caml_cursor_dup(value vkeep_position, value cursor) { + err = UW_cursor(cursor)->c_dup(UW_cursor(cursor), &newcursor, flags); + if (err != 0) { raise_db(db_strerror(err)); } + +- rval = alloc_custom(&cursor_custom,Camlcursor_wosize,0,1); ++ rval = caml_alloc_custom(&cursor_custom,Camlcursor_wosize,0,1); + UW_cursor(rval) = newcursor; + UW_cursor_closed(rval) = False; + +@@ -1136,7 +1136,7 @@ value caml_join_cursors(value vnosort, value db, + CAMLlocal1(rval); + DBC *jcurs; // pointer to joined cursor + int carray_len = Wosize_val(vcursors); +- int flags = convert_flag_list(vflags,cursor_get_flags); ++ int flags = caml_convert_flag_list(vflags,cursor_get_flags); + DBC *cursors[carray_len + 1]; + int i; + +@@ -1146,7 +1146,7 @@ value caml_join_cursors(value vnosort, value db, + + for (i=0; i < carray_len; i++) { + if (UW_cursor_closed(Field(vcursors,i))) { +- invalid_argument("caml_join_cursors: Attempt to use closed cursor"); ++ caml_invalid_argument("caml_join_cursors: Attempt to use closed cursor"); + } + cursors[i] = UW_cursor(Field(vcursors,i)); + } +@@ -1156,7 +1156,7 @@ value caml_join_cursors(value vnosort, value db, + UW_db(db)->join(UW_db(db),cursors,&jcurs,flags); + + +- rval = alloc_custom(&cursor_custom,Camlcursor_wosize,0,1); ++ rval = caml_alloc_custom(&cursor_custom,Camlcursor_wosize,0,1); + UW_cursor(rval) = jcurs; + UW_cursor_closed(rval) = False; + CAMLreturn (rval); +@@ -1209,7 +1209,7 @@ value caml_set_txn_max(value dbenv, value vmax) { + if (err != 0) { + //fprintf(stderr,"Error found: %d\n",err); fflush(stderr); + if (err == EINVAL) { +- invalid_argument("set_txn_max called after dbenv opened"); ++ caml_invalid_argument("set_txn_max called after dbenv opened"); + } else { + UW_dbenv(dbenv)->err(UW_dbenv(dbenv), err, "caml_set_txn_max"); + } +@@ -1247,7 +1247,7 @@ value caml_txn_begin(value dbenv, value parent_opt, value vflags) { + + test_dbenv_closed(dbenv); + +- flags = convert_flag_list(vflags,txn_begin_flags); ++ flags = caml_convert_flag_list(vflags,txn_begin_flags); + + if (Is_None(parent_opt)) { parent = NULL; } + else { +@@ -1259,13 +1259,13 @@ value caml_txn_begin(value dbenv, value parent_opt, value vflags) { + err = UW_dbenv(dbenv)->txn_begin(UW_dbenv(dbenv), parent, &newtxn, flags); + if (err != 0) { + if (err == ENOMEM) { +- failwith("Maximum # of concurrent transactions reached"); ++ caml_failwith("Maximum # of concurrent transactions reached"); + } else { + UW_dbenv(dbenv)->err(UW_dbenv(dbenv), err,"caml_txn_begin"); + } + } + +- rval = alloc_custom(&txn_custom,Camltxn_wosize,0,1); ++ rval = caml_alloc_custom(&txn_custom,Camltxn_wosize,0,1); + UW_txn(rval) = newtxn; + UW_txn_closed(rval) = False; + CAMLreturn(rval); +@@ -1283,13 +1283,13 @@ value caml_txn_checkpoint(value dbenv, value vkbyte, value vmin, + + kbyte = Int_val(vkbyte); + min = Int_val(vmin); +- flags = convert_flag_list(vflags,txn_checkpoint_flags); ++ flags = caml_convert_flag_list(vflags,txn_checkpoint_flags); + + err = UW_dbenv(dbenv)->txn_checkpoint(UW_dbenv(dbenv),kbyte,min,flags); + if (err != 0) { + //fprintf(stderr,"Error found: %d\n",err); fflush(stderr); + if (err == EINVAL) { +- invalid_argument("caml_txn_checkpoint: no reason specified"); ++ caml_invalid_argument("caml_txn_checkpoint: no reason specified"); + } else { + UW_dbenv(dbenv)->err(UW_dbenv(dbenv), err, "caml_txn_checkpoint"); + } +@@ -1304,7 +1304,7 @@ value caml_txn_commit(value txn, value vflags) { + int err, flags; + + test_txn_closed(txn); +- flags = convert_flag_list(vflags,txn_commit_flags); ++ flags = caml_convert_flag_list(vflags,txn_commit_flags); + + err = UW_txn(txn)->commit(UW_txn(txn),flags); + UW_txn_closed(txn) = True; // transaction can never be used again +diff --git a/crc.c b/crc.c +index daafad3..2c570b0 100644 +--- a/crc.c ++++ b/crc.c +@@ -51,7 +51,7 @@ value caml_crc_octets(value data) { + CAMLparam1(data); + CAMLlocal1(rval); + unsigned const char *octets = String_val(data); +- size_t len = string_length(data); ++ size_t len = caml_string_length(data); + long crc = crc_octets(octets,len); + + rval = Val_int(crc); +@@ -63,8 +63,8 @@ value caml_get_tzname(value none) { + CAMLparam1(none); + CAMLlocal1(rval); + tzset(); +- rval = alloc_tuple(2); +- Store_field(rval,0,copy_string(tzname[0])); +- Store_field(rval,1,copy_string(tzname[1])); ++ rval = caml_alloc_tuple(2); ++ Store_field(rval,0,caml_copy_string(tzname[0])); ++ Store_field(rval,1,caml_copy_string(tzname[1])); + CAMLreturn(rval); + } +-- +2.49.0 + diff --git a/net-misc/sks/files/0003-Handle-String-Bytes-.-upper-lower-case-removal.patch b/net-misc/sks/files/0003-Handle-String-Bytes-.-upper-lower-case-removal.patch new file mode 100644 index 000000000000..562769c89c46 --- /dev/null +++ b/net-misc/sks/files/0003-Handle-String-Bytes-.-upper-lower-case-removal.patch @@ -0,0 +1,48 @@ +From 39172daccac13da1c1abc107e13acfa1bd257cc9 Mon Sep 17 00:00:00 2001 +From: Sam James <s...@gentoo.org> +Date: Tue, 10 Jun 2025 10:20:54 +0100 +Subject: [PATCH 3/4] Handle {String,Bytes}.{upper,lower}case removal + +Switch to _ascii. + +Signed-off-by: Sam James <s...@gentoo.org> +--- + script.ml | 2 +- + utils.ml | 8 ++++---- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/script.ml b/script.ml +index f6e7bd0..4491c3d 100644 +--- a/script.ml ++++ b/script.ml +@@ -58,7 +58,7 @@ let is_content_type line = + try + let colonpos = String.index line ':' in + let prefix = String.sub ~pos:0 ~len:colonpos line in +- String.lowercase prefix = "content-type" ++ String.lowercase_ascii prefix = "content-type" + with + Not_found -> false + +diff --git a/utils.ml b/utils.ml +index c840b71..7efc316 100644 +--- a/utils.ml ++++ b/utils.ml +@@ -102,10 +102,10 @@ let is_alnum char = + (num >= int_of_char '0' && num <= int_of_char '9') || + (num >= 192 && num <= 255) + +-let lowercase = String.lowercase[@@ocaml.warning "-3"] +-let uppercase = String.uppercase[@@ocaml.warning "-3"] +-let bytes_lowercase = Bytes.lowercase[@@ocaml.warning "-3"] +-let bytes_uppercase = Bytes.uppercase[@@ocaml.warning "-3"] ++let lowercase = String.lowercase_ascii[@@ocaml.warning "-3"] ++let uppercase = String.uppercase_ascii[@@ocaml.warning "-3"] ++let bytes_lowercase = Bytes.lowercase_ascii[@@ocaml.warning "-3"] ++let bytes_uppercase = Bytes.uppercase_ascii[@@ocaml.warning "-3"] + + let rec extract_words_rec s ~start ~len partial = + let one () = Set.add (lowercase (String.sub s start len)) partial in +-- +2.49.0 + diff --git a/net-misc/sks/files/0004-Makefile-use-compat-packages-bigarray-compat-camlp-s.patch b/net-misc/sks/files/0004-Makefile-use-compat-packages-bigarray-compat-camlp-s.patch new file mode 100644 index 000000000000..08c6132cf066 --- /dev/null +++ b/net-misc/sks/files/0004-Makefile-use-compat-packages-bigarray-compat-camlp-s.patch @@ -0,0 +1,27 @@ +From da84291b246c5261d4dd56ec6a8e465d6a547203 Mon Sep 17 00:00:00 2001 +From: Sam James <s...@gentoo.org> +Date: Tue, 10 Jun 2025 10:21:10 +0100 +Subject: [PATCH 4/4] Makefile: use compat packages (bigarray-compat, + camlp-streams) + +Signed-off-by: Sam James <s...@gentoo.org> +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 739a0b1..41fac08 100644 +--- a/Makefile ++++ b/Makefile +@@ -52,7 +52,7 @@ else + WARNERR= + endif + +-CAMLINCLUDE= -package cryptokit,unix,str,bigarray,num -I bdb ++CAMLINCLUDE= -package cryptokit,unix,str,bigarray-compat,num,camlp-streams -I bdb + COMMONCAMLFLAGS=$(CAMLINCLUDE) $(OCAMLLIB) $(CAMLCFLAGS) $(CAMLLDFLAGS) -ccopt -Lbdb -annot -bin-annot $(WARNERR) + OCAMLDEP=ocamldep + CAMLLIBS=bdb.cma +-- +2.49.0 + diff --git a/net-misc/sks/sks-1.1.6_p20200624-r3.ebuild b/net-misc/sks/sks-1.1.6_p20200624-r3.ebuild new file mode 100644 index 000000000000..f6051d2f4971 --- /dev/null +++ b/net-misc/sks/sks-1.1.6_p20200624-r3.ebuild @@ -0,0 +1,142 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit readme.gentoo-r1 systemd toolchain-funcs + +COMMIT="591a7834dc9f1dff3d336d769a6561138a5befe7" +DESCRIPTION="An OpenPGP keyserver which is decentralized with highly reliable synchronization" +HOMEPAGE="https://github.com/SKS-Keyserver/sks-keyserver" +SRC_URI="https://github.com/SKS-Keyserver/sks-keyserver/archive/${COMMIT}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN}-keyserver-${COMMIT}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="optimize test" +RESTRICT="!test? ( test )" + +DOC_CONTENTS="To get sks running, first build the database, +start the database, import atleast one key, then +run a cleandb. See the sks man page for more information +Typical DB_CONFIG file and sksconf has been installed +in /var/lib/sks and can be used as templates by renaming +to remove the .typical extension. The DB_CONFIG file has +to be in place before doing the database build, or the BDB +environment has to be manually cleared from both KDB and PTree. +The same applies if you are upgrading to this version with an existing KDB/Ptree, +using another version of BDB than 4.8; you need to clear the environment +using e.g. db4.6_recover -h . and db4.6_checkpoint -1h . in both KDB and PTree +Additionally a sample web interface has been installed as +web.typical in /var/lib/sks that can be used by renaming it to web +Important: It is strongly recommended to set up SKS behind a +reverse proxy. Instructions on properly configuring SKS can be +found at https://bitbucket.org/skskeyserver/sks-keyserver/wiki/Peering" + +RDEPEND=" + acct-user/sks + acct-group/sks + dev-lang/ocaml:= + dev-ml/bigarray-compat:= + dev-ml/camlp4:= + dev-ml/camlp-streams:= + dev-ml/cryptokit:= + dev-ml/num:= + sys-libs/db:5.3 +" +DEPEND="${RDEPEND} + dev-ml/findlib" + +PATCHES=( + "${FILESDIR}"/${PN}-1.1.6_p20200624-respect-CFLAGS-CXXFLAGS.patch + "${FILESDIR}"/${PN}-1.1.6_p20200624-QA-fixups.patch + "${FILESDIR}"/${PN}-1.1.6_p20200624-r1-db-hang.patch + "${FILESDIR}"/0001-Makefile-drop-Werror.patch + "${FILESDIR}"/0002-Switch-to-caml_-prefixed-functions.patch + "${FILESDIR}"/0003-Handle-String-Bytes-.-upper-lower-case-removal.patch + "${FILESDIR}"/0004-Makefile-use-compat-packages-bigarray-compat-camlp-s.patch +) + +QA_FLAGS_IGNORED=( + /usr/bin/sks_add_mail +) + +src_prepare() { + cp Makefile.local.unused Makefile.local || die + sed -i \ + -e "s:^BDBLIB=.*$:BDBLIB=-L/usr/$(get_libdir):g" \ + -e "s:^BDBINCLUDE=.*$:BDBINCLUDE=-I/usr/include/db5.3/:g" \ + -e "s:^LIBDB=.*$:LIBDB=-ldb-5.3:g" \ + Makefile.local || die + sed -i \ + -e 's:/usr/sbin/sks:/usr/bin/sks:g' \ + sks_build.sh || die + + dosym sks_build.sh /usr/bin/sks_build.bc.sh + default +} + +src_compile() { + tc-export CC CXX RANLIB + + emake dep + # sks build fails with parallel build in module Bdb + emake -j1 all + if use optimize; then + emake all.bc + fi +} + +src_test() { + ./sks unit_test || die +} + +src_install() { + sed -i \ + -e "s:^PREFIX=.*$:PREFIX=${ED}/usr:g" \ + -e "s:^MANDIR=.*$:MANDIR=${ED}/usr/share/man:g" \ + Makefile.local || die + + if use optimize; then + emake install.bc + dosym sks.bc usr/bin/sks + dosym sks_add_mail.bc usr/bin/sks_add_mail + else + emake install + fi + + dodoc README.md + + newinitd "${FILESDIR}/sks-db.initd" sks-db + newinitd "${FILESDIR}/sks-recon.initd" sks-recon + newconfd "${FILESDIR}/sks.confd" sks + systemd_dounit "${FILESDIR}"/sks-db.service + systemd_dounit "${FILESDIR}"/sks-recon.service + + dodir "/var/lib/sks/web.typical" + + insinto /var/lib/sks + fowners sks:sks /var/lib/sks + + newins sampleConfig/DB_CONFIG DB_CONFIG.typical + newins sampleConfig/sksconf.typical sksconf.typical + insinto /var/lib/sks/web.typical + doins sampleWeb/HTML5/* + + keepdir /var/lib/sks + readme.gentoo_create_doc +} + +pkg_postinst() { + readme.gentoo_print_elog + + if [[ -n "${REPLACING_VERSIONS}" ]]; then + einfo "Note when upgrading from versions of SKS earlier than 1.1.4" + einfo "The default values for pagesize settings have changed. To continue" + einfo "using an existing DB without rebuilding, explicit settings have to be" + einfo "added to the sksconf file." + einfo "pagesize: 4" + einfo "ptree_pagesize: 1" + fi; +}