jon.recoil.org

Module OpamUrlSource

URL parsing and printing, with support for our different backends

Sourcetype version_control = [
  1. | `git
  2. | `darcs
  3. | `hg
]
Sourcetype backend = [
  1. | `http
  2. | `rsync
  3. | OpamUrl.version_control
]
Sourceval string_of_backend : OpamUrl.backend -> string
Sourceexception Parse_error of string
Sourceval backend_of_string : string -> [> OpamUrl.backend ]

Tolerates lots of backward compatibility names;

Sourcetype t = {
  1. transport : string;
    (*

    the part just before '://'

    *)
  2. path : string;
    (*

    the part after '://'

    *)
  3. hash : string option;
    (*

    the optional branch/ref specification, at the end after a '#'

    *)
  4. backend : OpamUrl.backend;
    (*

    the backend that opam should use to handle this url

    *)
}
Sourceval parse : ?backend:OpamUrl.backend -> ?handle_suffix:bool -> ?from_file:bool -> string -> OpamUrl.t

Same as of_string, but allows enforcing the expected backend, and may otherwise guess version control from the suffix by default (for e.g. https://foo/bar.git). (this should be disabled when parsing from files). Note that handle_suffix also handles user-name in ssh addresses (e.g. "ssh://git@github.com/..."). If from_file is set to false, it resolves rsync/file relative path.

Sourceval parse_opt : ?quiet:bool -> ?backend:OpamUrl.backend -> ?handle_suffix:bool -> ?from_file:bool -> string -> OpamUrl.t option

Same as parse, but catch Parse_error. In this case, display a warning if quiet is not set to true.

include OpamStd.ABSTRACT with type t := OpamUrl.t
Sourceval compare : OpamUrl.t -> OpamUrl.t -> int
Sourceval equal : OpamUrl.t -> OpamUrl.t -> bool
Sourceval of_string : string -> OpamUrl.t
Sourceval to_string : OpamUrl.t -> string
Sourcemodule Set : OpamStd.SET with type elt = OpamUrl.t
Sourcemodule Map : OpamStd.MAP with type key = OpamUrl.t
Sourceval to_string_w_subpath : OpamFilename.SubPath.t option -> OpamUrl.t -> string
Sourceval empty : OpamUrl.t

Dummy filler url

Sourceval base_url : OpamUrl.t -> string

Returns the url string without the VC part (i.e. "git+foo://bar" returns "foo://bar")

Sourceval basename : OpamUrl.t -> string

The last part of the url path, e.g. "http://foo/bar/this" or "http://that.here/"

Returns the url with all path components but the first one (the hostname) dropped, e.g. "http://some.host/some/path" becomes "http://some.host"

Sourceval has_trailing_slash : OpamUrl.t -> bool
Sourceval local_dir : OpamUrl.t -> OpamFilename.Dir.t option

Check if the URL matches an existing local directory, and return it

Sourceval local_file : OpamUrl.t -> OpamFilename.t option

Check if the URL matches an existing local file, and return it

Sourceval guess_version_control : string -> [> OpamUrl.version_control ] option

If the given url-string has no 'transport://' specification and corresponds to an existing local path, check for version-control clues at that path

Sourceval map_file_url : (string -> string) -> OpamUrl.t -> OpamUrl.t

map_file_url f url applies f to the path portion of url if transport is "file".

Sourcemodule Op : sig ... end