diff --git a/lib/lint.ml b/lib/lint.ml index 7f328230..2ec80da3 100644 --- a/lib/lint.ml +++ b/lib/lint.ml @@ -42,27 +42,18 @@ module Check = struct let of_dir ~master ~job ~packages cwd = let master = Current_git.Commit.hash master in exec ~cwd ~job [|"git"; "merge"; "-q"; "--"; master|] >>/= fun () -> - let changed = + let package_args = packages |> List.filter_map (fun (pkg, change) -> - match change with - | Analyse.Analysis.(New Release | Unavailable | SignificantlyChanged | InsignificantlyChanged ) -> Some (OpamPackage.to_string pkg) - | _ -> None) - |> function - | [] -> [] - | changed -> ["--changed-packages"; String.concat "," changed ] + let pkg_str = OpamPackage.to_string pkg in + let new_arg = match change with + | Analyse.Analysis.(New Package) -> Some "true" + | Analyse.Analysis.(New Release | Unavailable | SignificantlyChanged | InsignificantlyChanged ) -> Some "false" + | Deleted -> None + in + Option.map (Printf.sprintf "%s:new=%s" pkg_str) new_arg) in - let new_ = - packages - |> List.filter_map (fun (pkg, change) -> - match change with - | Analyse.Analysis.(New Package) -> Some (OpamPackage.to_string pkg) - | _ -> None) - |> function - | [] -> [] - | new_ -> ["--newly-published"; String.concat "," new_ ] - in - let cmd = ["opam-ci-check"; "lint"; "--opam-repository"; "."] @ changed @ new_ in + let cmd = ["opam-ci-check"; "lint"; "--opam-repository"; "."] @ package_args in (* Show instructions to run locally *) let install_instructions = ["opam"; "pin"; "opam-ci-check"; "git+https://github.com/ocurrent/opam-repo-ci.git#live"] in Current.Job.write job diff --git a/opam-ci-check/bin/main.ml b/opam-ci-check/bin/main.ml index 1e40d940..8f696f38 100644 --- a/opam-ci-check/bin/main.ml +++ b/opam-ci-check/bin/main.ml @@ -8,6 +8,12 @@ module Distro = Dockerfile_opam.Distro let ( // ) = Filename.concat +(* [(let+)] is [Term.(const f $ v)] *) +let ( let+ ) t f = Term.(const f $ t) + +(* [(and+)] is [Term.(const (fun x y -> (x, y)) $ a $ b)] *) +let ( and+ ) a b = Term.(const (fun x y -> (x, y)) $ a $ b) + (* This is Cmdliner.Term.map, which is not available in Cmdliner 1.1.1 *) let map_term f x = Term.app (Term.const f) x @@ -49,24 +55,27 @@ let read_package_opam ~opam_repo_dir pkg = Printf.eprintf "Error in %s: Failed to parse the opam file due to '%s'" opam_path msg; exit 1 -let lint (changed_pkgs, new_pkgs) local_repo_dir = +type package_spec = { + pkg : OpamPackage.t; + src : string option; (* package source directory *) + newly_published : bool option; +} + +let lint package_specs local_repo_dir = match local_repo_dir with | None -> failwith "TODO: default to using the opam repository" | Some opam_repo_dir -> ( print_endline @@ Printf.sprintf "Linting opam-repository at %s ..." opam_repo_dir; - (* TODO: Allow providing package source directories from the CLI *) Dir_helpers.with_temp_dir "opam-ci-check-lint-" @@ fun dir -> - let process_package ~newly_published pkg_str = - let pkg = OpamPackage.of_string pkg_str in + let process_package { pkg; src; newly_published } = let opam = read_package_opam ~opam_repo_dir pkg in - let pkg_src_dir = fetch_package_src ~dir ~pkg opam in + let pkg_src_dir = + if Option.is_none src then fetch_package_src ~dir ~pkg opam else src + in Lint.v ~pkg ~newly_published ~pkg_src_dir opam in - let all_lint_packages = - List.map (process_package ~newly_published:(Some true)) new_pkgs - @ List.map (process_package ~newly_published:(Some false)) changed_pkgs - in + let all_lint_packages = List.map process_package package_specs in let errors = Lint.lint_packages ~opam_repo_dir all_lint_packages in match errors with | Ok [] -> @@ -188,35 +197,87 @@ let pkg_term = let info = Arg.info [] ~doc:"Package name + version" in Arg.required (Arg.pos 0 (Arg.some Arg.string) None info) -let changed_pkgs_term = - let info = - Arg.info - [ "c"; "changed-packages" ] - ~doc:"List of changed package name + version" +let split_on_first c s = + match String.split_on_char c s with + | [a] | [a; ""] -> Ok (a, None) + | [a; b] -> Ok (a, Some b) + | _ -> Error s + +let arg_with_optional_attrs_conv arg_conv attrs_conv = + let (let^) = Result.bind in + let conv s = + match split_on_first ':' s with + | Ok (a, None) -> + let^ x = Arg.conv_parser arg_conv a in + Ok (x, []) + | Ok (a, Some attrs) -> + let^ x = Arg.conv_parser arg_conv a in + let^ attrs = Arg.(conv_parser (list attrs_conv)) attrs in + Ok (x, attrs) + | Error invalid -> + Fmt.error_msg + "Invalid argument spec %s. Argument specs should be of the form arg[:k1=v1[,k2=v2]]" + invalid in - Arg.value (Arg.opt (Arg.list Arg.string) [] info) + let pp fmt (x, attrs) = + Fmt.pf fmt "%a[:%a]" + Arg.(conv_printer arg_conv) x + Arg.(conv_printer (list ~sep:',' attrs_conv)) attrs + in + Arg.conv ~docv:"ARG[:key=value[,key=value]]" (conv, pp) -let newly_published_pkgs_term = - let info = - Arg.info [ "n"; "newly-published" ] - ~doc:"List of newly published package name + version" +let package_specs_term = + let opam_file_conv = + let conv = Arg.parser_of_kind_of_string ~kind:"opam package spec in the form " OpamPackage.of_string_opt in + let pp = Fmt.of_to_string OpamPackage.to_string in + Arg.conv ~docv:"PACKAGE_SPEC" (conv, pp) + in + let attr_conv = + let parser s = + match split_on_first '=' s with + | Ok ("new", Some b) -> ( + match bool_of_string_opt b with + | Some bool -> Ok (`New bool) + | None -> Error (`Msg (b ^ " must be [true] or [false]")) + ) + | Ok ("src", Some dir) -> ( + match Sys.is_directory dir with + | true -> Ok (`Src dir) + | false -> Error (`Msg (dir ^ " is not a directory")) + | exception (Sys_error msg) -> Error (`Msg msg)) + | _ -> Error (`Msg (Printf.sprintf "%s is an not a valid attribute. Only [src=] or [new=] allowed" s) ) + in + let pp fmt v = + match v with + | `New b -> Fmt.pf fmt "new=%b" b + | `Src s -> Fmt.pf fmt "src=%s" s + in + Arg.conv ~docv:"ATTR" (parser, pp) in - Arg.value (Arg.opt (Arg.list Arg.string) [] info) - -let packages_term = - let create_term changed_pkgs newly_published_pkgs = - if changed_pkgs = [] && newly_published_pkgs = [] then - `Error - ( false, - "You must provide at least one changed or newly published package." ) - else `Ok (changed_pkgs, newly_published_pkgs) + let package_spec_conv = arg_with_optional_attrs_conv opam_file_conv attr_conv in - Term.(ret (const create_term $ changed_pkgs_term $ newly_published_pkgs_term)) + let info = + Arg.info [] + ~doc: + "List of package specifications (format: \ + [:src=][,new=]). If [src] is not \ + specified, the sources are downloaded from the source URL. If [new] \ + is not specified, it is inferred from the opam repository." + in + let+ pgk_spec_data = Arg.value (Arg.pos_all package_spec_conv [] info) in + pgk_spec_data |> + List.map (fun (pkg, specs) -> + let src = List.find_map (function `Src s -> Some s | _ -> None) specs in + let newly_published = List.find_map (function `New b -> Some b | _ -> None) specs in + {pkg; src; newly_published} + ) + let lint_cmd = let doc = "Lint the opam repository directory" in let term = - Term.(const lint $ packages_term $ local_opam_repo_term) |> to_exit_code + Term.(const lint $ package_specs_term $ local_opam_repo_term) + |> to_exit_code in let info = Cmd.info "lint" ~doc ~sdocs:"COMMON OPTIONS" ~exits:Cmd.Exit.defaults @@ -299,12 +360,6 @@ let compiler_conv = in Arg.conv ~docv:"COMPILER" (of_string, pp) -(* [(let+)] is [Term.(const f $ v)] *) -let ( let+ ) t f = Term.(const f $ t) - -(* [(and+)] is [Term.(const (fun x y -> (x, y)) $ a $ b)] *) -let ( and+ ) a b = Term.(const (fun x y -> (x, y)) $ a $ b) - let variant = let+ arch = let info = diff --git a/opam-ci-check/lib/lint.ml b/opam-ci-check/lib/lint.ml index c36e4250..f69ee61b 100644 --- a/opam-ci-check/lib/lint.ml +++ b/opam-ci-check/lib/lint.ml @@ -380,7 +380,10 @@ let v ~pkg ?(newly_published = None) ~pkg_src_dir opam = { pkg; newly_published; pkg_src_dir; opam } (** A package is considered newly published if the repository doesn't have any - other versions of the package, other than the current one.*) + other versions of the package, other than the current one. + + NOTE: If two versions of a package are published in the same PR, this + inference would fail to detect the package as new.*) let is_newly_published ~opam_repo_dir pkg = let pkg_name = OpamPackage.(pkg |> name |> Name.to_string) in let pkg_str = OpamPackage.to_string pkg in diff --git a/opam-ci-check/test/lint.t b/opam-ci-check/test/lint.t index 11963a07..9c52d378 100644 --- a/opam-ci-check/test/lint.t +++ b/opam-ci-check/test/lint.t @@ -1,24 +1,109 @@ -Setup test opam-repository directory +# Error handling of CLI parsing + +Test for an invalid package spec + + $ opam-ci-check lint -r . '=-~!:new=true' + opam-ci-check: invalid value '=-~!', expected opam package spec in the form + + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +Test for an invalid attributes + +Test for invalid attributes that are properly formed + + $ opam-ci-check lint -r . 'foo.0.1.0:bar=baz' + opam-ci-check: invalid element in list ('bar=baz'): bar=baz is an not a valid + attribute. Only [src=] or [new=] allowed + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +Test for an invalid values to a valid key + + $ opam-ci-check lint -r . 'foo.0.1.0:new=invalid' + opam-ci-check: invalid element in list ('new=invalid'): invalid must be + [true] or [false] + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +Test for a missing value + + $ opam-ci-check lint -r . 'foo.0.1.0:src=' + opam-ci-check: invalid element in list ('src='): src= is an not a valid + attribute. Only [src=] or [new=] allowed + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +Test for a valid key with no value + + $ opam-ci-check lint -r . 'foo.0.1.0:src' + opam-ci-check: invalid element in list ('src'): src is an not a valid + attribute. Only [src=] or [new=] allowed + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +Test for `src` with a non-existent directory + + $ opam-ci-check lint -r . 'foo.0.1.0:src=./not/a/dir' + opam-ci-check: invalid element in list ('src=./not/a/dir'): ./not/a/dir: No + such file or directory + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +Test for invalid extra colons + + $ opam-ci-check lint -r . 'foo.0.1.0:bing-bong:bang' + opam-ci-check: Invalid argument spec foo.0.1.0:bing-bong:bang. Argument specs + should be of the form arg[:k1=v1[,k2=v2]] + Usage: opam-ci-check lint [--opam-repository=VAL] [OPTION]… [ARG]… + Try 'opam-ci-check lint --help' or 'opam-ci-check --help' for more information. + [124] + +# Setup test opam-repository directory $ sh "scripts/setup_repo.sh" $ git checkout -qb new-branch-1 +# Test linting + Tests linting of correctly formatted opam packages - $ git apply "patches/b-correct.patch" + $ git apply "patches/b.0.0.1-correct.patch" + $ echo "(lang dune 3.16)" > dune-project + $ sh "scripts/setup_sources.sh" b 0.0.1 dune-project + Created tarball b.0.0.1.tgz + Updated checksum for b.0.0.1.tgz in b.0.0.1's opam file + $ git add . + $ git commit -qm b.0.0.1-correct + $ opam-ci-check lint -r . b.0.0.1 # Lint b.0.0.1 (new package) with inference + Linting opam-repository at $TESTCASE_ROOT/. ... + No errors + $ git apply "patches/b.0.0.3-correct.patch" + $ sh "scripts/setup_sources.sh" b 0.0.3 dune-project + Created tarball b.0.0.3.tgz + Updated checksum for b.0.0.3.tgz in b.0.0.3's opam file $ git add . - $ git commit -qm b-correct + $ git commit -qm b.0.0.3-correct + $ opam-ci-check lint -r . b.0.0.3 # Lint b.0.0.3 (old package) with inference + Linting opam-repository at $TESTCASE_ROOT/. ... + No errors $ git log --graph --pretty=format:'%s%d' - * b-correct (HEAD -> new-branch-1) + * b.0.0.3-correct (HEAD -> new-branch-1) + * b.0.0.1-correct * a-1 (tag: initial-state, master) - $ opam-ci-check lint -r . -c a-1.0.0.2 + $ opam-ci-check lint -r . a-1.0.0.2:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.2: No package source directory provided. [1] - $ opam-ci-check lint -r . -c b.0.0.3 + $ opam-ci-check lint -r . b.0.0.3:new=false Linting opam-repository at $TESTCASE_ROOT/. ... - Error in b.0.0.3: No package source directory provided. - [1] + No errors Setup repo for incorrect b package tests @@ -59,20 +144,20 @@ Test the following: - [b.0.0.6] has a incorrectly formatted opam file - [b.0.0.7] has opam lint errors/warnings - $ opam-ci-check lint -r . -c b.0.0.1 + $ opam-ci-check lint -r . b.0.0.1:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in b.0.0.1: No package source directory provided. Error in b.0.0.1: warning 25: Missing field 'authors' Warning in b.0.0.1: The package has not replaced the following default, example tags: topics, project [1] - $ opam-ci-check lint -r . -c b.0.0.2 + $ opam-ci-check lint -r . b.0.0.2:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Warning in b.0.0.2: Dubious use of 'dune subst'. 'dune subst' should always only be called with {dev} (i.e. ["dune" "subst"] {dev}) If your opam file has been autogenerated by dune, you need to upgrade your dune-project to at least (lang dune 2.7). Warning in b.0.0.2: The package tagged dune as a build dependency. Due to a bug in dune (https://github.com/ocaml/dune/issues/2147) this should never be the case. Please remove the {build} tag from its filter. Warning in b.0.0.2: The package has a dune dependency without a lower bound. Error in b.0.0.2: error 3: File format error in 'unknown-field' at line 11, column 0: Invalid field unknown-field [1] - $ opam-ci-check lint -r . -c b.0.0.3 + $ opam-ci-check lint -r . b.0.0.3:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in b.0.0.3: Your dune-project file indicates that this package requires at least dune 3.16 but your opam file only requires dune >= 3.15.0. Please check which requirement is the right one, and fix the other. Error in b.0.0.3: Weak checksum algorithm(s) provided. Please use SHA-256 or SHA-512. Details: opam field extra-files contains only MD5 as checksum for 0install.install @@ -80,24 +165,24 @@ Test the following: Error in b.0.0.3: extra-files present. This is not allowed in the opam-repository. Please use extra-source instead. Error in b.0.0.3: package with conflict class 'ocaml-host-arch' requires name prefix 'host-arch-' [1] - $ opam-ci-check lint -r . -c system-b.0.0.1 + $ opam-ci-check lint -r . system-b.0.0.1:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in system-b.0.0.1: No package source directory provided. Error in system-b.0.0.1: package with prefix 'system-' requires conflict class 'ocaml-system' [1] - $ opam-ci-check lint -r . -c b.0.0.4 + $ opam-ci-check lint -r . b.0.0.4:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Warning in b.0.0.4: The package seems to use dune but the dune-project file is missing. [1] - $ opam-ci-check lint -r . -c b.0.0.5 + $ opam-ci-check lint -r . b.0.0.5:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Warning in b.0.0.5: The package has a dune-project file but no explicit dependency on dune was found. [1] - $ opam-ci-check lint -r . -c b.0.0.6 + $ opam-ci-check lint -r . b.0.0.6:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in $TESTCASE_ROOT/./packages/b/b.0.0.6/opam: Failed to parse the opam file due to 'Parse error' [1] - $ opam-ci-check lint -r . -c b.0.0.7 + $ opam-ci-check lint -r . b.0.0.7:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in b.0.0.7: No package source directory provided. Error in b.0.0.7: error 23: Missing field 'maintainer' @@ -117,7 +202,7 @@ Setup repo for name collision tests Tests the package name collision detection by adding a version of a package [a_1] that conflicts with the existing [a-1] package - $ opam-ci-check lint -r . -n a_1.0.0.1 + $ opam-ci-check lint -r . a_1.0.0.1 # inferring that the package is new Linting opam-repository at $TESTCASE_ROOT/. ... Error in a_1.0.0.1: No package source directory provided. Warning in a_1.0.0.1: Possible name collision with package 'a-1' @@ -135,7 +220,7 @@ Setup repo for unnecessary fields tests Test presence of unnecessary fields in a-1.0.0.2 package - $ opam-ci-check lint -r . -c a-1.0.0.2 + $ opam-ci-check lint -r . a-1.0.0.2:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Warning in a-1.0.0.2: Unnecessary field 'name'. It is suggested to remove it. Warning in a-1.0.0.2: Unnecessary field 'version'. It is suggested to remove it. @@ -154,7 +239,7 @@ Setup repo for unmatched name and version test Test presence of unnecessary fields in a-1.0.0.2 package - $ opam-ci-check lint -r . -c a-1.0.0.2 + $ opam-ci-check lint -r . a-1.0.0.2:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.2: The field 'name' that doesn't match its context. Field 'name' has value 'b-1' but was expected of value 'a-1'. Error in a-1.0.0.2: The field 'version' that doesn't match its context. Field 'version' has value '0.0.1' but was expected of value '0.0.2'. @@ -173,7 +258,7 @@ Setup repo for unexpected file Test presence of unexpected files in a-1.0.0.2 package - $ opam-ci-check lint -r . -c a-1.0.0.2 + $ opam-ci-check lint -r . a-1.0.0.2:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.2: No package source directory provided. Error in a-1.0.0.2: Unexpected file in packages/a-1/a-1.0.0.2/files @@ -191,7 +276,7 @@ Setup repo for Forbidden perm file Test presence of unexpected files in a-1.0.0.2 package - $ opam-ci-check lint -r . -c a-1.0.0.2 + $ opam-ci-check lint -r . a-1.0.0.2:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.2: No package source directory provided. Error in a-1.0.0.2: Forbidden permission for file packages/a-1/a-1.0.0.2/opam. All files should have permissions 644. @@ -220,7 +305,7 @@ valid package: Test that we report the expected linting error: - $ opam-ci-check lint -r . -c a-1.0.0.1 + $ opam-ci-check lint -r . a-1.0.0.1:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.1: No package source directory provided. Error in a-1.0.0.1: warning 36: Missing field 'bug-reports' @@ -238,7 +323,7 @@ contact lint: -maintainer: "Maintainer " +maintainer: ["Maintainer1" "Maintaner2 "] -bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" - $ opam-ci-check lint -r . -c a-1.0.0.1 + $ opam-ci-check lint -r . a-1.0.0.1:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.1: No package source directory provided. Error in a-1.0.0.1: warning 36: Missing field 'bug-reports' @@ -255,7 +340,7 @@ passes linting: $ git diff packages/a-1/a-1.0.0.1/opam | grep '^[+-][^+-]' -maintainer: "Maintainer " +maintainer: ["Maintainer1" "Maintaner2"] - $ opam-ci-check lint -r . -c a-1.0.0.1 + $ opam-ci-check lint -r . a-1.0.0.1:new=false Linting opam-repository at $TESTCASE_ROOT/. ... Error in a-1.0.0.1: No package source directory provided. [1] diff --git a/opam-ci-check/test/patches/b-correct.patch b/opam-ci-check/test/patches/b-correct.patch deleted file mode 100644 index 0dcf52df..00000000 --- a/opam-ci-check/test/patches/b-correct.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 00dbea20350d84b089ff1c1014252fa31babcb2a Mon Sep 17 00:00:00 2001 -From: benmandrew -Date: Mon, 19 Feb 2024 14:25:05 +0100 -Subject: [PATCH] b - ---- - packages/b/b.0.0.1/opam | 13 +++++++++++++ - packages/b/b.0.0.2/opam | 13 +++++++++++++ - packages/b/b.0.0.3/opam | 13 +++++++++++++ - 3 files changed, 39 insertions(+) - create mode 100644 packages/b/b.0.0.1/opam - create mode 100644 packages/b/b.0.0.2/opam - create mode 100644 packages/b/b.0.0.3/opam - -diff --git a/packages/b/b.0.0.1/opam b/packages/b/b.0.0.1/opam -new file mode 100644 -index 0000000..69040f4 ---- /dev/null -+++ b/packages/b/b.0.0.1/opam -@@ -0,0 +1,14 @@ -+opam-version: "2.0" -+synopsis: "Synopsis" -+description: "Description" -+maintainer: "Maintainer " -+author: "Author" -+license: "Apache-2.0" -+homepage: "https://github.com/ocurrent/opam-repo-ci" -+bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" -+dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git" -+doc: "https://ocurrent.github.io/ocurrent/" -+build: [] -+depends: [ -+ "a-1" {>= "0.0.1"} -+] -diff --git a/packages/b/b.0.0.2/opam b/packages/b/b.0.0.2/opam -new file mode 100644 -index 0000000..1581508 ---- /dev/null -+++ b/packages/b/b.0.0.2/opam -@@ -0,0 +1,14 @@ -+opam-version: "2.0" -+synopsis: "Synopsis" -+description: "Description" -+maintainer: "Maintainer " -+author: "Author" -+license: "Apache-2.0" -+homepage: "https://github.com/ocurrent/opam-repo-ci" -+bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" -+dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git" -+doc: "https://ocurrent.github.io/ocurrent/" -+build: [] -+depends: [ -+ "a-1" {>= "0.0.2"} -+] -diff --git a/packages/b/b.0.0.3/opam b/packages/b/b.0.0.3/opam -new file mode 100644 -index 0000000..5ec1dc4 ---- /dev/null -+++ b/packages/b/b.0.0.3/opam -@@ -0,0 +1,14 @@ -+opam-version: "2.0" -+synopsis: "Synopsis" -+description: "Description" -+maintainer: "Maintainer " -+author: "Author" -+license: "Apache-2.0" -+homepage: "https://github.com/ocurrent/opam-repo-ci" -+bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" -+dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git" -+doc: "https://ocurrent.github.io/ocurrent/" -+build: [] -+depends: [ -+ "a-1" {< "0.0.2"} -+] --- -2.43.0 diff --git a/opam-ci-check/test/patches/b.0.0.1-correct.patch b/opam-ci-check/test/patches/b.0.0.1-correct.patch new file mode 100644 index 00000000..e68edb7e --- /dev/null +++ b/opam-ci-check/test/patches/b.0.0.1-correct.patch @@ -0,0 +1,26 @@ +diff --git a/packages/b/b.0.0.1/opam b/packages/b/b.0.0.1/opam +new file mode 100644 +index 0000000..fea805d +--- /dev/null ++++ b/packages/b/b.0.0.1/opam +@@ -0,0 +1,19 @@ ++opam-version: "2.0" ++synopsis: "Synopsis" ++description: "Description" ++maintainer: "Maintainer " ++author: "Author" ++license: "Apache-2.0" ++homepage: "https://github.com/ocurrent/opam-repo-ci" ++bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" ++dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git" ++doc: "https://ocurrent.github.io/ocurrent/" ++build: [] ++depends: [ ++ "a-1" {>= "0.0.1"} ++ "dune" {>= "3.16.0"} ++] ++url { ++ src: "b.0.0.1.tgz" ++ checksum: ["sha256=e26dfd7fa9731d0d43239c8b7d36bd3d79b0f709f1cdfa2ada7a7ab5d79d1911"] ++} + diff --git a/opam-ci-check/test/patches/b.0.0.3-correct.patch b/opam-ci-check/test/patches/b.0.0.3-correct.patch new file mode 100644 index 00000000..b0142b8a --- /dev/null +++ b/opam-ci-check/test/patches/b.0.0.3-correct.patch @@ -0,0 +1,51 @@ +diff --git a/packages/b/b.0.0.2/opam b/packages/b/b.0.0.2/opam +new file mode 100644 +index 0000000..326a3e0 +--- /dev/null ++++ b/packages/b/b.0.0.2/opam +@@ -0,0 +1,19 @@ ++opam-version: "2.0" ++synopsis: "Synopsis" ++description: "Description" ++maintainer: "Maintainer " ++author: "Author" ++license: "Apache-2.0" ++homepage: "https://github.com/ocurrent/opam-repo-ci" ++bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" ++dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git" ++doc: "https://ocurrent.github.io/ocurrent/" ++build: [] ++depends: [ ++ "a-1" {>= "0.0.2"} ++ "dune" {>= "3.16.0"} ++] ++url { ++ src: "b.0.0.2.tgz" ++ checksum: ["sha256=e26dfd7fa9731d0d43239c8b7d36bd3d79b0f709f1cdfa2ada7a7ab5d79d1911"] ++} +diff --git a/packages/b/b.0.0.3/opam b/packages/b/b.0.0.3/opam +new file mode 100644 +index 0000000..3059614 +--- /dev/null ++++ b/packages/b/b.0.0.3/opam +@@ -0,0 +1,19 @@ ++opam-version: "2.0" ++synopsis: "Synopsis" ++description: "Description" ++maintainer: "Maintainer " ++author: "Author" ++license: "Apache-2.0" ++homepage: "https://github.com/ocurrent/opam-repo-ci" ++bug-reports: "https://github.com/ocurrent/opam-repo-ci/issues" ++dev-repo: "git+https://github.com/ocurrent/opam-repo-ci.git" ++doc: "https://ocurrent.github.io/ocurrent/" ++build: [] ++depends: [ ++ "a-1" {< "0.0.2"} ++ "dune" {>= "3.16.0"} ++] ++url { ++ src: "b.0.0.3.tgz" ++ checksum: ["sha256=e26dfd7fa9731d0d43239c8b7d36bd3d79b0f709f1cdfa2ada7a7ab5d79d1911"] ++} +