From 281c774afd2e7201935f6e2e26b4566c9d1633e1 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Dec 08 2020 21:39:00 +0000 Subject: Version 2.2 - Add -pervasives and -no-curl patches - Use local Unicode tables instead of downloading - Build documentation with odoc - Add a %check script --- diff --git a/.gitignore b/.gitignore index 44818f0..0d285d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/ocaml-sedlex-1.99.4.tar.gz -/ocaml-sedlex-2.1.tar.gz +/ocaml-sedlex-*.tar.gz diff --git a/ocaml-sedlex-no-curl.patch b/ocaml-sedlex-no-curl.patch new file mode 100644 index 0000000..9dd80f9 --- /dev/null +++ b/ocaml-sedlex-no-curl.patch @@ -0,0 +1,20 @@ +--- sedlex-2.2/src/generator/data/dune.orig 2020-02-08 14:55:37.000000000 -0700 ++++ sedlex-2.2/src/generator/data/dune 2020-06-18 09:51:50.348134755 -0600 +@@ -1,14 +1,11 @@ + (rule + (targets DerivedCoreProperties.txt) +- (deps base_url) +- (action (run curl -L -s %{read:base_url}/ucd/DerivedCoreProperties.txt -o DerivedCoreProperties.txt))) ++ (action (copy /usr/share/unicode/ucd/DerivedCoreProperties.txt DerivedCoreProperties.txt))) + + (rule + (targets DerivedGeneralCategory.txt) +- (deps base_url) +- (action (run curl -L -s %{read:base_url}/ucd/extracted/DerivedGeneralCategory.txt -o DerivedGeneralCategory.txt))) ++ (action (copy /usr/share/unicode/ucd/extracted/DerivedGeneralCategory.txt DerivedGeneralCategory.txt))) + + (rule + (targets PropList.txt) +- (deps base_url) +- (action (run curl -L -s %{read:base_url}/ucd/PropList.txt -o PropList.txt))) ++ (action (copy /usr/share/unicode/ucd/PropList.txt PropList.txt))) diff --git a/ocaml-sedlex-pervasives.patch b/ocaml-sedlex-pervasives.patch new file mode 100644 index 0000000..ef1c166 --- /dev/null +++ b/ocaml-sedlex-pervasives.patch @@ -0,0 +1,19 @@ +--- sedlex-2.2/src/generator/gen_unicode.ml.inc.orig 2020-02-08 14:55:37.000000000 -0700 ++++ sedlex-2.2/src/generator/gen_unicode.ml.inc 2020-06-17 21:22:50.269177776 -0600 +@@ -77,14 +77,14 @@ let split list n = + + let print_elements ch hashtbl = + let cats = +- List.sort_uniq Pervasives.compare ++ List.sort_uniq Stdlib.compare + (Hashtbl.fold (fun cat _ l -> cat::l) hashtbl []) + in + let len = List.length cats in + List.iter (fun c -> + let entries = + List.map (fun (b,e) -> Printf.sprintf "0x%x, 0x%x" b e) +- (List.sort_uniq Pervasives.compare ++ (List.sort_uniq Stdlib.compare + (Hashtbl.find_all hashtbl c)) + in + let entries = diff --git a/ocaml-sedlex.spec b/ocaml-sedlex.spec index fecc694..7b8cb6c 100644 --- a/ocaml-sedlex.spec +++ b/ocaml-sedlex.spec @@ -1,20 +1,25 @@ Name: ocaml-sedlex -Version: 2.1 -Release: 12%{?dist} +Version: 2.2 +Release: 1%{?dist} Summary: Unicode-friendly lexer generator License: MIT URL: https://github.com/ocaml-community/sedlex Source0: https://github.com/ocaml-community/sedlex/archive/v%{version}/%{name}-%{version}.tar.gz +# Use Stdlib instead of Pervasives due to changes in recent OCaml versions +Patch0: %{name}-pervasives.patch + +# Use local Unicode files instead of attempting to download them +Patch1: %{name}-no-curl.patch + BuildRequires: ocaml -BuildRequires: ocaml-findlib BuildRequires: ocaml-dune -BuildRequires: ocaml-result-devel +BuildRequires: ocaml-odoc BuildRequires: ocaml-migrate-parsetree-devel -BuildRequires: ocaml-ppx-derivers-devel BuildRequires: ocaml-ppx-tools-versioned-devel BuildRequires: ocaml-gen-devel +BuildRequires: unicode-ucd %description A lexer generator for OCaml, similar to ocamllex, but supporting Unicode. @@ -25,6 +30,9 @@ regular OCaml source files. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: ocaml-migrate-parsetree-devel%{?_isa} +Requires: ocaml-ppx-tools-versioned-devel%{?_isa} +Requires: ocaml-gen-devel%{?_isa} %description devel @@ -33,10 +41,18 @@ files for developing applications that use %{name}. %prep -%setup -q -n sedlex-%{version} +%autosetup -p1 -n sedlex-%{version} + +# Upstream's regression test is written for Unicode 6.3.0 through 12.1.0. Our +# Unicode files are from a more recent version of the standard. The test has a +# good chance of succeeding anyway, so we cross our fingers and give it a try. +# If the regression test fails, we'll have to try another approach. +univer=$(sed -n 's/.*PropList-\([.[:digit:]]*\)\.txt/\1/p' %{_datadir}/unicode/ucd/PropList.txt) +sed -i "s/12\\.1\\.0/$univer/" examples/regressions.ml %build -dune build -p sedlex --verbose +dune build %{?_smp_mflags} -p sedlex --verbose +dune build %{?_smp_mflags} @doc %install dune install --destdir="$RPM_BUILD_ROOT" --verbose @@ -52,6 +68,11 @@ sed -i 's/uchar//g' $RPM_BUILD_ROOT%{_libdir}/ocaml/sedlex/META sed -i 's/uchar//g' $RPM_BUILD_ROOT%{_libdir}/ocaml/sedlex/dune-package sed -i 's/"uchar"//g' $RPM_BUILD_ROOT%{_libdir}/ocaml/sedlex/opam + +%check +dune runtest + + %files %doc README.md CHANGES %license LICENSE @@ -74,6 +95,13 @@ sed -i 's/"uchar"//g' $RPM_BUILD_ROOT%{_libdir}/ocaml/sedlex/opam %changelog +* Mon Dec 7 2020 Jerry James - 2.2-1 +- Version 2.2 +- Add -pervasives and -no-curl patches +- Use local Unicode tables instead of downloading +- Build documentation with odoc +- Add a %%check script + * Tue Sep 01 2020 Richard W.M. Jones - 2.1-12 - OCaml 4.11.1 rebuild diff --git a/sources b/sources index 801e60b..fb57e2b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-sedlex-2.1.tar.gz) = df379c0b9db396cec454d1ac151f8bfc597d26447f30220f87b0d919be541d44dce56c932a6573d066395932f5d59e429922a0b44c8f853e3954faf1893856eb +SHA512 (ocaml-sedlex-2.2.tar.gz) = c38940654d8d2a4b8f627bc9109b0fd983c520d8db05bf4b514ddc05cf50946c086d3558dfced64cc8f2b4eaabc6155426eb44ee6d903e3520ebb65daadf990a