[Pkg-sks-commit] r39 - sks/patchforupstream
chrism at alioth.debian.org
chrism at alioth.debian.org
Thu Jun 19 14:38:27 UTC 2008
Author: chrism
Date: 2008-06-19 14:38:26 +0000 (Thu, 19 Jun 2008)
New Revision: 39
Added:
sks/patchforupstream/001_common.ml.fix
Log:
[project @ 40]
common.ml should be generated on the fly and
common.src.ml had a old broken piece of code
Original author: fabbione
Date: 2003-12-03 09:25:42.075446+00:00
Added: sks/patchforupstream/001_common.ml.fix
===================================================================
--- sks/patchforupstream/001_common.ml.fix (rev 0)
+++ sks/patchforupstream/001_common.ml.fix 2008-06-19 14:38:26 UTC (rev 39)
@@ -0,0 +1,254 @@
+diff -Nardu sks-1.0.5-old/common.ml sks-1.0.5/common.ml
+--- sks-1.0.5-old/common.ml 2003-11-28 13:48:22.000000000 +0100
++++ sks-1.0.5/common.ml 1970-01-01 01:00:00.000000000 +0100
+@@ -1,215 +0,0 @@
+-(************************************************************************)
+-(* This file is part of SKS. SKS is free software; you can
+- redistribute it and/or modify it under the terms of the GNU General
+- Public License as published by the Free Software Foundation; either
+- version 2 of the License, or (at your option) any later version.
+-
+- This program is distributed in the hope that it will be useful, but
+- WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- General Public License for more details.
+-
+- You should have received a copy of the GNU General Public License
+- along with this program; if not, write to the Free Software
+- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+- USA *)
+-(***********************************************************************)
+-
+-(** Common services, including error reporting, logging,
+- exception handling and port definitions *)
+-
+-open Printf
+-open StdLabels
+-open MoreLabels
+-module Unix = UnixLabels
+-
+-exception Bug of string
+-exception Transaction_aborted of string
+-
+-module Map = PMap.Map
+-let (|<) map key = (fun data -> Map.add ~key ~data map)
+-let (|=) map key = Map.find key map
+-
+-(********************************************************************)
+-
+-(** filters applied to all incoming keys *)
+-let enforced_filters = ["yminsky.dedup"]
+-
+-let version_tuple = (1,0,5)
+-let compatible_version_tuple = (0,1,5)
+-let version =
+- let (maj_version,min_version,release) = version_tuple in
+- sprintf "%d.%d.%d" maj_version min_version release
+-
+-let period_regexp = Str.regexp "[.]"
+-
+-let parse_version_string vstr =
+- let ar = Array.of_list (Str.bounded_split period_regexp vstr 3) in
+- (int_of_string ar.(0), int_of_string ar.(1), int_of_string ar.(2))
+-
+-let err_to_string err = match err with
+- Unix.Unix_error (enum,fname,param) ->
+- sprintf "Unix error: %s - %s(%s)"
+- (Unix.error_message enum) fname param
+- | e -> Printexc.to_string e
+-
+-(**************************************************************************)
+-(** Logfile control *)
+-
+-let logfile = ref stdout
+-let stored_logfile_name = ref None
+-
+-(**************************************************************************)
+-
+-let plerror level =
+- kprintf (fun s ->
+- if !Settings.debug && level <= !Settings.debuglevel
+- then (
+- let tm = Unix.localtime (Unix.time ()) in
+- fprintf !logfile "%04d-%02d-%02d %02d:%02d:%02d "
+- (tm.Unix.tm_year + 1900) (tm.Unix.tm_mon + 1)
+- tm.Unix.tm_mday (* date *)
+- tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec; (* time *)
+- output_string !logfile s;
+- output_string !logfile "\n";
+- flush !logfile;
+- );
+- s
+- )
+-
+-(**************************************************************************)
+-
+-let set_logfile extension =
+- if !Settings.filelog then
+- let fname = (Filename.concat !Settings.basedir "log") ^ extension in
+- stored_logfile_name := Some fname;
+- logfile := open_out_gen [ Open_wronly; Open_creat; Open_append; ]
+- 0o600 fname;
+- ignore (plerror 0 "Opening log")
+-
+-let reopen_logfile () =
+- match !stored_logfile_name with
+- | None -> ()
+- | Some name ->
+- close_out !logfile;
+- logfile := open_out_gen [ Open_wronly; Open_creat; Open_append; ]
+- 0o600 name
+-
+-(**************************************************************************)
+-
+-let perror x = plerror 3 x
+-
+-let eplerror level e =
+- kprintf (fun s ->
+- if !Settings.debug && level <= !Settings.debuglevel
+- then (
+- let tm = Unix.localtime (Unix.time ()) in
+- fprintf !logfile "%04d-%02d-%02d %02d:%02d:%02d "
+- (tm.Unix.tm_year + 1900) (tm.Unix.tm_mon + 1)
+- tm.Unix.tm_mday (* date *)
+- tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec;
+- output_string !logfile s;
+- fprintf !logfile ": %s\n" (err_to_string e);
+- flush !logfile;
+- );
+- s
+- )
+-
+-let eperror x = eplerror 3 x
+-
+-let signore (x:string) = ignore x
+-
+-(********************************************************************)
+-(** Setup signals. In particular, most of the time we want to catch and
+- gracefully handle both sigint and sigterm *)
+-
+-let catch_break = ref false
+-let handle_interrupt i =
+- if !catch_break
+- then raise Sys.Break
+-
+-
+-let () = Sys.set_signal Sys.sigterm (Sys.Signal_handle handle_interrupt)
+-let () = Sys.set_signal Sys.sigint (Sys.Signal_handle handle_interrupt)
+-let () = Sys.set_signal Sys.sigpipe Sys.Signal_ignore
+-let () = Sys.set_signal Sys.sighup
+- (Sys.Signal_handle (fun _ -> reopen_logfile ()))
+-
+-let set_catch_break bool =
+- catch_break := bool
+- (* Sys.catch_break bool; *)
+-
+-let () = set_catch_break true
+-
+-(********************************************************************)
+-
+-let protect ~f ~finally =
+- let result = ref None in
+- let pfinally () =
+- set_catch_break false;
+- (try (finally () : unit)
+- with ee ->
+- set_catch_break true;
+- raise ee);
+- set_catch_break true;
+- in
+- try
+- result := Some (f ());
+- raise Exit
+- with
+- Exit as e ->
+- pfinally ();
+- (match !result with Some x -> x | None -> raise e)
+- | e ->
+- pfinally ();
+- raise e
+-
+-let fprotect ~f ~finally () = protect ~f ~finally
+-
+-let rec filter_opts optlist = match optlist with
+- [] -> []
+- | (Some x)::tl -> x::(filter_opts tl)
+- | None::tl -> filter_opts tl
+-
+-let decomment l =
+- try
+- let pos = String.index l '#' in
+- String.sub l ~pos:0 ~len:pos
+- with
+- Not_found -> l
+-
+-let rec strip_opt list = match list with
+- [] -> []
+- | None::tl -> strip_opt tl
+- | (Some hd)::tl -> hd::(strip_opt tl)
+-
+-let apply_opt ~f opt = match opt with
+- None -> None
+- | Some x -> Some (f x)
+-
+-(***************************)
+-
+-type event = | Add of string
+- | Delete of string
+-
+-type timestamp = float
+-
+-(************************************************************)
+-(************************************************************)
+-(** Network Related definitions *)
+-
+-let recon_port = !Settings.recon_port
+-let recon_address = !Settings.recon_address
+-let http_port = !Settings.hkp_port
+-let http_address = !Settings.hkp_address
+-let db_command_name = Filename.concat !Settings.basedir "db_com_sock"
+-let recon_command_name = Filename.concat !Settings.basedir "recon_com_sock"
+-
+-let db_command_addr = Unix.ADDR_UNIX db_command_name
+-let recon_command_addr = Unix.ADDR_UNIX recon_command_name
+-
+-let recon_addr_to_http_addr addr = match addr with
+- Unix.ADDR_UNIX _ -> failwith "Can't convert UNIX address"
+- | Unix.ADDR_INET (inet_addr,port) -> Unix.ADDR_INET (inet_addr,port + 1)
+-
+-
+diff -Nardu sks-1.0.5-old/common.src.ml sks-1.0.5/common.src.ml
+--- sks-1.0.5-old/common.src.ml 2003-10-12 22:20:18.000000000 +0200
++++ sks-1.0.5/common.src.ml 2003-12-03 10:22:56.000000000 +0100
+@@ -80,14 +80,12 @@
+ (**************************************************************************)
+
+ let set_logfile extension =
+- match !Settings.logfile with
+- | None -> ()
+- | Some fname ->
+- let fname = (Filename.concat !Settings.basedir fname) ^ extension in
+- stored_logfile_name := Some fname;
+- logfile := open_out_gen [ Open_wronly; Open_creat; Open_append; ]
+- 0o600 fname;
+- ignore (plerror 0 "Opening log")
++ if !Settings.filelog then
++ let fname = (Filename.concat !Settings.basedir "log") ^ extension in
++ stored_logfile_name := Some fname;
++ logfile := open_out_gen [ Open_wronly; Open_creat; Open_append; ]
++ 0o600 fname;
++ ignore (plerror 0 "Opening log")
+
+ let reopen_logfile () =
+ match !stored_logfile_name with
+diff -Nardu sks-1.0.5-old/Makefile sks-1.0.5/Makefile
+--- sks-1.0.5-old/Makefile 2003-11-29 14:38:17.000000000 +0100
++++ sks-1.0.5/Makefile 2003-12-03 10:23:35.000000000 +0100
+@@ -379,6 +379,7 @@
+ rm -f $(ALL) $(ALL.bc)
+
+ clean: mlclean
++ rm -f common.ml
+ rm -f *.o
+ rm -f prepared
+
More information about the Pkg-sks-commit
mailing list