Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file opamRepositoryConfig.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116(**************************************************************************)(* *)(* Copyright 2015 OCamlPro *)(* *)(* All rights reserved. This file is distributed under the terms of the *)(* GNU Lesser General Public License version 2.1, with the special *)(* exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)openOpamTypestypedl_tool_kind=[`Curl|`Default]typet={download_tool:(arglist*dl_tool_kind)Lazy.t;validation_hook:arglistoption;retries:int;force_checksums:booloption;}type'aoptions_fun=?download_tool:(OpamTypes.arglist*dl_tool_kind)Lazy.t->?validation_hook:arglistoption->?retries:int->?force_checksums:booloption->'aletdefault={download_tool=lazy(trylettools=ifOpamStd.Sys.(os()=Darwin)then["wget",`Default;"curl",`Curl]else["curl",`Curl;"wget",`Default]inletcmd,kind=List.find(fun(c,_)->OpamSystem.resolve_commandc<>None)toolsin[CIdentcmd,None],kindwithNot_found->OpamConsole.error_and_exit`Configuration_error"Could not find a suitable download command. Please make sure you \
have either \"curl\" or \"wget\" installed, or specify a custom \
command through variable OPAMFETCH.");validation_hook=None;retries=3;force_checksums=None;}letsetkkt?download_tool?validation_hook?retries?force_checksums=let(+)xopt=matchoptwithSomex->x|None->xink{download_tool=t.download_tool+download_tool;validation_hook=t.validation_hook+validation_hook;retries=t.retries+retries;force_checksums=t.force_checksums+force_checksums;}letsett=setk(funx()->x)tletr=refdefaultletupdate?noop:_=setk(funcfg()->r:=cfg)!rletinitkk=letopenOpamStd.ConfiginletopenOpamStd.Option.Opinletdownload_tool=env_string"FETCH">>=(funs->letargs=OpamStd.String.splits' 'inmatchargswith|cmd::a->letcmd,kind=ifOpamStd.String.ends_with~suffix:"curl"cmdthen(CIdent"curl",None),`Curlelseifcmd="wget"then(CIdent"wget",None),`Defaultelse(CStringcmd,None),`Defaultinletc=cmd::List.map(funa->OpamTypes.CStringa,None)ainSome(lazy(c,kind))|[]->None)>>+fun()->env_string"CURL">>|(funs->lazy([CStrings,None],`Curl))inletvalidation_hook=env_string"VALIDATIONHOOK">>|funs->matchList.map(funs->CStrings,None)(OpamStd.String.splits' ')with|[]->None|l->Somelinletforce_checksums=matchenv_bool"REQUIRECHECKSUMS",env_bool"NOCHECKSUMS"with|Sometrue,_->Some(Sometrue)|_,Sometrue->Some(Somefalse)|None,None->None|_->SomeNoneinsetk(setk(func->r:=c;k))!r?download_tool?validation_hook?retries:(env_int"RETRIES")?force_checksumsletinit?noop:_=initk(fun()->())