The package rpms/ocaml-cil.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/ocaml-cil.git/commit/?id=877a4906....
Change:
+%ifarch %{ocaml_native_compiler}
Thanks.
Full change:
============
commit 877a4906d4e5b89439ea0585be7dd8c32316d2e1
Author: Richard W.M. Jones <rjones(a)redhat.com>
Date: Wed Nov 22 15:00:05 2017 +0000
OCaml 4.06.0 rebuild.
Fixes for -safe-string.
Stop using opt macro.
Enable debuginfo on all architectures.
diff --git a/cil-1.7.3-safe-string.patch b/cil-1.7.3-safe-string.patch
new file mode 100644
index 0000000..e1d3e70
--- /dev/null
+++ b/cil-1.7.3-safe-string.patch
@@ -0,0 +1,120 @@
+diff -ur cil-1.7.3.old/ocamlutil/errormsg.ml cil-1.7.3/ocamlutil/errormsg.ml
+--- cil-1.7.3.old/ocamlutil/errormsg.ml 2013-07-24 16:07:11.000000000 +0100
++++ cil-1.7.3/ocamlutil/errormsg.ml 2017-11-22 14:55:09.549734942 +0000
+@@ -210,23 +210,24 @@
+ let str1 =
+ if str <> "" && String.get str 0 = '"' (*
'"' ( *)
+ then rem_quotes str else str in
+- let l = String.length str1 in
++ let str1 = Bytes.of_string str1 in
++ let l = Bytes.length str1 in
+ let rec loop (copyto: int) (i: int) =
+ if i >= l then
+- String.sub str1 0 copyto
++ Bytes.sub str1 0 copyto
+ else
+- let c = String.get str1 i in
++ let c = Bytes.get str1 i in
+ if c <> '\\' then begin
+- String.set str1 copyto c; loop (copyto + 1) (i + 1)
++ Bytes.set str1 copyto c; loop (copyto + 1) (i + 1)
+ end else begin
+- String.set str1 copyto '/';
+- if i < l - 2 && String.get str1 (i + 1) = '\\' then
++ Bytes.set str1 copyto '/';
++ if i < l - 2 && Bytes.get str1 (i + 1) = '\\' then
+ loop (copyto + 1) (i + 2)
+ else
+ loop (copyto + 1) (i + 1)
+ end
+ in
+- loop 0 0
++ Bytes.to_string (loop 0 0)
+
+ let readingFromStdin = ref false
+
+diff -ur cil-1.7.3.old/ocamlutil/pretty.ml cil-1.7.3/ocamlutil/pretty.ml
+--- cil-1.7.3.old/ocamlutil/pretty.ml 2017-11-22 13:17:54.112327112 +0000
++++ cil-1.7.3/ocamlutil/pretty.ml 2017-11-22 14:56:24.658729757 +0000
+@@ -725,8 +725,9 @@
+ invalid_arg ("dprintf: unimplemented format "
+ ^ (String.sub format i (j-i+1)));
+ let j' = succ j in (* eat the d,i,x etc. *)
+- let format_spec = "% " in
+- String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
++ let format_spec = Bytes.of_string "% " in
++ Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
++ let format_spec = Bytes.to_string format_spec in
+ Obj.magic(fun n ->
+ collect (dctext1 acc
+ (Int64.format format_spec n))
+@@ -735,8 +736,9 @@
+ if j != i + 1 then invalid_arg ("dprintf: unimplemented format "
+ ^ (String.sub format i (j-i+1)));
+ let j' = succ j in (* eat the d,i,x etc. *)
+- let format_spec = "% " in
+- String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
++ let format_spec = Bytes.of_string "% " in
++ Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
++ let format_spec = Bytes.to_string format_spec in
+ Obj.magic(fun n ->
+ collect (dctext1 acc
+ (Int32.format format_spec n))
+@@ -745,8 +747,9 @@
+ if j != i + 1 then invalid_arg ("dprintf: unimplemented format "
+ ^ (String.sub format i (j-i+1)));
+ let j' = succ j in (* eat the d,i,x etc. *)
+- let format_spec = "% " in
+- String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
++ let format_spec = Bytes.of_string "% " in
++ Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
++ let format_spec = Bytes.to_string format_spec in
+ Obj.magic(fun n ->
+ collect (dctext1 acc
+ (Nativeint.format format_spec n))
+diff -ur cil-1.7.3.old/src/cil.ml cil-1.7.3/src/cil.ml
+--- cil-1.7.3.old/src/cil.ml 2013-07-24 16:07:11.000000000 +0100
++++ cil-1.7.3/src/cil.ml 2017-11-22 14:53:42.922740924 +0000
+@@ -5033,19 +5033,19 @@
+ (* Take the name of a file and make a valid symbol name out of it. There are
+ * a few characters that are not valid in symbols *)
+ let makeValidSymbolName (s: string) =
+- let s = String.copy s in (* So that we can update in place *)
+- let l = String.length s in
++ let s = Bytes.of_string s in (* So that we can update in place *)
++ let l = Bytes.length s in
+ for i = 0 to l - 1 do
+- let c = String.get s i in
++ let c = Bytes.get s i in
+ let isinvalid =
+ match c with
+ '-' | '.' -> true
+ | _ -> false
+ in
+ if isinvalid then
+- String.set s i '_';
++ Bytes.set s i '_';
+ done;
+- s
++ Bytes.to_string s
+
+ let rec addOffset (toadd: offset) (off: offset) : offset =
+ match off with
+diff -ur cil-1.7.3.old/src/formatlex.mll cil-1.7.3/src/formatlex.mll
+--- cil-1.7.3.old/src/formatlex.mll 2013-07-24 16:07:11.000000000 +0100
++++ cil-1.7.3/src/formatlex.mll 2017-11-22 14:52:59.217743941 +0000
+@@ -145,11 +145,11 @@
+ * We convert L"Hi" to "H\000i\000" *)
+ let wbtowc wstr =
+ let len = String.length wstr in
+- let dest = String.make (len * 2) '\000' in
++ let dest = Bytes.make (len * 2) '\000' in
+ for i = 0 to len-1 do
+- dest.[i*2] <- wstr.[i] ;
++ Bytes.set dest (i*2) wstr.[i] ;
+ done ;
+- dest
++ Bytes.to_string dest
+
+ (* This function converst the "Hi" in L"Hi" to { L'H',
L'i', L'\0' } *)
+ let wstr_to_warray wstr =
diff --git a/ocaml-cil.spec b/ocaml-cil.spec
index 4ce5e33..1ae6cf0 100644
--- a/ocaml-cil.spec
+++ b/ocaml-cil.spec
@@ -1,8 +1,3 @@
-%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
-%if ! %opt
-%global debug_package %{nil}
-%endif
-
Name: ocaml-cil
Version: 1.7.3
Release: 39%{?dist}
@@ -41,6 +36,9 @@ Patch6: cil-1.7.3-gcc-7.patch
# Fix unescaped left brace in regex
Patch7: cil-1.7.3-Fix-unescaped-left-brace-in-regex.patch
+# Fixes for -safe-string in OCaml 4.06.
+Patch8: cil-1.7.3-safe-string.patch
+
%description
CIL (C Intermediate Language) is a high-level representation along
with a set of tools that permit easy analysis and source-to-source
@@ -124,11 +122,12 @@ for gcc.
%patch2 -p1
%patch3 -p1
%patch4 -p1
-%if !%opt
+%ifnarch %{ocaml_native_compiler}
%patch5 -p1
%endif
%patch6 -p1
%patch7 -p1
+%patch8 -p1
%build
@@ -174,7 +173,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%doc README.md LICENSE
%{_libdir}/ocaml/cil
-%if %opt
+%ifarch %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/cil/*.a
%exclude %{_libdir}/ocaml/cil/*.cmxa
%exclude %{_libdir}/ocaml/cil/*.cmx
@@ -184,7 +183,7 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%doc README.md LICENSE
-%if %opt
+%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/cil/*.a
%{_libdir}/ocaml/cil/*.cmxa
%{_libdir}/ocaml/cil/*.cmx
@@ -204,8 +203,11 @@ rm -rf $RPM_BUILD_ROOT
%changelog
-* Fri Nov 17 2017 Richard W.M. Jones <rjones(a)redhat.com> - 1.7.3-39
+* Wed Nov 22 2017 Richard W.M. Jones <rjones(a)redhat.com> - 1.7.3-39
- OCaml 4.06.0 rebuild.
+- Fixes for -safe-string.
+- Stop using opt macro.
+- Enable debuginfo on all architectures.
* Tue Aug 08 2017 Richard W.M. Jones <rjones(a)redhat.com> - 1.7.3-38
- OCaml 4.05.0 rebuild.