From d20570a9bc1a918cd137a1736d29c1c5f21fbf1e Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Tue, 17 Nov 2020 17:57:51 +0100 Subject: [PATCH 1/9] opamfile: fix some constraints & indent --- opam-file-format.opam | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/opam-file-format.opam b/opam-file-format.opam index 91b0705..cdbf14e 100644 --- a/opam-file-format.opam +++ b/opam-file-format.opam @@ -1,20 +1,28 @@ opam-version: "2.0" version: "2.1.1" +synopsis: "Parser and printer for the opam file syntax" maintainer: "Louis Gesbert " authors: "Louis Gesbert " homepage: "https://opam.ocaml.org" bug-reports: "/~https://github.com/ocaml/opam-file-format/issues" license: "LGPL-2.1-only with OCaml-LGPL-linking-exception" dev-repo: "git+/~https://github.com/ocaml/opam-file-format" -build: [ - [make "byte" {!ocaml-native} "all" {ocaml-native}] {!dune:installed} - ["dune" "build" "-p" name "-j" jobs "@install" "@doc" {with-doc}] {dune:installed} - ["dune" "runtest" "-p" name "-j" jobs] {with-test & dune:installed} -] -depopts: "dune" { > "1.11.4" } -install: [make "install" "PREFIX=%{prefix}%"] {!dune:installed} -synopsis: "Parser and printer for the opam file syntax" depends: [ "ocaml" "alcotest" {with-test} ] +depopts: "dune" { > "2.0.0" } +build: [ + [ make + "byte" {!ocaml-native} + "all" {ocaml-native} ] + {!dune:installed | dune:version <= "2.0.0"} + [ "dune" "build" "-p" name "-j" jobs "@install" + "@doc" {with-doc} ] + {dune:installed & dune:version > "2.0.0"} + [ "dune" "runtest" "-p" name "-j" jobs ] + {with-test & dune:installed & dune:version > "2.0.0"} +] +install: + [ make "install" "PREFIX=%{prefix}%" ] + {!dune:installed | dune:version <= "2.0.0"} From ebae0493753ea4fff27b8766ea4bdd8f4f38ea13 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 18 Nov 2020 00:35:40 +0100 Subject: [PATCH 2/9] test: fix position test --- tests/fullpos.ml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/fullpos.ml b/tests/fullpos.ml index 75961b3..d20f7e9 100644 --- a/tests/fullpos.ml +++ b/tests/fullpos.ml @@ -423,6 +423,15 @@ module Opamfile = struct in A.testable opamfile_fmt opamfile_equals + let ofile_pos_testable = + let opamfile_fmt : opamfile Fmt.t = fun ppf f -> + Format.fprintf ppf "%s" (OpamPrinter.FullPos.opamfile f) + in + let opamfile_equals o1 o2 = + o1.file_contents = o2.file_contents + in + A.testable opamfile_fmt opamfile_equals + let test_printer t () = List.iter (fun (name, str, ofile) -> A.check A.string name str (print_ofile ofile)) @@ -470,7 +479,7 @@ module Opamfile = struct Some { pos = spos (4, 8) (4, 15); pelem = "thing" }; section_items = - { pos = spos (4, 8) (5, 29); + { pos = spos (4, 16) (6, 1); pelem = [{ pos = spos (5, 2) (5, 29); pelem = @@ -485,7 +494,7 @@ module Opamfile = struct ]; in let content = {file_contents; file_name = filename} in - A.check ofile_testable "sample" content (OpamParser.FullPos.file filename) + A.check ofile_pos_testable "sample" content (OpamParser.FullPos.file filename) let tests = [ From 20a05a61d41b94c532adf06954f8e5dfe1f4aef1 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 18 Nov 2020 00:35:58 +0100 Subject: [PATCH 3/9] parser: fix named section positions --- src/opamBaseParser.mly | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opamBaseParser.mly b/src/opamBaseParser.mly index 73d4304..24fc74f 100644 --- a/src/opamBaseParser.mly +++ b/src/opamBaseParser.mly @@ -93,7 +93,7 @@ item: Section ({section_kind = { pos = get_pos 1; pelem = $1 }; section_name = Some { pos = get_pos 2; pelem = $2 }; section_items = - { pos = get_pos_full ~s:2 4; pelem = $4 }; + { pos = get_pos_full ~s:3 5; pelem = $4 }; }) } } From e08680b75bd7aa4887db7d225d4fd7bdd1eacba2 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 18 Nov 2020 00:36:25 +0100 Subject: [PATCH 4/9] dune: add dev warn-off --- src/dune | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dune b/src/dune index 508e8d1..b3065d0 100644 --- a/src/dune +++ b/src/dune @@ -16,3 +16,6 @@ (ocamlyacc opamBaseParser) (ocamllex opamLexer) + +(env (dev + (flags (:standard -warn-error -A)))) From ddd39caf473d45655d4bdc2af0da716491f78438 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 18 Nov 2020 00:47:06 +0100 Subject: [PATCH 5/9] update 2.1.1 changes --- CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index f9b71ad..fb55f8c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +2.1.1 [17 Nov 2020] +* New types with more complete positions [#24 @rjbou] +* Deprecation of all old functions [#24 @rjbou] +* Add tests [#28 @rjbou] + 2.1.0 [26 Aug 2020] * Don't add a newline at the start of strings with newlines [#18 @dra27] * Report starting position of strings correctly [#19 @rjbou] From 727ad587ea4dbeab48e0ccb6c8505064efca2258 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 18 Nov 2020 00:48:32 +0100 Subject: [PATCH 6/9] update changes --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index fb55f8c..d82e097 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2.1.2 [???] +* Fix named section position [#31 @rjbou] + 2.1.1 [17 Nov 2020] * New types with more complete positions [#24 @rjbou] * Deprecation of all old functions [#24 @rjbou] From 0b636a157130af9b547393635f2ccc39aba13964 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 18 Nov 2020 11:43:24 +0100 Subject: [PATCH 7/9] Bump to 2.1.2 --- opam-file-format.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opam-file-format.opam b/opam-file-format.opam index cdbf14e..4e56f8d 100644 --- a/opam-file-format.opam +++ b/opam-file-format.opam @@ -1,5 +1,5 @@ opam-version: "2.0" -version: "2.1.1" +version: "2.1.2" synopsis: "Parser and printer for the opam file syntax" maintainer: "Louis Gesbert " authors: "Louis Gesbert " From 91fe3d64ded32180716ffda9791ae27dcf3d3cee Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 20 Nov 2020 19:24:09 +0100 Subject: [PATCH 8/9] opam file: fix undefined variable --- opam-file-format.opam | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opam-file-format.opam b/opam-file-format.opam index 4e56f8d..d6070d3 100644 --- a/opam-file-format.opam +++ b/opam-file-format.opam @@ -14,8 +14,8 @@ depends: [ depopts: "dune" { > "2.0.0" } build: [ [ make - "byte" {!ocaml-native} - "all" {ocaml-native} ] + "byte" {!ocaml:native} + "all" {ocaml:native} ] {!dune:installed | dune:version <= "2.0.0"} [ "dune" "build" "-p" name "-j" jobs "@install" "@doc" {with-doc} ] From 582d269b6d12013b0680ac42bc813fb4ce86a3da Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Tue, 24 Nov 2020 16:34:07 +0100 Subject: [PATCH 9/9] tests: remove pkg from tests dune --- tests/dune | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/dune b/tests/dune index bb7cc33..cbf5ae2 100644 --- a/tests/dune +++ b/tests/dune @@ -1,5 +1,4 @@ (test (name tests) (deps sample.opam) - (package opam-file-format) (libraries alcotest opam-file-format))