Skip to content

Commit

Permalink
Fix url publication derivation for github users (closes #106).
Browse files Browse the repository at this point in the history
The url is derived from the dev-repo field. This field can hold opam
"version control bound urls", which for mgithub means it can be
prefixed by 'git+' which is now chopped.
  • Loading branch information
dbuenzli committed Mar 14, 2017
1 parent 56c82f7 commit da96126
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src-care/topkg_care_pkg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ let chop_ext u = match String.cut ~rev:true ~sep:"." u with
| None -> u
| Some (u, _) -> u

let chop_git_prefix u = match String.cut ~sep:"git+" u with
| Some ("", uri) -> uri
| _ -> u

(* Package *)

type t =
Expand Down Expand Up @@ -199,7 +203,7 @@ let distrib_uri ?(raw = false) p =
opam_field_hd p "dev-repo">>= function
| None -> not_found ()
| Some dev_repo ->
Ok (uri_append (chop_ext dev_repo)
Ok (uri_append (chop_git_prefix (chop_ext dev_repo))
"releases/download/$(VERSION)/$(NAME)-$(VERSION_NUM).tbz")
in
if raw then uri else subst_uri p uri
Expand Down
2 changes: 1 addition & 1 deletion src/topkg.mli
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ let clean os ~build_dir = OS.Cmd.run @@ Pkg.clean_cmd os ~build_dir
hostname of PKG_HOMEPAGE is [github] the following is used:
{[PKG_DEV_REPO/releases/download/$(VERSION)/$(NAME)-$(VERSION_NUM).tbz]}
where PKG_DEV_REPO is the package's opam file [dev-repo] field
without the [.git] suffix.}} *)
without the [.git] suffix and a possible [git+] prefix.}} *)

val watermarks : watermark list
(** [watermarks] is the default list of watermarks. It has the following
Expand Down

0 comments on commit da96126

Please sign in to comment.