OCaml 启用私有repository仓库

OCaml opam支持添加自定义仓库。 我是直接fork了opam-repository的仓库,然后把我的仓库发布提交上去了。

看看效果

[email protected] ~/workspace/private/bsmi_ocaml (master) $ opam search bsmi_ocaml --repo=cnmade
# Packages matching: match(*bsmi_ocaml*) & from-repository(cnmade)
# Name     # Installed # Synopsis
bsmi_ocaml --          Bsmi common ocaml library
[email protected] ~/workspace/private/bsmi_ocaml (master) $ opam search bsmi_ocaml
# Packages matching: match(*bsmi_ocaml*)
# Name     # Installed # Synopsis
bsmi_ocaml --          Bsmi common ocaml library
[email protected] ~/workspace/private/bsmi_ocaml (master) $ opam install bsmi_ocaml
The following actions will be performed:
  ↗ upgrade   camlp-streams  5.0 to 5.0.1
  ∗ install   bsmi_ocaml     0.1.6
  ↻ recompile atdgen-runtime 2.9.1        [uses camlp-streams]
  ↻ recompile atdgen         2.9.1        [uses atdgen-runtime]
  ↻ recompile github-data    4.4.1        [uses atdgen]
  ↻ recompile github         4.4.1        [uses github-data]
  ↻ recompile github-unix    4.4.1        [uses github]
  ↻ recompile opam-publish   2.1.0        [uses github]
===== ∗ 1   ↻ 6   ↗ 1 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved atdgen.2.9.1  (cached)
⬇ retrieved atdgen-runtime.2.9.1  (cached)
⬇ retrieved github.4.4.1  (cached)
⬇ retrieved github-data.4.4.1  (cached)
⬇ retrieved github-unix.4.4.1  (cached)
⬇ retrieved opam-publish.2.1.0  (cached)
⬇ retrieved bsmi_ocaml.0.1.6  (https://github.com/infobsmi/bsmi_ocaml/archive/0.1.6.tar.gz)
⬇ retrieved camlp-streams.5.0.1  (https://github.com/ocaml/camlp-streams/archive/v5.0.1.tar.gz)
⊘ removed   opam-publish.2.1.0
⊘ removed   github-unix.4.4.1
⊘ removed   github.4.4.1
⊘ removed   github-data.4.4.1
⊘ removed   atdgen.2.9.1
⊘ removed   atdgen-runtime.2.9.1
⊘ removed   camlp-streams.5.0
∗ installed camlp-streams.5.0.1
∗ installed bsmi_ocaml.0.1.6
∗ installed atdgen-runtime.2.9.1
∗ installed atdgen.2.9.1
∗ installed github-data.4.4.1
∗ installed github.4.4.1
∗ installed github-unix.4.4.1
∗ installed opam-publish.2.1.0
Done.

查看我有几个仓库

$ opam repo -a
# Repository # Url                                             # Switches(rank)
cnmade       git+https://github.com/cnmade/opam-repository.git default(1/2)
default      https://opam.ocaml.org                            <default> default(2/2)

添加仓库很简单

opam repo add dev https://github.com/your-name/your-repo.git

add 后面加仓库名,只能英文,然后后面是仓库具体地址,一般是https,也可以是git

 

分类: 默认 标签: 发布于: 2022-06-29 22:36:17, 更新于: 2022-06-29 22:38:37