12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273(** Configuration information to set up a store. *)openLwt.Infixtypet=[|`Btrfsofstring(* Path *)|`Zfsofstring(* Path with pool at end *)|`Rsyncofstring(* Path for the root of the store *)]letis_absolutepath=not(Filename.is_relativepath)letof_strings=matchAstring.String.cuts~sep:":"with|Some("zfs",pool)->Ok(`Zfspool)|Some("btrfs",path)whenis_absolutepath->Ok(`Btrfspath)|Some("rsync",path)whenis_absolutepath->Ok(`Rsyncpath)|_->Error(`Msg"Store must start with zfs: or btrfs:/ or rsync:/")letppf=function|`Zfspath->Fmt.pff"zfs:%s"path|`Btrfspath->Fmt.pff"btrfs:%s"path|`Rsyncpath->Fmt.pff"rsync:%s"pathtypestore=Store:(moduleS.STOREwithtypet='a)*'a->storeletto_storersync_mode=function|`Btrfspath->Btrfs_store.createpath>|=funstore->Store((moduleBtrfs_store),store)|`Zfspath->Zfs_store.create~path>|=funstore->Store((moduleZfs_store),store)|`Rsyncpath->Rsync_store.create~path~mode:rsync_mode()>|=funstore->Store((moduleRsync_store),store)openCmdlinerletstore_t=Arg.conv(of_string,pp)letstorenames=Arg.optArg.(somestore_t)None@@Arg.info~doc:"$(docv) must be one of $(b,btrfs:/path), $(b,rsync:/path) or $(b,zfs:pool) for the OBuilder cache."~docv:"STORE"namesletrsync_mode=letoptions=[("copy",Rsync_store.Copy);("hardlink",Rsync_store.Hardlink);("hardlink_unsafe",Rsync_store.Hardlink_unsafe)]inArg.value@@Arg.opt(Arg.enumoptions)Rsync_store.Copy@@Arg.info~doc:(Printf.sprintf"Optimize for speed or low disk usage. $(docv) must be one of %s."(Arg.doc_alts_enumoptions))~docv:"RSYNC_MODE"["rsync-mode"](** A Cmdliner term where the store is required. *)letcmdliner=Term.(constto_store$rsync_mode$(Arg.required@@(store["store"])))(** A Cmdliner term where the store is optional. *)letcmdliner_opt=letmakersync_mode=function|None->None|Somestore->Some(to_storersync_modestore)inTerm.(constmake$rsync_mode$(Arg.value@@(store["obuilder-store"])))