tags 361583 + patch
kthxbye

On Sun, Apr  9, 2006 at 09:08:27 +0200, Martin Michlmayr wrote:

> Package: ocamlgsl
> Version: 0.4.0-4
> Severity: serious
> 
> Your package fails to build due to a change in unstable in the last
> few days:
> 
> > Automatic build of ocamlgsl_0.4.0-4 on em64t by sbuild/amd64 1.112
> ...
> > ocamlc -ccopt ' -DHAVE_INLINE -DHAVE_FENV -g -O2 ' -c mlgsl_cdf.c
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_binomial_P':
> > mlgsl_cdf.c:153: error: too few arguments to function 'gsl_cdf_binomial_P'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_binomial_Q':
> > mlgsl_cdf.c:155: error: too few arguments to function 'gsl_cdf_binomial_Q'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_poisson_P':
> > mlgsl_cdf.c:157: error: too few arguments to function 'gsl_cdf_poisson_P'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_poisson_Q':
> > mlgsl_cdf.c:159: error: too few arguments to function 'gsl_cdf_poisson_Q'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_geometric_P':
> > mlgsl_cdf.c:161: error: too few arguments to function 'gsl_cdf_geometric_P'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_geometric_Q':
> > mlgsl_cdf.c:163: error: too few arguments to function 'gsl_cdf_geometric_Q'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_negative_binomial_P':
> > mlgsl_cdf.c:165: error: too few arguments to function 
> > 'gsl_cdf_negative_binomial_P'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_negative_binomial_Q':
> > mlgsl_cdf.c:167: error: too few arguments to function 
> > 'gsl_cdf_negative_binomial_Q'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_pascal_P':
> > mlgsl_cdf.c:169: error: too few arguments to function 'gsl_cdf_pascal_P'
> > mlgsl_cdf.c: In function 'ml_gsl_cdf_pascal_Q':
> > mlgsl_cdf.c:171: error: too few arguments to function 'gsl_cdf_pascal_Q'
> > make[1]: *** [mlgsl_cdf.o] Error 2
> > make[1]: Leaving directory `/build/tbm/ocamlgsl-0.4.0'

Hi,

the problem here is that the do_cdf program (which generates mlgsl_cdf.c
by parsing /usr/include/gsl/gsl_cdf.h) only handles functions with
"const double" arguments. The functions listed above have one or more
"const unsigned int" arguments, which are ignored by do_cdf, hence the
"too few arguments" errors.
The attached patch fixes this by teaching do_cdf.ml about "const
unsigned int".

Cheers,
Julien Cristau
diff -u ocamlgsl-0.4.0/debian/patches/00list 
ocamlgsl-0.4.0/debian/patches/00list
--- ocamlgsl-0.4.0/debian/patches/00list
+++ ocamlgsl-0.4.0/debian/patches/00list
@@ -3 +3 @@
-
+cdf_handle_int_arguments
diff -u ocamlgsl-0.4.0/debian/changelog ocamlgsl-0.4.0/debian/changelog
--- ocamlgsl-0.4.0/debian/changelog
+++ ocamlgsl-0.4.0/debian/changelog
@@ -1,3 +1,11 @@
+ocamlgsl (0.4.0-4.1) unstable; urgency=low
+
+  * Non-maintainer upload to fix FTBFS.
+  * Patch do_cdf.ml to handle functions with "const unsigned int" arguments
+    (Closes: #361583).
+
+ -- Julien Cristau <[EMAIL PROTECTED]>  Fri, 21 Apr 2006 02:56:45 +0200
+
 ocamlgsl (0.4.0-4) unstable; urgency=low
 
   * Rebuild for OCaml 3.09.1
only in patch2:
unchanged:
--- ocamlgsl-0.4.0.orig/debian/patches/cdf_handle_int_arguments.dpatch
+++ ocamlgsl-0.4.0/debian/patches/cdf_handle_int_arguments.dpatch
@@ -0,0 +1,63 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## cdf_handle_int_arguments.dpatch by  <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: gsl_cdf.h contains functions with const unsigned int arguments, so we 
+## DP: can handle them as well as const double.
+
[EMAIL PROTECTED]@
+
+--- ocamlgsl-0.4.0.orig/do_cdf.ml      2005-01-05 00:05:03.000000000 +0100
++++ ocamlgsl-0.4.0/do_cdf.ml   2006-04-21 03:00:13.000000000 +0200
+@@ -1,7 +1,10 @@
++type arg_type = Double of string | Int of string
+ 
+ let parse = 
+   let regexp_full = Str.regexp "double gsl_cdf_\\([^ ]+\\) (\\([^)]+\\));" in
+-  let regexp_arg  = Str.regexp "const double \\([a-zA-Z0-9_]+\\)" in
++  let regexp_arg = Str.regexp "const" in
++  let regexp_double  = Str.regexp "const double \\([a-zA-Z0-9_]+\\)" in
++  let regexp_uint = Str.regexp "const unsigned int \\([a-zA-z0-9_]+\\)" in
+   fun s ->
+     if Str.string_match regexp_full s 0
+     then
+@@ -11,8 +14,11 @@
+         let acc = ref [] in
+         let i = ref (Str.group_beginning 2) in
+         begin try while true do
+-          let _ = Str.search_forward regexp_arg s !i in
+-          acc := (Str.matched_group 1 s) :: !acc ;
++          let j = Str.search_forward regexp_arg s !i in
++            if Str.string_match regexp_double s j then
++              acc := (Double (Str.matched_group 1 s)) :: !acc
++            else if Str.string_match regexp_uint s j then
++              acc := (Int (Str.matched_group 1 s)) :: !acc;
+           i := Str.match_end ()
+         done
+         with Not_found -> () end ;
+@@ -26,14 +32,23 @@
+   | None -> ()
+   | Some v -> f v
+ 
++                
++let trans_ml = function
++    Double s -> (String.lowercase s) ^ ":float"
++  | Int s -> (String.lowercase s) ^ ":int"
++
++let trans_c = function
++    Double _ -> print_string "Double_val, "
++  | Int _ -> print_string "Int_val, "
++                
+ let print_ml (fun_name, args) =
+   Printf.printf "external %s : " fun_name ;
+-  List.iter (fun arg -> Printf.printf "%s:float -> " (String.lowercase arg)) 
args ;
++  List.iter (fun arg -> Printf.printf "%s -> " (trans_ml arg)) args ;
+   Printf.printf "float = \"ml_gsl_cdf_%s\" \"gsl_cdf_%s\" \"float\"\n" 
fun_name fun_name
+ 
+ let print_c (fun_name, args) =
+   Printf.printf "ML%d(gsl_cdf_%s, " (List.length args) fun_name ;
+-  List.iter (fun arg -> print_string "Double_val, ") args ;
++  List.iter trans_c args ;
+   print_string "copy_double)\n" ;
+   print_newline ()
+ 

Attachment: signature.asc
Description: Digital signature

Reply via email to