Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort opam fields #185

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
opam2web
========

A tool to generate a website from an OPAM universe
A tool to generate a website from an opam universe

This utility creates a static website from an OPAM universe, listing all
available packages and their details. A homepage and OPAM documentation is
This utility creates a static website from an opam universe, listing all
available packages and their details. A homepage and opam documentation is
included as well.

The latest release of opam2web is available via
Expand Down Expand Up @@ -112,7 +112,7 @@ opam2web --help
opam2web -o website path:~/myrepo local:default
```
will generate the HTML files corresponding to the repository located in
`~/myrepo` and the remote named `default` in the local OPAM installation.
`~/myrepo` and the remote named `default` in the local opam installation.
Resulting files will be located in the `website` directory.


Expand Down
6 changes: 4 additions & 2 deletions bin/opam2web.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down Expand Up @@ -257,8 +257,10 @@ let default_cmd =


let () =
OpamArg.preinit_opam_env_variables ();
OpamArg.init_opam_env_variabes OpamCLIVersion.Sourced.current;
OpamFormatConfig.init ();
OpamStd.Config.init ();
OpamCoreConfig.init ();
OpamRepositoryConfig.init ();
OpamSolverConfig.init ();
OpamStateConfig.init ();
Expand Down
14 changes: 6 additions & 8 deletions opam2web.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ depends: [
"cow" {>= "2.3.0"}
"js_of_ocaml" {>= "3.3.0"}
"js_of_ocaml-ppx"
"opam-core" {>= "2.0.0" & < "2.1.0~"}
"opam-format" {>= "2.0.0" & < "2.1.0~"}
"opam-state" {>= "2.0.0" & < "2.1.0~"}
"opam-client" {>= "2.0.0" & < "2.1.0~"}
"opam-file-format" {>="2.1.0" & < "2.1.1"}
"opam-core" {>= "2.1.0"}
"opam-format" {>= "2.1.0"}
"opam-state" {>= "2.1.0"}
"opam-client" {>= "2.1.0"}
"cohttp-lwt-unix"
"yojson" {>= "1.6.0"}
"opam-file-format" {< "2.1.1"}
"cmdliner" {>= "1.0.4"}
"omd" {>= "1.3.1" & < "2.0.0~"}
]
Expand All @@ -32,7 +30,7 @@ build: [
dev-repo: "git+https://github.com/ocaml/opam2web.git"
synopsis: "Tool to generate the opam.ocaml.org website"
description: """
This utility creates a static website from an OPAM universe, listing all
available packages and their details. A homepage and OPAM documentation is
This utility creates a static website from an opam universe, listing all
available packages and their details. A homepage and opam documentation is
included as well.
"""
2 changes: 1 addition & 1 deletion src/js_search/search.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wBlog.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wBlog.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wDocumentation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wDocumentation.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wGlobals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wGlobals.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
4 changes: 2 additions & 2 deletions src/o2wHome.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down Expand Up @@ -43,7 +43,7 @@ let make_datasets universe =
let nb_packages = OpamPackage.Set.cardinal latest_packages in
{ nb_packages; last10_updates; top10_pkgs }

(* OPAM website homepage *)
(* Opam website homepage *)
let to_html ~content_dir ~news ?statistics ds =
let updates_last10 =
let mk_update_li (pkg, update_tm) =
Expand Down
2 changes: 1 addition & 1 deletion src/o2wHome.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wJson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wJson.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wMisc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wMisc.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
26 changes: 16 additions & 10 deletions src/o2wPackage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand All @@ -20,6 +20,8 @@ open O2wTypes
open OpamStateTypes
open OpamStd.Option.Op

module OpamPrinter = OpamPrinter.FullPos

let ( ++ ) = Html.( ++ )

let compare_alphanum = OpamPackage.compare
Expand Down Expand Up @@ -136,10 +138,10 @@ let html_atom ~prefix st pkg (name, f) =
Some
(html_of_formula (function
| Constraint (op, FString s) ->
Html.string (OpamPrinter.relop op) ++
Html.string (OpamPrinter.relop_kind op) ++
Html.span ~cls:"package-version" (Html.string s)
| Constraint (op, v) ->
Html.string (OpamPrinter.relop op) ++
Html.string (OpamPrinter.relop_kind op) ++
Html.span ~cls:"label" (Html.string (OpamFilter.to_string v))
| Filter f ->
Html.span ~cls:"label" (Html.string (OpamFilter.to_string f)))
Expand Down Expand Up @@ -167,7 +169,10 @@ let to_html ~prefix univ pkg =
in
let {name; version} = pkg in
let pkg = OpamPackage.create pkg.name pkg.version in
let pkg_opam = OpamSwitchState.opam univ.st pkg in
let pkg_opam =
OpamSwitchState.opam univ.st pkg
|> OpamFileTools.sort_opam
in
let version_links =
let version_set =
OpamPackage.versions_of_name univ.st.packages pkg.name
Expand Down Expand Up @@ -471,14 +476,15 @@ let to_html ~prefix univ pkg =
OpamPackage.Map.mem pkg
(OpamRepositoryName.Map.find r univ.st.switch_repos.repo_opams))) >>|
OpamRepositoryState.get_repo univ.st.switch_repos >>= fun r ->
OpamFile.Repo.read_opt (OpamRepositoryPath.repo r.repo_root) >>=
OpamFile.Repo.read_opt
(OpamRepositoryPath.repo
(OpamRepositoryState.get_repo_root univ.st.switch_repos r)) >>=
OpamFile.Repo.upstream >>= fun upstream ->
OpamFile.OPAM.metadata_dir pkg_opam >>| fun pkgdir ->
OpamFile.OPAM.metadata_dir pkg_opam >>= (function
| Some _repo_name, rel -> Some rel
| _, _ -> None) >>| fun pkg_rel ->
let base = Uri.of_string upstream in
let rel =
OpamFilename.remove_prefix r.repo_root OpamFilename.Op.(pkgdir // "opam")
in
let url = Uri.(resolve "" base (of_string rel)) in
let url = Uri.(resolve "" base (of_string pkg_rel)) in
let loc = Uri.to_string url in
mk_tr (Some ("Edit", Html.a ~title:"Edit this package description"
~href:url
Expand Down
2 changes: 1 addition & 1 deletion src/o2wPackage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
4 changes: 3 additions & 1 deletion src/o2wStatistics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand All @@ -29,7 +29,9 @@ module FloM =
let compare a b = int_of_float (a -. b)
let to_string = string_of_float
let to_json _ = `Null
let of_json _ = None
end)
module OpamPrinter = OpamPrinter.FullPos

let empty_stats = {
pkg_stats = OPM.empty;
Expand Down
2 changes: 1 addition & 1 deletion src/o2wStatistics.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wTemplate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
2 changes: 1 addition & 1 deletion src/o2wTemplate.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down
4 changes: 2 additions & 2 deletions src/o2wTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(* GNU Lesser General Public License version 3.0 with linking *)
(* exception. *)
(* *)
(* OPAM is distributed in the hope that it will be useful, but WITHOUT *)
(* Opam is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *)
(* or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public *)
(* License for more details. *)
Expand Down Expand Up @@ -112,7 +112,7 @@ type log_referrer =
| Internal_ref of string
| No_ref

(** A high-level, OPAM-repository specific type for a apache log entry *)
(** A high-level, opam-repository specific type for a apache log entry *)
type log_entry = {
log_timestamp: float;
log_host: string;
Expand Down
Loading