| 1 |
Source helpers for creating another repo, etc. |
| 2 |
|
| 3 |
We setup a couple of different mock repositories. First, create |
| 4 |
mock-opam-repository with a couple of packages |
| 5 |
|
| 6 |
$ mkrepo |
| 7 |
$ mkpkg foo "0.0.2" |
| 8 |
$ mkpkg bar <<EOF |
| 9 |
> depends: [ "foo" {>= "0.0.1"} ] |
| 10 |
> synopsis: "Mock bar package that depends on foo." |
| 11 |
> EOF |
| 12 |
$ mkpkg blah |
| 13 |
|
| 14 |
Create dune-workspace with mock repo configured |
| 15 |
|
| 16 |
$ add_mock_repo_if_needed |
| 17 |
|
| 18 |
Search for all packages |
| 19 |
|
| 20 |
$ dune pkg search |
| 21 |
- bar 0.0.1 Mock bar package that depends on foo. |
| 22 |
- blah 0.0.1 (no synopsis) |
| 23 |
- foo 0.0.2 (no synopsis) |
| 24 |
|
| 25 |
Next, create other-opam-repository with a couple of conflicting packages |
| 26 |
|
| 27 |
$ mkrepo_other |
| 28 |
$ mkpkg_other baz |
| 29 |
$ mkpkg_other foo "0.0.1" <<EOF |
| 30 |
> synopsis: "Foo package in other repo with a synopsis, but lower version." |
| 31 |
> EOF |
| 32 |
$ mkpkg_other bar "0.0.1" <<EOF |
| 33 |
> depends: [ "foo" {>= "0.0.1"} ] |
| 34 |
> synopsis: "Mock bar package in other repo that depends on foo." |
| 35 |
> EOF |
| 36 |
$ mkpkg_other blah <<EOF |
| 37 |
> flags: [avoid-version] |
| 38 |
> synopsis: "Mock blah package that should be avoided!!" |
| 39 |
> EOF |
| 40 |
|
| 41 |
Create a dune-workspace with both the mock repositories added |
| 42 |
|
| 43 |
$ create_dune_workspace_with_mock_repos |
| 44 |
|
| 45 |
Search for all packages |
| 46 |
|
| 47 |
$ dune pkg search |
| 48 |
- bar 0.0.1 Mock bar package in other repo that depends on foo. |
| 49 |
- baz 0.0.1 (no synopsis) |
| 50 |
- blah 0.0.1 (no synopsis) |
| 51 |
- foo 0.0.2 (no synopsis) |
| 52 |
|
| 53 |
Search with a query argument -- exact name |
| 54 |
|
| 55 |
$ dune pkg search bar |
| 56 |
- bar 0.0.1 Mock bar package in other repo that depends on foo. |
| 57 |
|
| 58 |
Another search with a query argument - substring of package name |
| 59 |
|
| 60 |
$ dune pkg search ar |
| 61 |
- bar 0.0.1 Mock bar package in other repo that depends on foo. |