From 4d99cabf5ce8b5e16bc06e0c82ff616610a56d63 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Wed, 15 Mar 2023 21:48:30 +0300 Subject: [PATCH] import ocaml-csexp-1.3.2-6.el9 --- .gitignore | 1 + .ocaml-csexp.metadata | 1 + SOURCES/ocaml-csexp-result.patch | 92 ++++++++++++++ SPECS/ocaml-csexp.spec | 199 +++++++++++++++++++++++++++++++ 4 files changed, 293 insertions(+) create mode 100644 .gitignore create mode 100644 .ocaml-csexp.metadata create mode 100644 SOURCES/ocaml-csexp-result.patch create mode 100644 SPECS/ocaml-csexp.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a84d44a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/csexp-1.3.2.tbz diff --git a/.ocaml-csexp.metadata b/.ocaml-csexp.metadata new file mode 100644 index 0000000..eaf99ca --- /dev/null +++ b/.ocaml-csexp.metadata @@ -0,0 +1 @@ +93e67a869a9f11fed99d28e99f7c274f22911a82 SOURCES/csexp-1.3.2.tbz diff --git a/SOURCES/ocaml-csexp-result.patch b/SOURCES/ocaml-csexp-result.patch new file mode 100644 index 0000000..0f4f846 --- /dev/null +++ b/SOURCES/ocaml-csexp-result.patch @@ -0,0 +1,92 @@ +--- a/csexp.opam ++++ b/csexp.opam +@@ -32,7 +32,6 @@ bug-reports: "https://github.com/ocaml-d + depends: [ + "dune" {>= "1.11"} + "ocaml" {>= "4.02.3"} +- "result" {>= "1.5"} + ] + dev-repo: "git+https://github.com/ocaml-dune/csexp.git" + build: [ +--- a/src/csexp.ml ++++ b/src/csexp.ml +@@ -15,12 +15,6 @@ end + module Make (Sexp : Sexp) = struct + open Sexp + +- (* This is to keep compatibility with 4.02 without writing [Result.] +- everywhere *) +- type ('a, 'b) result = ('a, 'b) Result.result = +- | Ok of 'a +- | Error of 'b +- + module Parser = struct + exception Parse_error of string + +@@ -283,9 +277,9 @@ module Make (Sexp : Sexp) = struct + + module Monad : Monad + +- val read_string : t -> int -> (string, string) Result.t Monad.t ++ val read_string : t -> int -> (string, string) result Monad.t + +- val read_char : t -> (char, string) Result.t Monad.t ++ val read_char : t -> (char, string) result Monad.t + end + + module Make_parser (Input : Input) = struct +--- a/src/csexp.mli ++++ b/src/csexp.mli +@@ -33,24 +33,24 @@ module Make (Sexp : Sexp) : sig + [s]. It is an error for [s] to contain a S-expression followed by more + data. In case of error, the offset of the error as well as an error + message is returned. *) +- val parse_string : string -> (Sexp.t, int * string) Result.t ++ val parse_string : string -> (Sexp.t, int * string) result + + (** [parse_string s] parses a sequence of S-expressions encoded in canonical + form in [s] *) +- val parse_string_many : string -> (Sexp.t list, int * string) Result.t ++ val parse_string_many : string -> (Sexp.t list, int * string) result + + (** Read exactly one canonical S-expressions from the given channel. Note that + this function never raises [End_of_file]. Instead, it returns [Error]. *) +- val input : in_channel -> (Sexp.t, string) Result.t ++ val input : in_channel -> (Sexp.t, string) result + + (** Same as [input] but returns [Ok None] if the end of file has already been + reached. If some more characters are available but the end of file is + reached before reading a complete S-expression, this function returns + [Error]. *) +- val input_opt : in_channel -> (Sexp.t option, string) Result.t ++ val input_opt : in_channel -> (Sexp.t option, string) result + + (** Read many S-expressions until the end of input is reached. *) +- val input_many : in_channel -> (Sexp.t list, string) Result.t ++ val input_many : in_channel -> (Sexp.t list, string) result + + (** {2 Serialising} *) + +@@ -352,18 +352,18 @@ module Make (Sexp : Sexp) : sig + val bind : 'a t -> ('a -> 'b t) -> 'b t + end + +- val read_string : t -> int -> (string, string) Result.t Monad.t ++ val read_string : t -> int -> (string, string) result Monad.t + +- val read_char : t -> (char, string) Result.t Monad.t ++ val read_char : t -> (char, string) result Monad.t + end + [@@deprecated "Use Parser module instead"] + + [@@@warning "-3"] + + module Make_parser (Input : Input) : sig +- val parse : Input.t -> (Sexp.t, string) Result.t Input.Monad.t ++ val parse : Input.t -> (Sexp.t, string) result Input.Monad.t + +- val parse_many : Input.t -> (Sexp.t list, string) Result.t Input.Monad.t ++ val parse_many : Input.t -> (Sexp.t list, string) result Input.Monad.t + end + [@@deprecated "Use Parser module instead"] + end diff --git a/SPECS/ocaml-csexp.spec b/SPECS/ocaml-csexp.spec new file mode 100644 index 0000000..6a198df --- /dev/null +++ b/SPECS/ocaml-csexp.spec @@ -0,0 +1,199 @@ +%ifnarch %{ocaml_native_compiler} +%global debug_package %{nil} +%endif + +%global srcname csexp + +# This package is needed to build dune. To avoid circular dependencies, this +# package cannot depend on dune, or any package that depends on dune. +# Therefore, we: +# - hack up our own build, rather than using dune to do the build +# - bypass the need for ocaml-result (which requires dune to build) +# - skip tests, which require ppx_expect, which is built with dune +# - skip building documentation, which requires odoc, which is built with dune +# If you know what you are doing, build with dune anyway using this conditional. +%bcond_with dune + +Name: ocaml-%{srcname} +Version: 1.3.2 +Release: 6%{?dist} +Summary: Parsing and printing of S-expressions in canonical form + +License: MIT +URL: https://github.com/ocaml-dune/csexp +Source0: %{url}/releases/download/%{version}/%{srcname}-%{version}.tbz + +# Depend on Stdlib.Result instead of ocaml-result. See comment above. +# This patch is not appropriate for upstream, which needs to keep compatibility +# with older OCaml versions. +Patch0: %{name}-result.patch + +BuildRequires: ocaml >= 4.02.3 +%if %{with dune} +BuildRequires: ocaml-dune >= 1.11 +BuildRequires: ocaml-odoc +BuildRequires: ocaml-result-devel >= 1.5 +%endif + +%description +This project provides minimal support for parsing and printing +S-expressions in canonical form, which is a very simple and canonical +binary encoding of S-expressions. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +%if %{with dune} +Requires: ocaml-result-devel%{?_isa} +%endif + +%description devel +The %{name}-devel package contains libraries and signature files for +developing applications that use %{name}. + +%prep +%autosetup -N -n %{srcname}-%{version} +%if %{without dune} +%autopatch -p1 +%endif + +%build +%if %{with dune} +dune build %{?_smp_mflags} --display=verbose @install +dune build %{?_smp_mflags} @doc +%else +OFLAGS="-strict-sequence -strict-formats -short-paths -keep-locs -g -opaque" +OCFLAGS="$OFLAGS -bin-annot" +cd src +ocamlc $OCFLAGS -output-obj csexp.mli +ocamlc $OCFLAGS -a -o csexp.cma csexp.ml +%ifarch %{ocaml_native_compiler} +ocamlopt $OFLAGS -ccopt "%{optflags}" -cclib "$RPM_LD_FLAGS" -a \ + -o csexp.cmxa csexp.ml +ocamlopt $OFLAGS -ccopt "%{optflags}" -cclib "$RPM_LD_FLAGS" -shared \ + -o csexp.cmxs csexp.ml +%endif +cd - +%endif + +%install +%if %{with dune} +dune install --destdir=%{buildroot} + +# We do not want the dune markers +find _build/default/_doc/_html -name .dune-keep -delete + +# We do not want the ml files +find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete + +# We install the documentation with the doc macro +rm -fr %{buildroot}%{_prefix}/doc + +%ifarch %{ocaml_native_compiler} +# Add missing executable bits +find %{buildroot}%{_libdir}/ocaml -name \*.cmxs -exec chmod a+x {} \+ +%endif +%else +# Install without dune. See comment at the top. +mkdir -p %{buildroot}%{_libdir}/ocaml/%{srcname} +cp -p src/csexp.{cma,cmi,cmt,cmti,mli} %{buildroot}%{_libdir}/ocaml/%{srcname} +%ifarch %{ocaml_native_compiler} +cp -p src/csexp.{a,cmx,cmxa,cmxs} %{buildroot}%{_libdir}/ocaml/%{srcname} +%endif +cp -p csexp.opam %{buildroot}%{_libdir}/ocaml/%{srcname}/opam + +cat >> %{buildroot}%{_libdir}/ocaml/%{srcname}/META << EOF +version = "%{version}" +description = "Parsing and printing of S-expressions in canonical form" +archive(byte) = "csexp.cma" +%ifarch %{ocaml_native_compiler} +archive(native) = "csexp.cmxa" +%endif +plugin(byte) = "csexp.cma" +%ifarch %{ocaml_native_compiler} +plugin(native) = "csexp.cmxs" +%endif +EOF + +cat >> %{buildroot}%{_libdir}/ocaml/%{srcname}/dune-package << EOF +(lang dune 2.5) +(name csexp) +(version %{version}) +(library + (name csexp) + (kind normal) +%ifarch %{ocaml_native_compiler} + (archives (byte csexp.cma) (native csexp.cmxa)) + (plugins (byte csexp.cma) (native csexp.cmxs)) + (native_archives csexp.a) +%else + (archives (byte csexp.cma)) + (plugins (byte csexp.cma)) +%endif + (main_module_name Csexp) +%ifarch %{ocaml_native_compiler} + (modes byte native) +%else + (modes byte) +%endif + (modules + (singleton (name Csexp) (obj_name csexp) (visibility public) (impl) (intf)))) +EOF +%endif + +# Cannot do this until ocaml-ppx-expect is available in Fedora. +#%%if %%{with dune} +#%%check +#dune runtest +#%%endif + +%files +%doc README.md +%license LICENSE.md +%dir %{_libdir}/ocaml/%{srcname}/ +%{_libdir}/ocaml/%{srcname}/META +%{_libdir}/ocaml/%{srcname}/*.cma +%{_libdir}/ocaml/%{srcname}/*.cmi +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/*.cmxs +%endif + +%files devel +%{_libdir}/ocaml/%{srcname}/dune-package +%{_libdir}/ocaml/%{srcname}/opam +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/*.a +%{_libdir}/ocaml/%{srcname}/*.cmx +%{_libdir}/ocaml/%{srcname}/*.cmxa +%endif +%{_libdir}/ocaml/%{srcname}/*.cmt +%{_libdir}/ocaml/%{srcname}/*.cmti +%{_libdir}/ocaml/%{srcname}/*.mli + +%changelog +* Wed Mar 15 2023 MSVSphere Packaging Team - 1.3.2-6 +- Rebuilt for MSVSphere 9.1. + +* Fri Mar 11 2022 Richard W.M. Jones - 1.3.2-6 +- Rebuild for EPEL +resolves: rhbz#2060850 + +* Mon Aug 09 2021 Mohan Boddu - 1.3.2-5 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Wed Jun 23 2021 Richard W.M. Jones - 1.3.2-4 +- Bump and rebuild + resolves: rhbz#1975302 + +* Fri Apr 16 2021 Mohan Boddu - 1.3.2-3 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Tue Jan 26 2021 Fedora Release Engineering - 1.3.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Sep 18 2020 Jerry James - 1.3.2-1 +- Version 1.3.2 + +* Thu Sep 10 2020 Jerry James - 1.3.1-1 +- Initial RPM